How can I have an new session id without closing the browser?

session.inc contains  basically the postgresql session functions (user
handler) in  http://www.php.net/manual/en/ref.session.php
I have change  pg_pconnect for pg_connect and I have added
pg_destroy_session.

1. There is a login/password page
2. Afterwards all pages that access the DB have the following include
file:

<?
include('sesion.inc');

if (!isset($g_login)) {    // flag that indicates that validation was
succesful

  echo "<script language='javascript'>
         <!--
          var lugar = window.location.href;
          if ( lugar != \"http://www.my_web.com/login.php\" ) {
             window.location.assign('http://www.my_web.com/login.php');
          }
          //-->
         </script>";
}

if (isset($g_hora)) {

  $timeout = 3600 ;
  $lapso = time() - $g_hora;
  if ( $lapso >= $timeout )  {

    session_destroy();                // delete session  from  database
    session_unset();                  // suppose to delete session
variable from memory
    $sesion = md5(uniqid("prueba"));
    session_id($sesion);              // new session

    echo "<script language='javascript'>
           <!--
            var lugar = window.location.href;
            var lugars;

            window.alert('La sesión ha expirado');
            var lugar = window.location.href;
            if ( lugar != \"http://www.my_web.com/login.php\" ) {

window.location.assign('http://www.my_web.com/login.php');
              }
            //-->
           </script>";
  }
}
?>


3. How am I supposed to create a new session identificator ?
    session_unset is suppose to "free" (delete?)  all session variables
currently registered, isn't it?
    After timeout, it goes to login page but I have still the old
session id instead of the new one.

    What am I missing?

TIA

--
Evelio Martínez


Reply via email to