This is my session:
<?php
class login_lib
{
var $server = "localhost";
var $db_user = "root";
var $db_pass = "";
var $database = "login";
var $logout_url = "/login.htm";
var $error = array
(
"Username bevat ongeldige karakters.",
"Password bevat ongeldige karakters."
);
function login($username, $password)
{
if (!eregi("^[[:alnum:]_-]+$", $username))
{
return $this->error[0];
}
if (!eregi("^[[:alnum:]_-]+$", $password))
{
return $this->error[1];
}
mysql_connect($this->server, $this->db_user, $this->db_pass);
mysql_select_db($this->database);
$query = mysql_query("select id from login where username = '$username' and password = '$password'");
$result = mysql_num_rows($query);
mysql_close();
if ($result < 1)
{
return false;
}
else
{
list ($id) = mysql_fetch_row($query);
$time = time();
// id and time are not in the session!
// Why?
// How do I get them in?
session_start();
session_register("id", "username", "password", "time");
$id = "";
$time = "";
$username = "";
$password = "";
return 2;
}
}
}
$login_lib = new login_lib;
?>
How can I fix that problem of the session.
(See the comment in the code)
If you now? Would you copy/paste the code and
write the correct code into?
Thanks in advantage,
Wouter