I thought this would be quite simple to create a session wrapper, but I can't seem to get the variables to set properly.
function checkPerms($HTTP_POST_VARS){
if($HTTP_POST_VARS){
$this->setVariables('username',$HTTP_POST_VARS['user']);
$this->setVariables('paper',$HTTP_POST_VARS['paper']);
$this->setVariables('uid',session_id());
$this->checklogin($this->username,$this->password,$this->paper);
} else {
echo $this->login();
die;
}
}
function setVariables($key,$val){
$this->$key = $val;
$$key = $this->$key;
session_register("$key");
}
These are two functions within class adminSession. The values are being passed, and I can echo them up to the point of session_register().
But when I move to another page in the admin section it only returns the value for $HTTP_SESSION_VARS['paper']. The others exists but are empty. I can't understand why $paper would be created and not the others as the variables print within the function when I put calls to them, only when I goto another page after the session has been set the variables seem to work.
Thanks.