1. Need to send the userid and password from the login form to the "emprec " table in 
database and verify id and password. (id is first name and passwd is lastname).
2.After verification of the userid & password, the other fields record should be 
retrieved and displayed as a webpage.
 
can anyone tell me how i can do this? here is my perl code ..which is right now 
retrieving all the contents of the table in database without verifying user id and 
passwd.
 
#!/usr/bin/perl
#install me in public_html/cgi-bin with permissions drwxr-xr-x emprec.pl
use strict;
use warnings;
use DBI;
use DBD::mysql;
use CGI;
use CGI::Carp qw(fatalsToBrowser warningsToBrowser);
my $q=new CGI;
print $q->header;
warningsToBrowser(1);
print $q->start_html(-title=>'Employee Record',-bgcolor=>'#191970'),$q->h3('getting 
data from database');
my($lname,$fname,$age,$post,$ID,$address,$city,$state,$zip,$phno,$monthlysalary);
print $q->start_table(),
$q->Tr([$q->th({-align=>"LEFT",-bgcolor=>"#4682B4"},['lname','fname','age','post','ID','address','city','state','zip','phno','monthlysalary'])]);
my $dbh=DBI->connect("DBI:mysql:database=dbname","userid","passwd") or 
print"$DBI::errstr";
my $sth=$dbh->prepare("select * from emprec;");
$sth->execute();
$sth->bind_columns(\$lname,\$fname,\$age,\$post,\$ID,\$address,\$city,\$state,\$zip,\$phno,\$monthlysalary);
while($sth->fetch){print 
$q->Tr({-valign=>"TOP",-bgcolor=>"#ADD8E6"},[$q->td([$lname,$fname,$age,$post,$ID,$address,$city,$state,$zip,$phno,$monthlysalary])]);}
print $q->end_table(), $q->p("Back to". 
$q->a({-href=>"http://default.asp"},"homepage";)), $q->h4("Have A Good Day!!"), 
$q->end_html();
$dbh->disconnect;

 
 


---------------------------------
Do you Yahoo!?
Free online calendar with sync to Outlook(TM).

Reply via email to