I copied the code at the wrong time. I have commented that in and out. Also where I set $sid to 0 was for testing also.
I did set the $sid = '12ba7ce0cfeeae8e8a934af6724910e9';
which I copied from the cookie I am interested in and it proceeded to assume I was logged. The calling code just check ne 0 so anything ne 0 would have the same effect
sub ProcessLoginRequest
{
my ($query) = @_;
my $status = 0;
# $sessionname = 'CGISESSID';
# my %cookies = CGI::Cookie->fetch;
# my $sid = $cookies{$sessionname}->value;
my $sid = GetUserSessionCookie();
warn("ProcessLoginRequest Query: '$query'");
warn("ProcessLoginRequest SID from cookie: '$sid'");
#Check if it got valid return from fetch cookie
if ($sid ne 0){
$status = 1;
But later I compare against the stored session ID.
#---------------------------------------------------------------------
+----------
# FUNCTION: OpenSession($dbh, $sid)
# Opens existing session or creates new depending on $sid
#---------------------------------------------------------------------
+----------
sub OpenSession{
my ($dbh, $sid)= @_;
$session = new CGI::Session("driver:MySQL", $sid, {Handle=>$dbh, Lo
+ckHandle=>$dbh});
return $session;
}
Thanks
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.