Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: session problem

by Corion (Patriarch)
on Nov 25, 2014 at 10:39 UTC ( [id://1108337]=note: print w/replies, xml ) Need Help??


in reply to session problem

So, what does $cgi->param('sid') return in myaccount.pl?

Have you tried debugging what your scripts think what is in the session? Most likely some value in your input data is not what you think it should be. As you already have a working example in welcome.pl and an example that does not wwork in myaccount.pl, it should be easy to find out what myaccount.pl does differently from welcome.pl. Maybe the input to myaccount.pl is different from the input to welcome.pl.

You could also consider storing the session information in a cookie instead of passing the session around as an URL parameter. Most of the common "easy" frameworks like Mojolicious and Dancer already do that for you. With them, you also don't need to split up your application into separate programs for each different page.

Also note that in HTTP, a redirect should always be an absolute URL, not a relative URL. So you should better use Location: http://example.com/hello.pl instead of Location: hello.pl.

Replies are listed 'Best First'.
Re^2: session problem
by bigup401 (Pilgrim) on Nov 25, 2014 at 17:44 UTC

    the thing is this, no problem with welcome.pl and home.pl.

    home.pl has set the session, so welcome returns a string a983c8302e7a678a2e53c65e8bd3316 its a generated sid from

    home.pl to welcome.pl and welcome.pl looks like this

    welcome.pl?sid=a983c8302e7a678a2e53c65e8bd3316, so that shows session has been set and generated session sid,

    so i want to retrieve same generated session sid to other pages

      So you've established that hello.pl and welcome.pl work as you think they should.

      Have you done the same for myaccount.pl?

      As myaccount.pl and welcome.pl seem to work differently, there must be some difference in what the scripts receive and/or in what they send back.

      Have you tried copying the content of welcome.pl over myaccount.pl to see whether the difference is still there?

      How do you pass the session id from (say) welcome.pl to myaccount.pl?

        yes home.pl and welcome.pl works they is no difference on scripts bitween home.pl and myaccount.pl i copied content of welcome to myaccount.pl, bt myaccount.pl was not working i think the problem is here print "Location: welcome.pl?sid=$id\n\n"; it may be that am sending the session and generate the session sid to only welcome.pl where by myaccount.pl cant retrieve sid
          A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-04-20 02:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found