Good Day, I have a question with regards to the message I received in the web browser. I have read that this 302 message is normal.
Status: 302 Found Location: http//192.168.1.5/train/main.htm
How can I get the page main.htm to load properly without receiving the message? I am a new programmer to Perl but enjoy reading about the workings of the language and truly enjoy learning Perl. I have to admit I am stumped.
What I have is a form, when submitted to a perl script, grabs the form values, connects to a sqlite3 db, checks for existing values,returns an html page. I realize the code needs work, but why won't the html page get processed? Instead I receive the Status: 302 message. I appreciate on the gentle help that could be available. Thank you!
#!/usr/bin/perl -wT
use CGI qw(:standard);
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
use strict;
use DBI;
print header;
print start_html("Login");
print h4("Login Engineer Form");
our ($p,$l,$a,$z,$id,$user,$password,$role,$query);
$query = new CGI;
foreach my $p (param()) {
$l = param('fname');
$a = param('userpassword');
$z = param('selectrole');
}
my $dbh = DBI->connect(
"dbi:SQLite:dbname=master_train.db",
{ RaiseError => 1 }
) or die $DBI::errstr;
my $sth = $dbh->prepare( "SELECT * FROM users" );
$sth->execute();
while(($id, $user, $password, $role)=$sth->fetchrow_array){
our ($l,$a,$z);
if(($l eq $user)&&($a eq $password)&&($z eq $role)){
if($role eq $z){
print redirect("http//192.168.1.5/train/main.htm")
+;
}
else
{
print redirect("http://192.168.1.5/train/login
+.htm");
}
}
}
$dbh->disconnect();
print end_html;