here is full scrip with html source
#!"C:\xampp\perl\bin\perl.exe" use DBI; use CGI; $cgi = CGI->new(); $db ="datab"; $usr ="root"; $pwd =""; $host ="localhost"; $dbh = DBI->connect("DBI:mysql:$db:$host", $usr, $pwd { AutoCommit => 0, RaiseError => 1, } ) or die $DBI::errstr; my $username = $cgi->param('username'); my $password = $cgi->param('password'); my $sth = $dbh->prepare("select id from mysql_auth where username = ? +AND password=?"); $sth->execute($username, $password); if ($x = $sth->fetchrow()) { $sth->finish(); $cookie = $cgi->cookie(-name=>'id', -value=>$username); print $cgi->redirect(-location=>"welcome.pl", -cookie=>$cookie); } else { print $cgi->redirect("wrong_username or password.pl"); } print "Content-type: text/html\n\n"; print <<START_HTML; <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:/ +/www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <p>username <input type="text" name="username" /> </p> <p>password <input type="password" name="password" /> </p> <p> <input type="submit" name="button" value="Submit" /> </p> </body> </html> START_HTML
In reply to Re^11: cookie problem
by bigup401
in thread cookie problem
by bigup401
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |