Session questions
| From: | Boget, Chris | Date: | Thu, 05 Oct 2000 15:28:51 +0000 |
| Subject: | Session questions | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-18736@lists.php.net to get a copy of this message | ||
I'm having some problems with session and I'm
hoping someone can help me. I am using php
version 4.0.2.
I am having PHP store the session information in
a mysql database. The DB is called "sessions" and
the sessions table looks like this:
+---------+------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+------------------+------+-----+---------+-------+
| sesskey | varchar(32) | | PRI | | |
| expiry | int(11) unsigned | | | 0 | |
| value | text | | | NULL | |
+---------+------------------+------+-----+---------+-------+
I have 2 pages. The first is starting a session and
registering a variable. It is then pushing to the
second page via header( "location" ). My questions
and problems are:
* When I register my variable, the "value" field stores
the value I passed, but it now looks like this:
!myvalue|
why? Why is the session_register() adding the bang (!)
and the pipe (|) at the beginning and the end of my
variable?
* I've turned off cookies on my browser because I
want to code all my sessions so that it passes the
session id via the URL; I don't want to depend on
the user's browser having cookies. I compiled php4
with the --enable-trans-sid turned ON. Also, register
globals are turned ON. Now, what is happening is
that the session ID is _*not*_ being automatically
appended to the URL as it should be. Why wouldn't
it be? On a related not, when I try to print out the
session id value using the $SID variable, I get nothing.
I can get the value from the session_id(), but not
from the $SID variable. Why?
* From what I understand, I need to call the
session_start() function at the top of every one of my
pages in order to make sure all the session information
is available to each page. This is correct, yes? If so,
then why is it that every time I call that function, it
creates a new session record in my DB with a totally
new session id? How is any kind of continuity supposed
to be kept from one page to the other if this is happening?
There are a few others, but I need to run off to a meeting
and the above are pretty much the major ones I need to
resolve. It could very well be that if the above can be
fixed, the minor issues will be as well.
If anyone at all could help me, I would be so very appreciative.
I've been around and around reading up as much as I could
and I just cannot seem to figure out why the above is occuring.
Thanks for your time in reading this far and for your
help, if offered.
Chris