http://qs321.pair.com?node_id=306382


in reply to Re: perl tutorial clarification
in thread perl tutorial clarification

I'm not being funny but seeing as i just registered for this site, i thought you lot would take it easy with me.

Anyway, in the tutorial I looked at, the idea was to have a file for each user and the password in that file. I simpflied it a bit and ignored the need for encryption and cookies.

The link to the tutorial is here. The script executes without errors but doesn't recognise the user from the form on the previous page. Here's a snippet of the code:

... use constant USER_DATA => '../data/users/'; my $username = param( 'login' ) || ''; my $password = param( 'password' ) || ''; my $userfile = USER_DATA.$username; my $message = 'Bad password'; open USER, "< $userfile" or display_page( "Your username and password +information did not match. Check to see that you do not have Caps Lock on, hit the back button, and try again." ), exit; my $real_password = <USER>; close USER; if ( $password eq $real_password ) { $message = "Hello, $username. You gave me a good password"; } ...

Thanks, onemadjock