Hi, I want to write a session-class that use MySQL. I have write the
body of the class. The class open and close session,  write the "data"
from session to DB, but the function session_decode() does not want to
decode my data.

Here the session_set_save_handler:

session_set_save_handler(array($hnd, "open_session"),
                                       array($hnd, "close_session"),
                                       array($hnd, "read_session"),
                                       array($hnd, "write_session"),
                                       array($hnd, "destroy_session"),
                                       array($hnd, "gc_session")
                                      );

and this is the read_session:

   function read_session($sessionid)
    {
        global $_SESSION;
        zb_debug("Dentro read_session");
        zb_debug("Mi connetto al DB e prelevo la sessione");
        $query = "select value,last from session where id =
'".session_id()."'";
        $this->dbms->Exec_Query($query);
        if ($this->dbms->ReturnNum() == 0) {
            $session_exist = false;
        } else {
              zb_debug("la sessione esiste");
              $session_exist = true;
              $session = $this->dbms->ReturnNextObject();
              zb_debug("il valore nella sessione è ".$session->value);

              $expire = session_cache_expire();
              zb_debug("La sessione vale $expire secondi, restano
".(($session->last + $expire) - time())." secondi");
              if ( ($session->last + $expire) < time() ) {
                  zb_debug("La sessione è scaduta : ");
                  zb_debug("La cancello dal DBMS");
                  $query = "delete from session where id =
'".session_id()."'";
                  $this->dbms->Exec_Query($query);
                  zb_debug("Sessione cancellata");
                  //La sessione è scaduta.
                  $this->session_exist = false;
              } else {
                    session_decode($session->value);
                    //session_decode('id|i:0');
                    var_dump($_SESSION);
                    zb_debug("  ");
                }

          }

        return true;
    }


Plz help me.

PHP5-dev with Apache 1.3.27

bye


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to