in reply to Re: Debugging a login script using MySQL
in thread Debugging a login script using MySQL
I did make progress by modifing to the code below. It doesn't kill the script now (who knows why) but it doesn't sign in either. By adding the print header line the 500 error is gone but it doesn't say the login was successfull or the login failed. So I'm thinking it has something to do with the database lines.
Anyone have any ideas?
else { print "Content-type: text/html\n\n"; use CGI::Carp qw(fatalsToBrowser); print "test<br><br>"; #exit; $username = (param('form_user')); $userpass = (param('form_pass')); $userpass = md5_hex($userpass); #check the database my $dbh = DBI->connect("DBI:mysql:$edt_dbase", $mysql_user, $m +ysql_pass) or print DBI->errstr; my $sth = $dbh->prepare("SELECT * FROM $users_table WHERE user +name = '$username' AND user_password = '$userpass'"); $sth->execute; print "test 2"; if ($sth->rows < 1) { print "Content-type: text/html\n\n"; print "Login information incorrect."; $dbh->disconnect; print "<script>window.location = 'login.cgi';</script>\n"; exit; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Debugging a login script using MySQL
by Thilosophy (Curate) on Jan 05, 2005 at 05:11 UTC | |
by coldfingertips (Pilgrim) on Jan 05, 2005 at 07:10 UTC |