passing sessions between pages

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
assgar
Forum Commoner
Posts: 46
Joined: Fri Apr 20, 2007 9:00 pm

passing sessions between pages

Post 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
 
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: passing sessions between pages

Post 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
assgar
Forum Commoner
Posts: 46
Joined: Fri Apr 20, 2007 9:00 pm

Re: passing sessions between pages

Post 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.
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: passing sessions between pages

Post by alex.barylski »

If you disable cookies then the SID needs to be propagated via GET/POST...
Post Reply