Welcome to WebmasterWorld Guest from 54.225.6.51

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

PHP session problem

Variables not remembered

     
4:44 am on Mar 27, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member drdoc is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 15, 2002
posts:6807
votes: 0


I'm using my custom session_save_handler, storing information in a database. It works great as far as starting a session. The information is stored in a MySQL database, and that works just fine. However, when I go to the next page the variable is no longer registered, and it has lost its value.
5:22 pm on Mar 27, 2003 (gmt 0)

Administrator

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 24, 2001
posts:15755
votes: 0


Not really sure, do you call session_start [php.net] every time?
6:11 pm on Mar 27, 2003 (gmt 0)

Administrator

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 24, 2001
posts:15755
votes: 0


maybe I don't quite get it but I was looking at
[php.net...]

the comments and examples may be in the neighbourhood of your question, not 100% sure though.

9:46 pm on Mar 27, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member drdoc is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 15, 2002
posts:6807
votes: 0


Yep, call session_start() at the top of each page. It recognizes the SID, but that's about it.

I've looked at the PHP site, but it wasn't too helpful. All the customized functions are called (tried to echo something from within the function, and it gets printed)... I just can't figure out why my session variables are lost :(

12:55 am on Mar 28, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member drdoc is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 15, 2002
posts:6807
votes: 0


Hmm... I just noticed that the cookies don't work either :(
It defaults to rewriting the URL...

I've successfully used PHP sessions before, but now I wanted to handle session storage in a MySQL database... and it's not working the way I want it to :)

1:28 am on Mar 28, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Aug 8, 2001
posts:926
votes: 0


are you doing session_register?

eg.

session_start();
$var1 = '10';
session_register('var1');

6:40 am on Mar 28, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member drdoc is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 15, 2002
posts:6807
votes: 0


Yes, I'm registering the variables...
8:33 am on Mar 28, 2003 (gmt 0)

Junior Member

10+ Year Member

joined:Jan 14, 2002
posts:118
votes: 0


What's your reigster_globals setting?

I believe you have to use $_SESSION['blurgh'] everywhere (inluding inside the session_register when register_globals is off.

The PHP manual is your friend :)
And read the notes too :)

Allen

6:12 pm on Mar 28, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member drdoc is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 15, 2002
posts:6807
votes: 0


register_globals is on...
And I've consulted the manual a lot, and read the notes, and ...

I rewrote the whole thing, and now it works... Except for the cookies... Has anyone else had that problem?