I have this script that I can't seem to get working. Could anyone help me out. What I want to do is type http://www.mydomain.com/webmail.cgi?username=myusername&password=mypassword&domain=mydomain

and have it log into my webmail automatically. I know this will work because I currently use JavaScript to do this, however I realize the risk of having my password available to anyone who views the code of my login page. Could any help me out on how I could accomplish what I have below?

Thanks so much,
Chris

#!/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'); if ($username eq ""){ print "No username given.\n"; print "Correct Usage: webmail.cgi\?username=YourUsername\&pass +word=YourPassword\&domain=YourDomain"; } elsif ($password eq ""){ print "No password given.\n"; print "Correct Usage: webmail.cgi\?username=YourUsername\&pass +word=YourPassword\&domain=YourDomain"; } elsif ($domain eq ""){ print "No domain given\n" print "Correct Usage: webmail.cgi\?username=YourUsername\&pass +word=YourPassword\&domain=YourDomain"; } else print "<HTML><HEAD><TITLE>Logging In...</TITLE></HEAD><BODY>"; print "<CEN_TER><B_>Logging into your webmail...please wait... +</_B></CEN_TER>"; print "<FORM name=f action=https://webmail.com/redirect.php me +thod=post>"; print " <INPUT type=hidden name=login_username value=$u +sername>"; print " <INPUT type=hidden name=domain value=$domain>"; print " <INPUT type=hidden name=secretkey value=$passwo +rd>"; print " <INPUT type=hidden name=js_autodetect_results v +alue=0 >"; print " <INPUT type=hidden name=just_logged_in value=1> +"; print " <INPUT type=hidden name=activate_timeout value= +yes>"; print "</FORM>"; print "<SCRIPT language=JavaScript>"; print " document.f.submit();"; print "</SCRIPT>"; print "</BODY></HTML>"; }

Edit by tye, drop BR, add CODE, READMORE etc.


In reply to CGI Auto Login by cdubbs94

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.