Re: cookies problem



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
.



Relevant Pages

  • Re: cookies problem
    ... my problem is i cant register cookie ... i use this code to check cookie and seesion and it is included to all ... it is part of class user but because the class "user" ... var $username; ...
    (comp.lang.php)
  • Re: cookies problem
    ... my problem is i cant register cookie ... i use this code to check cookie and seesion and it is included to all ... it is part of class user but because the class "user" ... var $username; ...
    (comp.lang.php)
  • Re: cookies problem
    ... my problem is i cant register cookie ... i use this code to check cookie and seesion and it is included to all ... it is part of class user but because the class "user" ... var $username; ...
    (comp.lang.php)
  • RE: Secure Cookie in an Asp project
    ... >I need to do some crypto in an asp project (MS IIS server, ... >it is an old project that use in an a very insecure way cookie ... * Convert a string to a sequence of 16-word blocks, ... var x = str2blks_MD5; ...
    (SecProg)
  • Keypress irregularity: IE vs. FF function call timing?
    ... input box to the next as the user types. ... in a cookie so they can save their game. ... everything before it calls the last line, MoveFocus(). ... var numcheck; ...
    (comp.lang.javascript)