Re: url rewriting within sessions - confused newbie needs help
| From: | Peter Walter | Date: | Thu, 11 Dec 2003 19:57:42 +0000 |
| Subject: | Re: url rewriting within sessions - confused newbie needs help | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-172516@lists.php.net to get a copy of this message | ||
Mike,
I hope you mean session_start().
Yes, I did. Getting a bit dyslexic nowadays.
Well, you would, because PHP would use the value from the PHPSESSID= URL parameter.
... except that on the second call, the url (as displayed by the browser) does not contain the PHPSESSID parameter, yet I am still able to retrieve the session variables correctly ...
My immediate reaction to this is that session.use_cookies must be set to 0 (or Off) in your php.ini (or equivalent). Have you checked this? If it looks correct, what does a phpinfo() page show?
php.ini contains the following settings:
[Session]
session.save_handler = files session.save_path = /tmp session.use_cookies = 1 session.name = PHPSESSID session.auto_start = 0session.cookie_lifetime = 0
session.cookie_path = / session.cookie_domain =session.serialize_handler = php
session.gc_probability = 1 session.gc_maxlifetime = 1440 session.referer_check = session.entropy_length = 0 session.entropy_file = session.cache_limiter = nocache session.cache_expire = 180 session.use_trans_sid = 1 url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"In phpinfo(), the "local value" matches the "master value" for all entries, and match the entries in php.ini. I appreciate that this issue isn't a big deal - but I had hoped to understand php well enough to tell the difference between a "bug" and a "feature". If it would help, I could send you the url for the page? (password protected) Peter Ford, Mike [LSS] wrote:
On 11 December 2003 18:01, Peter Walter wrote:Mike, Thanks for the additional explanation, and I understand the sequence of events as you described. However, please bear with me a bit - the results I am getting do not quite match your explanation. Let me clarify what I am doing: I have a page (index.php) which starts out by calling start_session(),I hope you mean session_start().then emits some html code containing some form variables for search criteria. After the form variables, I have a "submit" button that refers to index.php. Following that, I have php logic that extracts the search criteria (if set) from $HTTP_POST_VARS, performs a MySQL query, then creates a table of results (if any); one of the table entries contains a <a href= link to determine which row the user selected. The first time I load the page, I assume the session is created by start_session(), and the cookie is sent to the browser. When I click on the "submit" button, the page is reloaded - I assume with the session active - as per your explanation. According tho the documentation I have read, the second time the page is loaded, start_session() will simply reuse the existing session parameters. At this point, the browser should already have the cookie - if it did not, I would not be able to retrieve the session variablesWell, you would, because PHP would use the value from the PHPSESSID= URL parameter.- but the url links in the table are still rewritten. I do not understand why.My immediate reaction to this is that session.use_cookies must be set to 0 (or Off) in your php.ini (or equivalent). Have you checked this? If it looks correct, what does a phpinfo() page show? Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: m.ford@leedsmet.ac.ukTel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211