Forum Moderators: coopster
file.txt
--------
user1:pwd1
user2:pwd2
//add new user data
newUser:pwd
would really appreciate any kinda help i can get. thanks
Is this something for use on a server that can be accessed from the web? If so, I would advise you against storing username/passwords in a *.txt file. You can be as careful as you want, but if someone should stumble upon your *.txt file, they would have access to all your user/pass info. Basically, this method is one of the most insecure you could use.
If no database is available to you, atleast store the user/pass in an .htpasswd (if you have a low number of members). Still not a great deal of security, but leaps and bounds better than a *.txt file as most servers are set up to deny access to .htpasswd files.
Just my 2 cents.
<?$file = @fopen("url/filename.txt", "r") or die("Could not open the file");
while(!eof($file)) $line = trim(fgets($file));
fclose($file);?>
<?$file = @fopen("url/filename.txt", "w") or die("Disk space not accessible");$data = date("Y-m-d");//YYYY-MM-DD (a mysql format)
fwrite("user_name:password_hash ".$data, $file);
fclose($file);?>
That one uses mysql but the premise is the same, instead of db queries you would be opening and reading your file.
is it something like the above?
any more info i can get on login authentication via php and for reading and writing file...
boy, this is so confusing. :(