
wickedxter
User
Jul 19, 2001, 3:18 PM
Post #2 of 3
(619 views)
|
|
Re: "Premature end of script headers"
[In reply to]
|
Can't Post
|
|
ok i've fixed your probelm on thing is that the login sub didnt have an end bracket } and the ; after EOF was missing.. CODE: #!/usr/local/bin/perl print "Content-type: text/html\n\n"; # Set the password $passw = "2p28pf"; # Parse the form &pform; # Show the login &login; # The login sub sub login { print <<EOF; <html> <head> <title>Password Screen</title> <body bgcolor="#000088"> </head> <form action="./edb.cgi" method="GET"> <input type="hidden" name="action" value="login"> <table cellpadding="0" cellspacing="0"> <tr> <td> <table cellpadding="1" cellspacing="0"> <tr> <td bgcolor="#0000ff"> <table cellpadding="3" cellspacing="0" bgcolor="#000055"> <tr> <td><font color="#ffffff" size="2" face="verdana">Password</td> </tr> </table> </td> </tr> </table> </td> </tr> </table> <table cellpadding="0" cellspacing="0"> <tr> <td> <table cellpadding="1" cellspacing="0"> <tr> <td bgcolor="#0000ff"> <table cellpadding="3" cellspacing="0" bgcolor="#000055"> <tr> <td><input type="password" name="pass"><input type="submit" value="Submit"></td> </tr> </table> </td> </tr> </table> </td> </tr> </table> </form> </body> </html> EOF ; } # Check if login is correct if ($input{'action'} eq 'login') { if ($input{'pass'} eq $passw) { print "You're in.\n" } else { print "Sorry, wrong password.\n" } } # Sub for printing out the page sub edit_page { print <<EOF; <html> <head><title>Gallery Edit</title> </head> <body bgcolor='#000088'> <table cellpadding='0' cellspacing='0'> <tr> <td> <table cellpadding='1' cellspacing='0'> <tr> <td bgcolor='#0000ff'> <table cellpadding='3' cellspacing='0' bgcolor='#000055'"> <tr> <td><font color='#ffffff' size='2' face='verdana'> <h1><i>Gallery edit</i></h1> <form action='db.cgi' method='GET' ENCTYPE='multipart/form-data'> <input type='hidden' name='fname' value='$input{'fname'}'> <input type='hidden' name='desc' value='$input{'desc'}'> File: <input type='file' name='fname'> Desc: <input type='text' name='desc' size='20'> <input type='Submit' value='Finish'> </form> </font> </font> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table> </body> </html> EOF ; } # The sub to parse the form sub pform { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); if (length($buffer) < 5) { $buffer = $ENV{QUERY_STRING}; } @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $input{$name} = $value; } }
|