Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: PERL Cookies playing with JavaScript Cookies

by injunjoel (Priest)
on Aug 04, 2005 at 20:14 UTC ( [id://481008]=note: print w/replies, xml ) Need Help??


in reply to PERL Cookies playing with JavaScript Cookies

Greetings all,
Maybe I don't fully understand the issue but I would think that on each login by a user you could clobber the previous JS cookie by resetting it.
To get around the issue of a previous user wanting to revisit where they were on their last login you would need to store the contents of their cookie in a db || text file associated with their account information.
So the flow would be something like:
  • User logs in.
  • The system authenticates their username and password and selects out their last-visited postion in the tree.
  • The JS cookie is set with the last-visited information by writing the JS code from within Perl to populate the correct value.
  • User browses around updating the JS cookie for their last-visited location.
  • Upon loggin out you would need to write some JS code to post to a Perl script that will store the value of the JS last-visited cookie. This could be accomplished by using a hidden field to pass the last-visited value to your logout script and deal with it there.
Are you absolutely sold on using JS for your cookies? I would think using Perl for all the cookies would be a bit easier to maintain. Or is the entire Tree rendered in DHTML? so there are no subsequent server requests that go out while browsing?

-InjunJoel
"I do not feel obliged to believe that the same God who endowed us with sense, reason and intellect has intended us to forego their use." -Galileo
  • Comment on Re: PERL Cookies playing with JavaScript Cookies

Replies are listed 'Best First'.
Re^2: PERL Cookies playing with JavaScript Cookies
by Anonymous Monk on Apr 28, 2009 at 19:14 UTC
    Hi. I am using Perl/JS/HTML for a multi-user project also requiring login/passwd authentication, and I have a similar problem. I write my cookies in Perl manually, and a small hand-written parser to evaluate them. I know there is no extra code going in there, but cookies written in JS are not over-written by my Perl cookies. In fact, I get TWO cookies, lexically identical keys, with different values. Somehow the browser knows which is which. Same problem on IE and Opera. Not sure about FF.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2024-04-25 23:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found