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;
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.