$passhash was written to a file with the user's name earlier on (in newuser.pl):# !perl use CGI qw(:standard); # use the CGI libraries print header; # start the html output $username = param('username'); # take <input name=username> $password = param('password'); # take <input name=password> + open(FILE, "./users/$username"); # open the user's file in $use +rs $passhash = <FILE>; # read the password hash from the f +ile close(FILE); # close the file if (crypt($password, $passhash) eq $passhash) { print "You are now logged in."; } else { print "Incorrect username or password, please try again."; }
My question is: how can I set it so that the user can stay logged in between pages (eg. use a cookie) without storing the password somewhere in plaintext to check $passhash against? Sorry if I've gone about this whole thing completely the wrong way.$salt = join '', ('.', '/', 0..9, 'A'..'Z', 'a'..'z') [rand 64, rand 6 +4]; # create random two-character salt $passhash = crypt($password, $salt); # hash the password with t +he salt
In reply to setting a cookie on login by reklaw
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |