hi, i am trying to use cgi::session, but no luck yet. index.html has form which gets user credentials, matches them with mysql databases values, and if right, then sets a session otherwise shows login.html
# create a new session my $session = CGI::Session->new() or die CGI::Session->errstr; print $session->header(); #setting session to expire in 1 hour $session->expire("+1h"); #further in page # logout option print "<a href='logout.cgi'>logout </a></br>"; # check option print "<a href='check.cgi'>check page</a>"
this page gives output properly, it gnerates session id, but when i click on check page link, it doesn't show me session info and i always get "no session" message.
# cgi page my $cgi = CGI->new; #print $cgi->header(); print $cgi->start_html(); print $cgi->p("hello"); print $cgi->cookie('CGISESSID'); # load session info my $session = CGI::Session->load() or die CGI::Session->errstr; print $session->header(); if ($session->is_empty) { print $cgi->p("no session"); } else { print $cgi->p("<b>session data loaded</b>"); print $session->name; print $session->id; print $session->is_expired; } print $cgi->end_html();
and this is code in logout.cgi
# Delete the session for good: my $session = CGI::Session->load() or die CGI::Session->errstr; $session->delete(); $session->flush(); print $session->header(-location=>'http://localhost');
what am i doing wrong?

In reply to ie with cgi::session not showing same session id which it was set and firefox doesn't show at all by msinfo

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.