Actually Im working with Classes, so, i Have a class for the session process, i create a new objet before anything, the constructor of the class has the session_start(); on it. I even try putting an extra session_start(); just before putting the data into $_SESSION variables...but didnt work either....
Besides that, im sure its saving data before doing the change of page, cause i used some echos to check it..but just when return to the page it called the class or another page... the data is lost. I chek the session too, if i echo the session ID it does appear and is the same always... it just that seems like the $_SESSION variable is cleanned some way...
Here is part of the class:
class sentry {
var $loggedin = false;
var $userdata;
function sentry(){
session_start();
header("Cache-control: private");
}
and the part where i need to check if there is stored data:
function checkLogin($group = 3,$user = '',$pass = '',$goodRedirect = '',$badRedirect = ''){
// Include database and validation classes, and create objects
require_once('DbConnector.php');
require_once('Validator.php');
$validate = new Validator();
$loginConnector = new DbConnector();
// If user is already logged in then check credentials
if ($HTTP_SESSION_VARS['user'] && $HTTP_SESSION_VARS['pass']){
......
}else{
..... here is the part when stored new data:
if ($loginConnector->getNumRows($getUser) > 0){
// Login OK, store session details
// Log in
$HTTP_SESSION_VARS["user"] = $user;
$HTTP_SESSION_VARS["pass"] = $this->userdata['pass'];
$HTTP_SESSION_VARS["grupo"] = $this->userdata['grupo'];
if ($goodRedirect) {
header("Location: ".$goodRedirect."?".strip_tags(session_id())) ;
}
return true;
}else{
....
}