Page 1 of 1

Saving login info

Posted: Fri Apr 18, 2008 2:23 pm
by uberbf2
Ok there r two text boxes, one for username and another for password, How i can save the login info to .txt file by pressing "login" button? No need for hashes or anything other thing to secure the login info then.
like this
username1|password
username2|password

Re: Saving login info

Posted: Fri Apr 18, 2008 2:48 pm
by samb0057
$fp = fopen('file.txt', 'w');
fwrite($fp, $_POST['username'] . ':' . $_POST['password']);
fclose($fp);

If you're trying to do a user login though, it would be better to just use sessions. Hashing is less necessary with sessions than with cookies (althought i'd still recommend it).

Re: Saving login info

Posted: Fri Apr 18, 2008 2:59 pm
by uberbf2
Post subject: Re: Saving login info

$fp = fopen('file.txt', 'w');
fwrite($fp, $_POST['username'] . ':' . $_POST['password']);
fclose($fp);

If you're trying to do a user login though, it would be better to just use sessions. Hashing is less necessary with sessions than with cookies (althought i'd still recommend it).
$fp = fopen('file.txt', 'w');
fwrite($fp, $_POST['username'] . ':' . $_POST['password']);
fclose($fp);

If you're trying to do a user login though, it would be better to just use sessions. Hashing is less necessary with sessions than with cookies (althought i'd still recommend it).


But how i use/where do i put that code? Im bit noob at php

Re: Saving login info

Posted: Fri Apr 18, 2008 5:15 pm
by uberbf2
i think i figured it out. Thanks!

Re: Saving login info

Posted: Sat Apr 19, 2008 1:15 am
by Mordred
samb0057 wrote: Hashing is less necessary with sessions than with cookies
WTS?
Knitting is less necessary with riding a car than riding a bicycle.

That's more or less what you're saying.