Re: [PHP4BETA] Session
| From: | Alan van den Bosch | Date: | Wed, 08 Mar 2000 05:16:28 +0000 |
| Subject: | Re: [PHP4BETA] Session | ||
| References: | 1 2 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-11731@lists.php.net to get a copy of this message | ||
>At 03:07 PM 3/7/00, you wrote:
> > > > However, I found that Session is on and off. (ie. it sometimes preserves
> > > > value and sometimes not)
> > > It seems that you sometimes have to create a dummy session, destroy it, and
> > > then create a proper one. Check the archives for "dummy".
> >
> > I've never seen such an email. Do they exist?
>
>It may have been in the PHP3 list... anyway, it was Kenneth Whathisname who was
>getting the session code to work using MySQL as the storage device - he had to
>create a dummy session, destroy it, then create a proper one. Check the
>archives incase you missed it. Just search for 'dummy' as I mentioned above.
>Either that or he mentioned it privately to me and I'm hallucinating again ;-)
>
OK, the email that Kenneth Mutka wrote has a subject line of
'[PHP4BETA] Sessions & Mysql again' and appeared on the php4beta mailling list
around 21 Jan 2000 13:42:31 -0000.
I also had a play with writting session handler functions for mysql after
looking through Keneths code.
What I found was that if a session was being created by the 'read' function it
had to return something as the session data. A new session has no session data
though, this is why Keneth was generating a 'dummy' session - to 'prime' the
session data.
I found that by setting an empty session's data to "|" was sufficient to avoid
having to have a dummy session, but it will only work if the internal php
serialization functions are being used to serailize the session.
See attached files... I havent maintained these in the past month or so, there
may be some things that hvent kept pace with changes to the sessions module.
--
Regards,
Alan van den Bosch
Sanguis Pty Ltd
/* All generalizations are false. */
Attachment: [text/x-c++] index.php
Attachment: [text/x-c++] session.inc
# phpMyAdmin MySQL-Dump # http://www.htmlwizard.net/phpMyAdmin/ # # Host: localhost Database : sessions # -------------------------------------------------------- # # Table structure for table 'session' # CREATE TABLE session ( sid varchar(32) DEFAULT '#' NOT NULL, sData text NOT NULL, mtime timestamp(14), PRIMARY KEY (sid) );
Attachment: [text/x-c++] index.php
Attachment: [text/x-c++] session.inc
# phpMyAdmin MySQL-Dump # http://www.htmlwizard.net/phpMyAdmin/ # # Host: localhost Database : sessions # -------------------------------------------------------- # # Table structure for table 'session' # CREATE TABLE session ( sid varchar(32) DEFAULT '#' NOT NULL, sData text NOT NULL, mtime timestamp(14), PRIMARY KEY (sid) );