in reply to (jeffa) Re: CGI Auto Login
in thread CGI Auto Login

Well, basically, if I remove the 'print "' and the '";' at the end of each line and put it in an HTML file, the page will load and then it will automatically get redirected to my webmail. This is what I want, however I am getting an Internal Server Error when I try to run this. I am not too worried about error checking at this point, however I will eventually want to put some in. I would just like to get it running first. Any pointers on what might be wrong right now? I do not readily have access to the error logs, cause my hosting provider is cheap.

#!/usr/bin/perl ##################################################################### # Function : # # Load Webmail using the password provided # # Use it : # # webmail?username=myusername&password=mypassword&domain=mydomain # ###################################################################### my $username = param('username'); my $password = param('password'); my $domain = param('domain'); my $correct_usage = "Correct Usage: webmail.cgi\?username=YourUser +name\&password=YourPassword\&domain=YourDomain"; if ($username eq ""){ print "No username given.\n $correct_usage" } elsif ($password eq ""){ print "No password given.\n $correct_usage" } elsif ($domain eq ""){ print "No domain given\n $correct_usage" } else{ print "<HTML> <HEAD> <TITLE>Logging In...</TITLE> </HEAD> <BODY> <CE_NTER><B_>Logging into your webmail...please wa +it...</B_></CEN_TER> <FORM name=f action=https://webmail.secureserver.net/s +rc/redirect.php method=post> <INPUT type=hidden name=login_username value=$user +name> <INPUT type=hidden name=domain value=$domain> <INPUT type=hidden name=secretkey value=$password> <INPUT type=hidden name=js_autodetect_results valu +e=0 > <INPUT type=hidden name=just_logged_in value=1> <INPUT type=hidden name=activate_timeout value=yes +> </FORM>"; <SCRIPT language=JavaScript>document.f.submit();</SCRIPT> </BODY></HTML>"; }

Replies are listed 'Best First'.
(jeffa) 3Re: CGI Auto Login
by jeffa (Bishop) on May 06, 2003 at 19:46 UTC
    Ahh, you are forgetting to print a content header. All CGI scripts must send a header so the web server will know how to deliver the content:
    print "Content-Type: text/html;\n\n";
    or better yet ... use CGI.pm!!!!!
    use CGI qw(:standard); print header;

    jeffa

    L-LL-L--L-LL-L--L-LL-L--
    -R--R-RR-R--R-RR-R--R-RR
    B--B--B--B--B--B--B--B--
    H---H---H---H---H---H---
    (the triplet paradiddle with high-hat)
    
      WOW, that was it. I have it working now. I think I will attempt to put some error checking in, but my main concern was just getting it running. Thanks so much jeffa!