Page 1 of 1

passing sessions between pages

Posted: Thu Sep 25, 2008 11:08 pm
by assgar
Hi

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


Code: Select all

 
//at the top of the page
session_start();
 
//value passed
$last_login = $_SESSION['s_last_login'];//last user login history
 

Code: Select all

 
//This is my PHP.ini file session configuration below.
 
[Session]
; Handler used to store/retrieve data.
session.save_handler = files
;session.save_path = "N;/path"
;session.save_path = "N;MODE;/path"
;session.save_path = "/tmp"
session.use_cookies = 1
session.name = PHPSESSID
;Initialize session on request startup.
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor     = 100
session.gc_maxlifetime = 1440
session.bug_compat_42 = 1
session.bug_compat_warn = 1
session.referer_check =
session.entropy_length = 0
session.entropy_file =
;session.entropy_length = 16
;session.entropy_file = /dev/urandom
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.hash_function = 0
session.hash_bits_per_character = 4
 

Re: passing sessions between pages

Posted: Fri Sep 26, 2008 3:39 pm
by alex.barylski
Wrong forum, but anyways...

If you can pass sessions in IE and not FF I would assume that your cookies are disabled in FF and PHP is configured to only use cookies and not URL propagation.

I believe use_trans_sid is the culprit and should be set to 1 not 0

Re: passing sessions between pages

Posted: Sat Sep 27, 2008 10:39 am
by assgar
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.

Re: passing sessions between pages

Posted: Mon Sep 29, 2008 2:29 pm
by alex.barylski
If you disable cookies then the SID needs to be propagated via GET/POST...