|  | cookies problem |  | |
| | | oooobs |  |
| Posted: Fri May 30, 2008 6:10 pm Post subject: cookies problem |  |
Hello i have deficulty to deal with cookies in PHP my website is LINK cookies not working and when i tried to print session array i got the following strange output:
__utma 238121498.423365001.1211713664.1212127389.1212130222.30 __utmz 238121498.1212127389.29.4.utmcsr=hffar.com|utmccn=(referral)| utmcmd=referral|utmcct=/ __utmc 238121498 cprelogin no cpsession closed PHPSESSID a1db2915fffd55355c16a97e13741ccf
could you notice that line "utmcsr=hffar.com" it is refers to other website(my old website)!!!!!!!!!!
if some one know how to chage this line "utmcsr=hffar.com" to refer to my website LINK it may solve the problem
Thanks for help Ahmed |
| |
| | | Rik Wasmus |  |
| Posted: Fri May 30, 2008 6:10 pm Post subject: Re: cookies problem |  |
| |  | |
On Fri, 30 May 2008 20:10:55 +0200, oooobs <oooobs@gmail.com> wrote:
| Quote: | Hello i have deficulty to deal with cookies in PHP my website is LINK cookies not working and when i tried to print session array i got the following strange output:
__utma 238121498.423365001.1211713664.1212127389.1212130222.30 __utmz 238121498.1212127389.29.4.utmcsr=hffar.com|utmccn=(referral)| utmcmd=referral|utmcct=/ __utmc 238121498 cprelogin no cpsession closed PHPSESSID a1db2915fffd55355c16a97e13741ccf
could you notice that line "utmcsr=hffar.com" it is refers to other website(my old website)!!!!!!!!!!
if some one know how to chage this line "utmcsr=hffar.com" to refer to my website LINK it may solve the problem
|
I don't know what your exact problem with the $COOKIE array is, however, the __utmz cookie refers usually to Google Analytics, which I could not find on your current site. You can find some details about that cookie @ LINK Having that hffar.com string in it should not cause any problems whatsoever
The only cookie I get set is this: Set-Cookie: PHPSESSID=adf8479d9bd2b73320f1cbe39e8f2cc8; path=/; domain=.kal.am
which seems perfectly OK to me.
Could you tell us more about the exact problem you're having, what you are trying to do and where it fails? -- Rik Wasmus ....spamrun finished |
| |
| | | oooobs |  |
| Posted: Fri May 30, 2008 7:20 pm Post subject: 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 |
| |
| | | oooobs |  |
| Posted: Fri May 30, 2008 7:21 pm Post subject: 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 |
| |
| | | Rik Wasmus |  |
| Posted: Sat May 31, 2008 4:42 pm Post subject: Re: cookies problem |  |
| |  | |
On Sat, 31 May 2008 20:16:44 +0200, oooobs <oooobs@gmail.com> wrote:
| Quote: | On May 30, 8:20 pm, oooobs <ooo...@gmail.com> wrote: 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
did anyone know how to solve this problem?
|
Hmmm, I could've swarn I'd answered it, must be still in the outbox at work. However, 2 points:
1) use session_start() everywhere. 2) alter: setcookie('cookieUSER', $_SESSION['sessUSER'],$Month,'.kal.am'); to: setcookie('cookieUSER', $_SESSION['sessUSER'],$Month,'/','.kal.am'); -- Rik Wasmus ....spamrun finished |
| |
| | | oooobs |  |
| Posted: Sat May 31, 2008 6:16 pm Post subject: Re: cookies problem |  |
| |  | |
On May 30, 8:20 pm, oooobs <ooo...@gmail.com> wrote:
| Quote: | 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
|
did anyone know how to solve this problem? |
| |
| | | oooobs |  |
| Posted: Sat May 31, 2008 8:50 pm Post subject: Re: cookies problem |  |
| |  | |
On May 31, 7:42 pm, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote:
| Quote: | On Sat, 31 May 2008 20:16:44 +0200, oooobs <ooo...@gmail.com> wrote: On May 30, 8:20 pm, oooobs <ooo...@gmail.com> wrote: 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
did anyone know how to solve this problem?
Hmmm, I could've swarn I'd answered it, must be still in the outbox at work. However, 2 points:
1) use session_start() everywhere. 2) alter: setcookie('cookieUSER', $_SESSION['sessUSER'],$Month,'.kal.am'); to: setcookie('cookieUSER', $_SESSION['sessUSER'],$Month,'/','.kal.am'); -- Rik Wasmus ...spamrun finished
|
thanks Rik ,it works your second point solved the problem i dont know how to thank you for your time best regards Ahmed |
| |
|
|