its work now
!/usr/bin/perl
use CGI;
use DBI;
$q=new CGI;
$id=$q->param('emp_id');
$passw=$q->param('password');
print "Content-type: text/html\n\n";
if($id eq ''&& $passw eq '')
{
print <<HTML1;
<html>
<body>
<form method='post' action='code_login.pl'>
<pre>
<h4><bold>u have to enter login id and password:<h4></bold>
<input type='submit' size=200 value='back'>
</pre>
</form>
</body>
</html>
HTML1
}
else
{
$dbh = DBI->connect("dbi:mysql:test:192.168.0.95","bobby","bobby");
$sqlstatement="SELECT emp_id, emp_name FROM Employee WHERE emp_id='$id' AND password='$passw'";
$sth = $dbh->prepare($sqlstatement);
$sth->execute ||
die " this is a wrong sql statement";
#print "Content-type: text/html\n\n";
if(@row=$sth->fetchrow_array)
{
print <<HTM;
<HTML>
<HEAD>
<TITLE>information</TITLE>
</HEAD>
<BODY>
<h3>logged in successfully @row[1]</h3>
<FORM METHOD='post' ACTION='code_update.pl'>
<INPUT TYPE= 'HIDDEN' NAME ='abc' VALUE='$id'>
<input type='submit' NAME='PRO' value='view profile'>
<input type='submit' NAME='PRO' value='update profile'>
</FORM>
</BODY>
</HTML>
HTM
}
else
{
print <<HFG;
<HTML>
<HEAD>
<TITLE>information</TITLE>
</HEAD>
<BODY>
<h3>invalid username password</h3>
<FORM METHOD='post' ACTION='dataconn.pl'>
<pre>
Enter your id :<input type='text' name='emp_id'><br>
Enter your password :<input type='password' name='password'><br>
<input type='submit' value='log in'>
</FORM>
</BODY>
</HTML>
HFG
}
}
Subject
Written By
Posted
its work now
May 12, 2005 04:48AM
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.