The Error in log file.
(2)No such file or directory: exec of '/var/www/cgi-bin/xone/query/store_login.pl' failed
Premature end of script headers: store_login.pl
The Script
Expand|Select|Wrap|Line Numbers
- #!/usr/bin/perl
- use CGI;
- use DBI;
- use CGI::Carp qw(fatalsToBrowser);
- use CGI::Cookie;
- my $cgi=new CGI;
- my $cStore_Id=$cgi->param('storeid');
- my $cUser_Name=$cgi->param('username');
- my $cPassword=$cgi->param('password');
- my $cSite=$ENV{'HTTP_HOST'};
- my $cPrev=$ENV{'HTTP_REFERER'};
- if($cPrev=~/$cSite/)
- {
- }
- #else
- #{
- #print "Content-type:text/html\n\n";
- #print "You Cannot View this Page";
- #exit;
- #}
- my $dbh=DBI->connect('dbi:mysql:xone:localhost','root','') or die "cannot connect to the database $DBI::errstr";
- if(($cStore_Id eq "")&&($cUser_Name eq "")&&($cPassword eq ""))
- {
- &_showForm();
- exit;
- }
- my $cStr="select xstore_managerinfo.username,xstore_managerinfo.password from xstoreinfo,xstore_managerinfo where xstoreinfo.storeid=\'$cStore_Id\' and xstore_managerinfo.password=\'$cPassword\' and xstore_managerinfo.username=\'$cUser_Name\' and xstore_managerinfo.storeid=xstoreinfo.storeid";
- my $cSth=$dbh->prepare($cStr);
- $cSth->execute();
- @aTemp=$cSth->fetchrow_array;
- if($aTemp[0] eq "")
- {
- &_showErrorPage();
- exit;
- }
- my $server = $ENV{'HTTP_HOST'} ;
- my $path = "/" ;
- print "Set-Cookie: manager\=$cUser_Name; path\=$path;\n";
- print 'Status: 302 Moved', "\r\n",'Location:/cgi-bin/xone/query/billgenerate.pl', "\r\n\r\n";
- sub _showForm
- {
- #my $cStr="select storeid from xstoreinfo where storeid=\'1123\'";
- #
- #my $cSth=$dbh->prepare($cStr);
- #
- #$cSth->execute();
- #
- #@aTemp=$cSth->fetchrow_array;
- my $cFile="../templates/store_login.html";
- my $cTemplate=_ReadFile($cFile);
- #$cTemplate=~ s/__STOREID__/$aTemp[0]/ig;
- my $cMain_File="../templates/store_template.html";
- my $cMain_Template=_ReadFile($cMain_File);
- $cMain_Template=~ s/__STORE_BILL__/$cTemplate/;
- print "Content-type:text/html\n\n";
- print $cMain_Template;
- return;
- }
- sub _ReadFile
- {
- my $cFile=shift;
- open(IN,"$cFile");
- my $cTemp=$/;
- undef $/;
- my $cOut=<IN>;
- $/=$cTemp;
- undef $cTemp;
- close(IN);
- return $cOut;
- }
- sub _showErrorPage
- {
- my $cFile="../templates/error_page.html";
- my $cTemplate=_ReadFile($cFile);
- my $cMain_File="../templates/store_template.html";
- my $cMain_Template=_ReadFile($cMain_File);
- $cMain_Template=~ s/__STORE_BILL__/$cTemplate/;
- print "Content-type:text/html\n\n";
- print $cMain_Template;
- return;
- }
Thanks
RajivGandhi