[phplib] Session and redirect From: Christian Ribeaud (christian.ribeaud <email protected>)
Date: 03/27/01

Hi,

I would like to use the session ability of phplib as my provider only make the php's version 3.0.16 available.
I wrote an index page with a simple form (user_id, password). The form's action is the page itself (index.php3).
After a database query, the user should be redirected to an appropriated page like this:

<index.php3's snip>
if ($authenticated) {
  include("prepend.php3");
  page_open(array("sess" => "SessionID"));
  $sess->register("User_ID");
  page_close();
  if(!strcmp($User_ID,"opo")) {
    header("Location: opo.php3");
  } else {
    header("Location: admin.php3");
  }
  exit;
}
</index.php3's snip>

With this code, I will still get the index.php3 page. There is no redirection. The only difference I noticed is the uid has been appended.
What is wrong? I would be very grateful if someone could help me.
Last comments: I created the table (active_session) and changed the local.inc as following:

class DB extends DB_Sql {
  var $Host = "xxx.yyyyy.ch";
  var $Database = "oponet";
  var $User = "ole";
  var $Password = "-------";
}

class Container extends CT_Sql {
  var $database_class = "DB"; ## Which database to connect...
  var $database_table = "active_sessions"; ## and find our session data in this table.
}

class SessionID extends Session {
  var $classname = "SessionID";

  var $cookiename = "oponet"; ## defaults to classname
  var $magic = "atchoum"; ## ID seed
  var $mode = "cookie"; ## We propagate session IDs with cookies
  var $fallback_mode = "get";
  var $lifetime = 15; ## 0 = do session cookies, else minutes
  var $that_class = "Container"; ## name of data storage container
  var $gc_probability = 5;
  var $allowcache = "no";
}

Have a nice day,

christian

---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>