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; }
In reply to Re^2: Debugging a login script using MySQL
by coldfingertips
in thread Debugging a login script using MySQL
by coldfingertips
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |