U guessed it correct NICK..wt to do now!!!
hi nick,
i tried the script with
"print "name = $name , password = $password, md5password = $md5password";
and surprisingly it gave the following output in the browser:
name = , password = , md5password = æ‘Ëp/]%d*¨p ïHø
NO entries for name n password!
I have no clue y this is happening.
My edited code is as follows:
#!/usr/bin/perl
use CGI;
use CGI::Carp qw/fatalsToBrowser warningsToBrowser/;
use DBI;
use Digest::MD5 qw(md5 md5_hex md5_base64);
my $query = new CGI;
print $query->header();
warningsToBrowser(1);
#print $query->start_html(-title=>'LOGIN PAGE');
$db="db";
$host="host";
$user="user";
$password=passwd;
if(($query->request_method() eq "POST") && ($query->param("user") ne '') && ($query->param("password") ne ''))
{
$chkuser=$query->param("user");
$chkpassword=$query->param("password");
$md5password = md5($chkpassword);
$dbh = DBI->connect("DBI:mysql:database=$db:host=$host", $user, $password) or die "Can't connect to database:$DBI::errstr\n";
$qry = $dbh->prepare("SELECT emp_name, password FROM new_user where emp_name=$chkuser");
$qry->execute;
@row=$qry->fetchrow_array;
$name=$row[0];
$password=$row[1];
print "name = $name , password = $password, md5password = $md5password";
#if (($chkuser eq $name) && ($md5password eq $password))
#{
# print "<p> Thank You!<p>";
# $dbh->disconnect;
# print $query->end_html();
#}
#else
#{
# print "<HEAD> Username or Password Incorrect!</HEAD>";
# print "<a href='login_main.pl'>Please Try Again</a>";
# $dbh->disconnect;
#print $query->end_html();
#}
}
else
{
#print "Content-type: text/html\n\n";
#print <<EOF;
print "<HTML>";
print "<BODY>";
print "<FORM METHOD='POST' ACTION='login_test.pl'>";
print "<p>Username:</p>";
print "<input type='text' name='user'><br>";
print "<p>Password:</p>";
print "<input type='password' name='password'><br>";
print "<input type='submit' value='submit'><br>";
print "</FORM>";
print "</BODY>";
print "</HTML>";
#EOF
#print $query->end_html();
}
and emp_name is not a unique key i suppose coz emp_id is the primary key (i dont need to use it).
Please suggest wt to do next
Waiting for ur reply
Thanx
Subject
Written By
Posted
U guessed it correct NICK..wt to do now!!!
May 01, 2005 11:13PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.