Re: cookies problem
- From: oooobs <oooobs@xxxxxxxxx>
- Date: Fri, 30 May 2008 12:21:21 -0700 (PDT)
Hello Rik and thanks
my problem is i cant register cookie
i use this code to check cookie and seesion and it is included to all
pages of my website
note:$USER is an object which containt user data
if(isset($_SESSION['sessUSER'])){
$USER = unserialize($_SESSION['sessUSER']);
}else{
if(isset($_COOKIE['cookieUSER'])){
$_SESSION['sessUSER'] = $_COOKIE["cookieUSER"];
$USER = unserialize($_COOKIE['cookieUSER']);
}else{
$USER = new USER();
session_register("sessUSER");
$_SESSION['sessUSER'] = serialize($USER);
unset($_SESSION['sessUSER']);
unset($_COOKIE['cookieUSER']);
}
}
@@@@@@@@@@@@@@@@@@@@
and the code for registering the session is (FILE: USER.PHP)
note: it is part of class user but because the class "user"
class USER
{
var $id;
var $username;
var $password;
var $email;
var $usertype;
var $auth;
function USER(){}
function auth(){
global $USER;
return ($this->auth);
}
function login($username,$password,$remember_me = false){
global $CFG, $USER;
if(auth_user($username, $password)){
$USER = get_user_info($username);
$this->auth = "1";
$_SESSION['sessUSER'] = serialize($USER);
if($remember_me){
$Month = 2592000 + time();
setcookie("cookieUSER", $_SESSION['sessUSER'],
$Month,".kal.am");
}
return true;
}
else
{
$this->auth = "0";
$_SESSION['sessUSER'] = serialize($USER);
unset($_SESSION['sessUSER']);
unset($_COOKIE['cookieUSER']);
return false;
}
}
}
and this $USER->login method is called by page signin.php
the problem is when i try to get data from cookie i couldnt so thats
what made me think there is a problem with domain (before your replay)
Thanks alot if you solve this problem and thanks alot if you dont ( at
least you was kind to try)?
Ahmed
.
- References:
- cookies problem
- From: oooobs
- Re: cookies problem
- From: Rik Wasmus
- cookies problem
- Prev by Date: Re: cookies problem
- Next by Date: Re: sessions being destroyed prematurely
- Previous by thread: Re: cookies problem
- Next by thread: using fopen() in write mode is failing
- Index(es):
Relevant Pages
|