passing sessions between pages

Reply

Join Date: Oct 2006
Posts: 82
Reputation: assgar is an unknown quantity at this point 
Solved Threads: 0
assgar assgar is offline Offline
Junior Poster in Training

passing sessions between pages

 
0
  #1
Sep 26th, 2008
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]
  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]
  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]
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1,476
Reputation: cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about 
Solved Threads: 136
cwarn23's Avatar
cwarn23 cwarn23 is offline Offline
Nearly a Posting Virtuoso

Re: passing sessions between pages

 
0
  #2
Sep 26th, 2008
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.
Try not to bump 10 year old threads as it can be really annoying.
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 82
Reputation: assgar is an unknown quantity at this point 
Solved Threads: 0
assgar assgar is offline Offline
Junior Poster in Training

Re: passing sessions between pages

 
0
  #3
Sep 27th, 2008
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.
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 849
Reputation: R0bb0b is on a distinguished road 
Solved Threads: 67
R0bb0b's Avatar
R0bb0b R0bb0b is offline Offline
Practically a Posting Shark

Re: passing sessions between pages

 
0
  #4
Sep 27th, 2008
Originally Posted by cwarn23 View Post
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.
“Be who you are and say what you feel because those who mind don't matter and those who matter don't mind.” - Dr. Seuss

-- The documentation is inevitable, you may get away with it for a little while but eventually you too will have to do the deed.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC