Re: Session questions
| From: | Michael Kimsal | Date: | Fri, 06 Oct 2000 16:48:22 +0000 |
| Subject: | Re: Session questions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-18943@lists.php.net to get a copy of this message | ||
"Boget, Chris" wrote:
> 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?
>
This is, I believe, the serialization that PHP does on the
session values for its own internal purposes. When it
pulls them out, it makes them 'normal' again.
You could change the serialization method in the .ini
file from 'php' to 'wddx' I think, if that would help you understand
the internal info better.
>
> * 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?
Sounds like the 'trans-sid' thing isn't working right - can
you check phpinfo() to see if it's really enabled?
--
==========================
Michael Kimsal
http://www.tapinternet.com
734-480-9961