Hi! I'm trying to do a sort of online treasure hunt for a game and my server doesn't like my script. It keeps having Internal Server Errors, and since it's been over a year since I did any scripting and my eyes are tired of looking at would someone mind checking it for me? This is just a test page.
Also, here's what my server tells me: Name "main::email" used only once: possible typo at zach.cgi line 5. Name "main::in" used only once: possible typo at zach.cgi line 13. Name "main::mailprog" used only once: possible typo at zach.cgi line 4. Undefined value assigned to typeglob at cgi-lib.pl line 58. Undefined value assigned to typeglob at cgi-lib.pl line 58. Undefined value assigned to typeglob at cgi-lib.pl line 58. Use of uninitialized value in string eq at zach.cgi line 13.
[edited by: phranque at 5:45 am (utc) on July 25, 2008] [edit reason] examplified domain [/edit]
#!/usr/bin/perl require "cgi-lib.pl"; &ReadParse; $mailprog='/usr/lib/sendmail'; $firstname.lastname@example.org'; print "Content-type: text/html\n\n"; #the rest of your code follows
That style of coding is more then 10 years old. Hopefully you have cgi-lib.pl on the server. If not you will need to upload that code into the cgi-bin, or into the same folder where the perl script is.
the first major issue you have is that a cgi script returns an HTTP document, not simply an html document. this means you must first specify a document type header. first thing in your script add the following: print "Content-type: text/html\n\n"; the double newlines are important!
now you can return the HTML document. the "else" clause in your script will output duplicate <html>, <head>, <title> and <body> tags which can also cause some problems once you get that far.
there are some errors in line 58 in the cgi-lib.pl file you are "requiring". this probably is preventing the "in" hash from being defined which is what gives the line 13 message in your cgi script. the other messages regarding your script are the defined but unused scalar variables containing string values.