I am writing a small user management system - to control login/logout, and mySQL management of the users. It is a class (because OOP rules). Everything works fine, except when it comes to the session management.
I am using HTTP_SESSION_VARS instead of _SESSION because the web server I will use this on (and some of the other people I am writing this for) use PHP 4.0.6 or less.
Here is the code
function do_login($name, $password) {
global $HTTP_SERVER_VARS;
global $HTTP_SESSION_VARS;
global $HTTP_GET_VARS;
global $HTTP_POST_VARS;
if($this->encrypt) { $password = md5($password); }
if(!$this->login($name, $password)) {
$bad = $HTTP_GET_VARS['bad'];
$this->redirect($bad);
exit;
} else {
session_start();
$HTTP_SESSION_VARS['id'] = $this->get_id($name);
$HTTP_SESSION_VARS['name'] = $name;
if(isset($HTTP_GET_VARS['ref'])) {
$loc = $HTTP_GET_VARS['ref'];
$this->redirect($loc);
}
}
}
The problem is that the session data is not viewable after a test login... I have the form redirecting to test.php, which is just :
session_start();
print_r($HTTP_SESSION_VARS);
THat's it. If I login using the user management class, when it is redirected to test.php, it shows that the array is empty. If I send the login to another page that is just straight non-oop PHP, it works fine. Am I missing something???
Thanks in advance!