943,865 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 1661
  • PHP RSS
Sep 26th, 2008
0

passing sessions between pages

Expand Post »
Hi

I am having problems with sessions.

When using Internet Explorer I can pass sessions to other pages.
I cannot pass sessions when I use Mozilla Firefox.



[php]
PHP Syntax (Toggle Plain Text)
  1. //at the top of the page
  2. session_start();
  3.  
  4. //value passed
  5. $last_login = $_SESSION['s_last_login'];//last user login history
  6. [/php]


[PHP]
PHP Syntax (Toggle Plain Text)
  1. //This is my PHP.ini file session configuration below.
  2.  
  3. [Session]
  4. ; Handler used to store/retrieve data.
  5. session.save_handler = files
  6. ;session.save_path = "N;/path"
  7. ;session.save_path = "N;MODE;/path"
  8. ;session.save_path = "/tmp"
  9. session.use_cookies = 1
  10. session.name = PHPSESSID
  11. ;Initialize session on request startup.
  12. session.auto_start = 0
  13. session.cookie_lifetime = 0
  14. session.cookie_path = /
  15. session.cookie_domain =
  16. session.serialize_handler = php
  17. session.gc_probability = 1
  18. session.gc_divisor = 100
  19. session.gc_maxlifetime = 1440
  20. session.bug_compat_42 = 1
  21. session.bug_compat_warn = 1
  22. session.referer_check =
  23. session.entropy_length = 0
  24. session.entropy_file =
  25. ;session.entropy_length = 16
  26. ;session.entropy_file = /dev/urandom
  27. session.cache_limiter = nocache
  28. session.cache_expire = 180
  29. session.use_trans_sid = 0
  30. session.hash_function = 0
  31. session.hash_bits_per_character = 4
  32. [/php]
Similar Threads
Reputation Points: 24
Solved Threads: 0
Junior Poster in Training
assgar is offline Offline
89 posts
since Oct 2006
Sep 26th, 2008
0

Re: passing sessions between pages

Have you checked if cookies are enabled in Firefox because to use sessions you need the session ID which is usually stored in a cookie. If you haven't got cookies enabled in Firefox then try enabling them and see if that makes the sessions work.
-------
Also if it does turn out to be cookies and you want to keep cookies disabled then you could a, put the session id in the url bar (not very secure) or b, use what I have made and call server side cookies. That is when you store the session values and names of the values in a database (eg. mysql). Also each value goes on its own line with the users IP address in the same row as the session value and name of value. Then when the user visits a page, the server then checks for all rows matching the users IP address. So in your case, the server side cookie would probably be the Session ID. Nice little trick if you don't like cookies.

So let us know if it is just cookies that are disallowing the session as that is all that I can think of.
Sponsor
Featured Poster
Reputation Points: 410
Solved Threads: 258
Occupation: Genius
cwarn23 is offline Offline
3,004 posts
since Sep 2007
Sep 27th, 2008
0

Re: passing sessions between pages

Thanks for the solutions.

Enabling cookie was the temporary solution.
I will store the session info in a database.

How do I accomplish the example below if I disable cookies?

example:
I have a 20 pages I need to pass the same user preferences\permissions\data across. I have been using sessions in IE and it works. I want to move to Firefox.
Note: The total of 15 to 20 preferences\permissions\data are stored in mysql DB and security is important.

I would prefer not to have to select the preferences\permissions\data from the database for each page.
Reputation Points: 24
Solved Threads: 0
Junior Poster in Training
assgar is offline Offline
89 posts
since Oct 2006
Sep 27th, 2008
0

Re: passing sessions between pages

Click to Expand / Collapse  Quote originally posted by cwarn23 ...
Have you checked if cookies are enabled in Firefox because to use sessions you need the session ID which is usually stored in a cookie. If you haven't got cookies enabled in Firefox then try enabling them and see if that makes the sessions work.
-------
Also if it does turn out to be cookies and you want to keep cookies disabled then you could a, put the session id in the url bar (not very secure) or b, use what I have made and call server side cookies. That is when you store the session values and names of the values in a database (eg. mysql). Also each value goes on its own line with the users IP address in the same row as the session value and name of value. Then when the user visits a page, the server then checks for all rows matching the users IP address. So in your case, the server side cookie would probably be the Session ID. Nice little trick if you don't like cookies.

So let us know if it is just cookies that are disallowing the session as that is all that I can think of.
What if I am using a shared IP, like most in the internet? Or what if I want to send fake http headers to mimic a fake ip? I think it is a lot harder to fake a cookie than a header call.
Last edited by R0bb0b; Sep 27th, 2008 at 4:32 pm.
Reputation Points: 358
Solved Threads: 89
Posting Shark
R0bb0b is offline Offline
986 posts
since Jun 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Getting rid of previous GET data in POST form
Next Thread in PHP Forum Timeline: PHP table display





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC