login.html ---------- New Document
login_1.cgi ----------- #!c:/perl/bin/perl -w use CGI qw(:standard); use CGI::Carp qw(warningsToBrowser fatalsToBrowser); use DBI; my $dbh=DBI->connect("dbi:mysql:$dbname;",,) || die("cannot connect $!\n"); $sth = $dbh->prepare("select * from users where email = ?") or &dbdie; $sth->execute($usr) or &dbdie; if (my $name = $sth->fetchrow_hashref) { my $sth = $dbh->prepare("select * from users where password = ?") or &dbdie; $sth->execute($pwd) or &dbdie; if (my $pass = $sth->fetchrow_hashref){ print "login successful"; print qq(user settings); } else { &dienice(qq(The password is invalid.); } }else { &dienice(qq(E-mail does not exist.); } view_user_1.cgi --------------- #!c:/perl/bin/perl -w use CGI qw(:standard); use CGI::Carp qw(warningsToBrowser fatalsToBrowser); use DBI; $q = new CGI; $usr = $q->param('user'); #$usr=$FORM{'inputname'}; #$pwd = $q->param('element_2'); my $dbh=DBI->connect("dbi:mysql:$dbname;",,) || die("cannot connect $!\n"); $sth = $dbh->prepare("select * from users where email = ? ") or &dbdie; $sth->execute($usr) or &dbdie; print "Content-type:text/html\n\n"; print "here"; print $usr; my $dbh=DBI->connect("dbi:mysql:$dbname;",,) || die("cannot connect $!\n"); $sth = $dbh->prepare("select * from users where email = ? ") or &dbdie; $sth->execute($usr) or &dbdie;