Premature end of script

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rajiv07
    New Member
    • Jun 2007
    • 141

    #1

    Premature end of script

    Hi to all this is the code i am using to do some task but it gives the following error.i am breaking my head why the error is coming please help me on this.

    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

    [CODE=perl]#!/usr/bin/perl
    use CGI;
    use DBI;
    use CGI::Carp qw(fatalsToBrow ser);
    use CGI::Cookie;

    my $cgi=new CGI;

    my $cStore_Id=$cgi->param('storeid ');

    my $cUser_Name=$cg i->param('usernam e');

    my $cPassword=$cgi->param('passwor d');

    my $cSite=$ENV{'HT TP_HOST'};

    my $cPrev=$ENV{'HT TP_REFERER'};

    if($cPrev=~/$cSite/)
    {
    }
    #else
    #{
    #print "Content-type:text/html\n\n";
    #print "You Cannot View this Page";
    #exit;
    #}

    my $dbh=DBI->connect('dbi:m ysql:xone:local host','root','' ) or die "cannot connect to the database $DBI::errstr";

    if(($cStore_Id eq "")&&($cUser_Na me eq "")&&($cPasswor d eq ""))
    {
    &_showForm() ;
    exit;
    }

    my $cStr="select xstore_manageri nfo.username,xs tore_managerinf o.password from xstoreinfo,xsto re_managerinfo where xstoreinfo.stor eid=\'$cStore_I d\' and xstore_manageri nfo.password=\' $cPassword\' and xstore_manageri nfo.username=\' $cUser_Name\' and xstore_manageri nfo.storeid=xst oreinfo.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",'Locatio n:/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.htm l";

    my $cTemplate=_Rea dFile($cFile);

    #$cTemplate=~ s/__STOREID__/$aTemp[0]/ig;

    my $cMain_File="../templates/store_template. html";

    my $cMain_Template =_ReadFile($cMa in_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=_Rea dFile($cFile);

    my $cMain_File="../templates/store_template. html";

    my $cMain_Template =_ReadFile($cMa in_File);

    $cMain_Template =~ s/__STORE_BILL__/$cTemplate/;
    print "Content-type:text/html\n\n";
    print $cMain_Template ;
    return;
    }[/CODE]

    Actually this script is running successfully on some other server.But i try to run in my new server it gives that error.
    Thanks
    RajivGandhi
Working...