Got another one for ye great and mighty monks..
I'm working through my first implementation of cookies, and hitting a major snag, even though most of my code is straight out of the
CGI Programming with Perl book. On my login page, the user puts in their username and password, and it sends to the primary CGI script. That authenticates the user, and if successful, tried to set a cookie, then verify that it's been set (using, as I said, code straight out of the book).
This step:
print $q->redirect ( -url => "https://secure.domain.net/cgi-bin/coo
+kie_test.cgi",
-cookie => $cookieC
);
works, as does the rest of the program. In the browser, I see the cookie set attempt (using Mozilla, I purposefully deny the cookie without setting it to remember, so I can debug), but when it's given the redirect, it tries to download the cookie_test.cgi program instead of running it.
The cookie_test.cgi program:
!#/usr/bin/perl -wT
# !/usr/bin/perl -wT # Originally posted typo-ed first line
# Cookie Test Program for Control Panel Administration
use strict;
use CGI;
$ENV{PATH} = "/bin:/usr/bin";
delete @ENV{ 'IFS', 'CDPATH', 'ENV', 'BASH_ENV' };
my $q = new CGI;
my $sessionid = $q->cookie( -name => "C" );
if ( defined $sessionid ) {
print "Location: https://secure.domain.net/cgi-bin/ctladm.cgi\n\n";
}
else {
print <<AAA;
Content-type: text/html
### Html error message cut out ###
AAA
;
}
exit;
Anyone know what's going on here?
Thanking you for your help (and your patience),
Spacewarp
DISCLAIMER:<BR>
Use of this advanced computing technology does not imply an endorsemen
+t<BR>
of Western industrial civilization.<BR>
Updated #! line per author's req. - dvergin 2003-06-08
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.