Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^6: Problems getting session management to work: is_expired seems to lie to me (cookies)

by ted.byers (Scribe)
on May 07, 2013 at 00:13 UTC ( #1032420=note: print w/ replies, xml ) Need Help??


in reply to Re^5: Problems getting session management to work: is_expired seems to lie to me (cookies)
in thread Problems getting session management to work: is_expired seems to lie to me

Actually, I just tried that, and it told me that the session has not expired but the session is empty. $cnt has a value only on second and subsequent access to the page. if it is not defined, then I know I haven't accessed the page yet, and so there is no session until I create it in the second part of conditional block. All other accesses ought to have a session object, either a valid one or one that has expired. If the cookie is expired in the browser, then how can the server get the session ID and use that to determine whether or not the session has expired? If the cookie is expired, and thus not sent by the browser, the server can not use ID to determine whether or not the session has expired, let alone attempt to access its data, and this would imply that instead of using is_expired, one must check for the existance of the CGISESSID cookie; and this is what I would have done had the documentation indicated that the only way to determine whether or not the session has expired is to check that cookie. And, in fact, if there is no session cookie, why does function load not return NULL, since it would have no way to know what session data to try to load? I have not looked at checking the cookies, but will, but if your explanation is correct, then the documentation would seem to be misleading.

Thanks

Ted


Comment on Re^6: Problems getting session management to work: is_expired seems to lie to me (cookies)
Re^7: Problems getting session management to work: is_expired seems to lie to me (cookies)
by Anonymous Monk on May 07, 2013 at 00:50 UTC

    WOW, that is like logic puzzles -- are you running on caffeine?

    Add something like  print $query->escapeHTML( scalar Dumper( $query, $session ) ) after each start_html

    start fresh browser session,

    1. visit one page,
    2. in another tab visit same page,
    3. then click the count link in another tab,
    4. click it again in another tab,
    5. wait 10 seconds (which you use for expire for testing), then click open count in another tab again
    6. then copy/paste ;CGISESSID=... and append to a url and open in another tab

    compare each dumper to one another and you'll see
    no cookie on 1st tab,
    cookie on 2nd tab, same cookie on 3rd and 4th tab,
    no cookie on 5th tab
    no cookie on 6th tab

    Many trip over cgi/cookies/sessions :) Basic cookie management (May 01) , Cookie login (pseudocode), PRG...

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1032420]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (10)
As of 2014-08-22 09:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (153 votes), past polls