Saving login info

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
uberbf2
Forum Newbie
Posts: 3
Joined: Fri Apr 18, 2008 2:16 pm

Saving login info

Post 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
samb0057
Forum Commoner
Posts: 27
Joined: Wed Mar 26, 2008 9:51 am

Re: Saving login info

Post 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).
uberbf2
Forum Newbie
Posts: 3
Joined: Fri Apr 18, 2008 2:16 pm

Re: Saving login info

Post 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
uberbf2
Forum Newbie
Posts: 3
Joined: Fri Apr 18, 2008 2:16 pm

Re: Saving login info

Post by uberbf2 »

i think i figured it out. Thanks!
User avatar
Mordred
DevNet Resident
Posts: 1579
Joined: Sun Sep 03, 2006 5:19 am
Location: Sofia, Bulgaria

Re: Saving login info

Post 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.
Post Reply