wenevr after the password validation, if its
correct then instead of redirecting to another
page its showing ths msg...
Status: 302 Found Location: http://localhost/cgi-
bin/Main.cgi
please gv me the solution for this...
correct then instead of redirecting to another
page its showing ths msg...
Status: 302 Found Location: http://localhost/cgi-
bin/Main.cgi
please gv me the solution for this...
Code:
#!C:\perl\bin\perl.exe
use strict;
use CGI qw(:standard);
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
use DBI;
my $q = new CGI;
print "Content-Type: text/html\n\n";
my $dbh = DBI->connect
("dbi:SQLite:DEVICE.db", "", "", {RaiseError => 1,
AutoCommit => 1}) or &dienice("Can't connect to
database:$DBI::errstr");
if ($q->param("Login")){
my $Password=param('Password');
if (!$Password){
print "Please Enter the Password";
}
else{
my $dbh = DBI->connect
("dbi:SQLite:DEVICE.db", "", "",{RaiseError => 1,
AutoCommit => 1});
my $sth = $dbh->prepare("select * from Settings
where Password = ?");
$sth->execute($Password);
if (my $pass = $sth->fetchrow_hashref)
{
print redirect(-url=>'http://localhost/cgi-
bin/Main.cgi');
}
else{
print "Invalid Password";
}
$dbh->disconnect;
}
}
print <<END1;
<HTML>
<HEAD>
<TITLE> </TITLE>
</HEAD>
<body>
<form NAME="login" METHOD="POST">
<input type="hidden" name="submit"
value="Submit">
<TABLE align="center" bgcolor=#B0C4DE>
<TR>
<TD> Enter The Password And Click Login</TD>
</TR> <TR></TR> <TR></TR> <TR></TR> <TR></TR>
<TR></TR>
<TR>
<TD><b>PASSWORD</b> :<input type="password"
name="Password" size="20" maxlength="15" /></TD>
</TR> <TR></TR> <TR></TR> <TR></TR> <TR></TR>
<TR></TR>
<TR>
<TR>
<TD align="center" colspan="2">
<input type="submit" name="Login" value="Login">
<input type="reset" name="submit" value="Cancel">
</TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>
END1
Comment