G
GMI
I am writing a simple login program to get a ID and Password check agains a
MySQL database , send a cookie.
when these 2 line added :
use CGI;
$Query = new CGI;
The program, it hangs and after a long time system comes with a CGI time
out error?
in DOS mode however the routine works fine.
Can someone out there help?
-----------------------------------
here is part of the code
---------------------
#Login process for NOYQ
require "subparseform.lib";
use CGI;
$Query = new CGI;
my $ErrMsg,$ErrNo=0, $ID ;
my $PassWord,$fName,$lName;
my $Dte_Lst,$Cookie;
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
$mon=$mon+1;
$year=$year+1900;
$Date = "$year-$mon-$mday $hour:$min:$sec" ;
Parse_Form();
NOinitFrm();
$ID='***';$PassWord='******',$Continue='Continue';
#
if ($Continue ne "Continue")
{
# this is the initial run (Not continue & not Cancel)
$LgNo =1;
$ErrMsg='';
#Just print the form and exit
NoClPrnFrm();
exit
};
$ErrMsg='';
if($ID le '' ) {
$ErrNo++;
$ErrMsg="$ErrMsg $ErrNo - Please enter a valid ID";
}
elsif(! DB_Connect())
{$ErrNo++; $ErrMsg="$ErrMsg $ErrNo- Failed to Connect to SQL server."
}
elsif (! CheckPW($ID,$PassWord))
{ $ErrNo++;
$ErrMsg= "$ErrMsg $ErrNo- Password or ID invalid! $ID,$PW $SqlString ";
}
elsif(! NORecDte())
{ $ErrNo++;
$ErrMsg="$ErrMsg $ErrNo- Could not Update Login! "
};
if ($ErrNo = 0) {
SendCookie('NOYQSecure',$ID,'+1d','/' ,'WWW.NOYQ.ca',0) ;
print "<title>'NOYQ User Logged'</title></head>
<body> Welcome back $fName $lName. Last Login was.:$Dte_Lst <BR>
<p><a href='/' target=_top>Home</a></P> '
</body>
</html>
";
exit
};
------------------------------------------------
HERE IS THE DOS COMMAND OUTPUT...........
c:>Perl No-logi1.pl
---------
Content-type: text/html
<P>Use Post or GetSet-Cookie: NOYQSecure=bazil; domain=WWW.NOYQ.ca; path=/;
expires=Tue, 21-Jun-2005 13:56:21 GMT
Date: Mon, 20 Jun 2005 13:56:21 GMT
Content-Type: text/html; charset=ISO-8859-1
<html><head><title>'NOYQ User Logged'</title></head>
<body> Welcome back Bazil Ghassemlou. Last Login was.:2005-6-20 9:52:7
<BR>
<p><a href='/' target=_top>Home</a></P> '
</body>
</html>
MySQL database , send a cookie.
when these 2 line added :
use CGI;
$Query = new CGI;
The program, it hangs and after a long time system comes with a CGI time
out error?
in DOS mode however the routine works fine.
Can someone out there help?
-----------------------------------
here is part of the code
---------------------
#Login process for NOYQ
require "subparseform.lib";
use CGI;
$Query = new CGI;
my $ErrMsg,$ErrNo=0, $ID ;
my $PassWord,$fName,$lName;
my $Dte_Lst,$Cookie;
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
$mon=$mon+1;
$year=$year+1900;
$Date = "$year-$mon-$mday $hour:$min:$sec" ;
Parse_Form();
NOinitFrm();
$ID='***';$PassWord='******',$Continue='Continue';
#
if ($Continue ne "Continue")
{
# this is the initial run (Not continue & not Cancel)
$LgNo =1;
$ErrMsg='';
#Just print the form and exit
NoClPrnFrm();
exit
};
$ErrMsg='';
if($ID le '' ) {
$ErrNo++;
$ErrMsg="$ErrMsg $ErrNo - Please enter a valid ID";
}
elsif(! DB_Connect())
{$ErrNo++; $ErrMsg="$ErrMsg $ErrNo- Failed to Connect to SQL server."
}
elsif (! CheckPW($ID,$PassWord))
{ $ErrNo++;
$ErrMsg= "$ErrMsg $ErrNo- Password or ID invalid! $ID,$PW $SqlString ";
}
elsif(! NORecDte())
{ $ErrNo++;
$ErrMsg="$ErrMsg $ErrNo- Could not Update Login! "
};
if ($ErrNo = 0) {
SendCookie('NOYQSecure',$ID,'+1d','/' ,'WWW.NOYQ.ca',0) ;
print "<title>'NOYQ User Logged'</title></head>
<body> Welcome back $fName $lName. Last Login was.:$Dte_Lst <BR>
<p><a href='/' target=_top>Home</a></P> '
</body>
</html>
";
exit
};
------------------------------------------------
HERE IS THE DOS COMMAND OUTPUT...........
c:>Perl No-logi1.pl
---------
Content-type: text/html
<P>Use Post or GetSet-Cookie: NOYQSecure=bazil; domain=WWW.NOYQ.ca; path=/;
expires=Tue, 21-Jun-2005 13:56:21 GMT
Date: Mon, 20 Jun 2005 13:56:21 GMT
Content-Type: text/html; charset=ISO-8859-1
<html><head><title>'NOYQ User Logged'</title></head>
<body> Welcome back Bazil Ghassemlou. Last Login was.:2005-6-20 9:52:7
<BR>
<p><a href='/' target=_top>Home</a></P> '
</body>
</html>