Page 1 of 1
Session Variable Life?
Posted: Mon Jul 05, 2010 7:52 pm
by spacebiscuit
Hi,
I am loading my php script's session variables with values before re-directing the user to a 3rd party payment processing page. When payment is complete the user is then directed back to my script where a success message is printed. I then want to access the session variable but they appear to be empty.
I thought that the session remianed live until the browser window is closed, is this not correct?
Thanks in advance,
Rob.
Re: Session Variable Life?
Posted: Mon Jul 05, 2010 8:01 pm
by Jonah Bron
When you redirect the user to the 3rd party payment site, do you send it a return URL? If you do, append...
'?' . urlencode(session_name()) . '=' . urlencode(session_id())
...to the end. That may help.
Re: Session Variable Life?
Posted: Tue Jul 06, 2010 6:10 am
by spacebiscuit
Thanks for the reply.
Yes there is a return success URL which I specifiy, I will try as you suggested and report back my findings!
Rob.
Re: Session Variable Life?
Posted: Tue Jul 06, 2010 6:34 am
by spacebiscuit
The return URL is psecified in an HTML as follows:
<input type="hidden" name ="responderurl" value="
http://www.mydomain.com/index.php">
I'm not so familiar with the code suggested, should I be using:
<input type="hidden" name ="responderurl" value="
http://www.mydomain.com/index.php'?' . urlencode(session_name()) . '=' . urlencode(session_id())">
Thanks,
Rob.
Re: Session Variable Life?
Posted: Tue Jul 06, 2010 8:39 am
by Ragnis
Code: Select all
<input type="hidden" name ="responderurl" value="http://www.mydomain.com/index.php<?php echo '?' . urlencode(session_name()) . '=' . urlencode(session_id()); ?>">
Re: Session Variable Life?
Posted: Tue Jul 06, 2010 1:33 pm
by spacebiscuit
Excuse my ignorance, but what are the session_name and session_id - I do not remember setting either of these.
The session variable name is 'DEL' - but I am guessing that this is not either the session mae or id?
Thanks,
Rob.
Re: Session Variable Life?
Posted: Tue Jul 06, 2010 3:09 pm
by Jonah Bron
You don't usually set them, but you can. The default session name is defined in the php.ini config file. Session ID is a unique alphanumeric string assigned to a computer while viewing your site. The session name and id are usually stored in a cookie on the user's computer. Anything you put into the $_SESSION superglobal variable is stored on the server, and is associated with the user's session id.