Sign in to follow this  
Followers 0
Newb

Mantaining an updatable file online on a server

4 posts in this topic

Hi all,

I Would like to ask how to let my script read a file on a server on which I have access, and so read and modify it. The file is a text file on which I would like to periodically append some text.

I'm asking what you think is the best solution about where to hold that file, and about the AutoIt commands to use for this task.

For the script commands I think FileRead or InetGet would do the work. But I'm wondering how to do the server access. I have an account on a free hosting service, thus if I upload the file up there, I will need to login with my username and password, so I would like to know how to do this too in autoit, or, if you have an idea on how to store a file online (because it will need to be accessed by multiple instances of the script, from different users) without the need of a password or something, or any other solution would be fine.

(Since the script will be distributed to my friends only, it can be something which is password free, or with a shared password or something. Obviously I won't share the free hosting service password because I have some personal websites up there)

So what is the best solution in your opinion? And if this solution includes an authentication access (username and password), how I do it in AutoIt?

Thank you in advance for any reply.


I'm a compulsive poster. When I post something, come to read it at least 5 minutes later after the posting, because I will edit it. I edited even this signature a few minutes later after I wrote it.

Share this post


Link to post
Share on other sites



Hello dude.

I'm asking what you think is the best solution about where to hold that file,

If it contains some confidential data such as logins || passwords etc. you'll need firstly encrypt it or at least you'll need to store that file on database such as MYSQL,Postgres etc.

So,it's your choise and your responcibility.

Ok hereis basic idea for you:

edit:

OMG somehow my post disappeared from forum.

Rolling back and copy/pasting it on pastebin:

http://pastebin.com/8tTmqq4T


[size="5"] [/size]

Share this post


Link to post
Share on other sites

Hi, thanks for the kind reply!

Why php is needed? I don't want to learn it because I think it's useless and a bad designed tecnology. There is a way to do it without php?


I'm a compulsive poster. When I post something, come to read it at least 5 minutes later after the posting, because I will edit it. I edited even this signature a few minutes later after I wrote it.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Why php is needed? There is a way to do it without php?

Hi,

The only way to avoid the use of php is to connect by ftp, which is not a good idea if your script is not for a personal use.

Here you go (php) :

//this is the page where you will do requests, named "toto.php" here.

if(isset($_GET['action'])) {
$sFileFullPath=$_GET['file'];

if(!empty($sFileFullPath)) {
switch($_GET['action']) { //?action=
case 'readfile':
$hFile=fopen($sFileFullPath, 'r');
echo fread($hFile, filesize($hFile)); //echo the content of the file
fclose($hFile);
break;
case 'editfile':
$hFile=fopen($sFileFullPath, 'w');
echo fwrite($hFile, $_GET['content']); //echo the result of the edit
fclose($hFile);
break;
case 'removefile':
echo unlink($sFileFullPath); //echo the result of the remove
break;
}
}

exit();
} else {
header('HTTP/1.1 403 Forbidden'); exit(); //forbid access to the page
}

//Examples:
//read: example.com/toto.php?action=readfile&file=test.txt
//edit: example.com/toto.php?action=editfile&file=test.txt&content=new%20content
//remove: example.com/toto.php?action=removefile&file=test.txt
?>

I don't want to learn it because I think it's useless and a bad designed tecnology.

You're wrong, but this isn't the right forum to discuss about it.

Br, FireFox.

Edited by FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0