Re: PHP4 & sessions
| From: | AJDIN BRANDIC | Date: | Mon, 09 Oct 2000 09:30:01 +0000 |
| Subject: | Re: PHP4 & sessions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-19169@lists.php.net to get a copy of this message | ||
On Fri, 6 Oct 2000, Michael Kimsal wrote:
> My experience so far is that the save_handler thing still doesn't work
> for writing, which is half of what you need for sessions...
>
> We use a home grown version - I'm sure there are many others out there.
>
> I'd give an example here, but it uses cookies - nearly all session
> code does, as it's the easiest way to do things. You specifically
> say you don't want to use cookies (why not?).
Thanks Michael,
Can someone else confirm this please or give their opinion.
Thanks
>
>
> AJDIN BRANDIC wrote:
>
> > Hi,
> > I'm trying to understand sessions and I've looked at some tutorials but
> > still I'm not 100% on it. I want to store session data in the database
> > rather that use cookies. I now I need to use
> > session_set_save_handler ("open", "close", "read",
> > "write", "destroy", "gc");
> > but how do I specify db name etc. Has anyone got an example script that
> > actualy work so I can have a look at it.
> > Also I've tried this script and it returned to me only
> > open (/tmp, PHPSESSID)
> > read (db764b17189f06ea34216cb4f6973ed9)
> > but no write. Does this mean that php.ini need to have
> > session.save_handler=user?
> >
> > Thaks,
> > Ajdin
> >
> > The script is:
> > <?php
> > function open ($save_path, $session_name) {
> > echo "open ($save_path, $session_name)<br>";
> > return true;
> > }
> >
> > function close () {
> > echo "close<br>";
> > return true;
> > }
> >
> > function read ($key) {
> > echo "read ($key)<br>";
> > return "foo|i:1;";
> > }
> >
> > function write ($key, $val) {
> > echo "write ($key, $val)<br>";
> > return true;
> > }
> >
> > function destroy ($key) {
> > return true;
> > }
> >
> > function gc ($maxlifetime) {
> > return true;
> > }
> >
> > session_set_save_handler ("open", "close", "read",
> > "write", "destroy",
> > "gc");
> >
> > session_start ();
> >
> > $foo++;
> >
> > ?>
>
> --
> ==========================
> Michael Kimsal
> http://www.tapinternet.com
> 734-480-9961
>
>
>