Session not working when it was before

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
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Session not working when it was before

Post by anjanesh »

I was using WinMe and installed Win 2003 Server Ent but I couldn't get MySQL to work in 2003 however much I try, so I reinstalled Me.
Now I'm not getting sessions to work though it was working fine before.
I changed the session.save_handler = user in the php.ini file in c:\windows.
session.name is $PHPSESSID
This code does not print the session id though it did before.

Code: Select all

<?php
session_module_name("user");
session_set_save_handler("session_open","session_close","session_read","session_write","session_remove","session_gc");
session_start();
print($PHPSESSID);
function session_open($path,$name)
 {
   return true;
 }
function session_close()
 {
   return true;
 }
function session_read($id)
 {
      return true;
 }
function session_write($id,$data)
 {
    return true;
 }
function session_remove($id)
 {
    return true;
 }
function session_gc($life)
 {
    return true;
 }
?>
Please help.
Thanks
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

register_globals may be off, which would make print_r($PHPSESSID) cause a warning.. try print_r($_COOKIE) instead.
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

I set register_globals = On
Even then print($PHPSESSID); does not print anything. However print($_COOKIE); prints Array
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

I need to know if its a problem with IE5.5 ? I checked up at google and found no relevant pages. Will sessions work fine in IE5.5 ?
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

Post by itsmani1 »

Why don't you use IE6.0?????
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

Guess what ?

Code: Select all

<?php
session_module_name("user");
session_set_save_handler("session_open","session_close","session_read","session_write","session_remove","session_gc");
session_start();

print(session_name());
print('<BR>');
print(session_id());
print('<BR>');
print($PHPSESSID);
.
<session functions>
.
.
.
?>
is printing

PHPSESSID
6ae13db518d58c56b3a54c3a889d61c7



though it should have been

PHPSESSID
6ae13db518d58c56b3a54c3a889d61c7
6ae13db518d58c56b3a54c3a889d61c7


Can anyone explain why ? Before it wasn't like this.

Thanks a lot.
Post Reply