|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
major cookie problem
ok, hers the problem:
i have a page that allows the user to log in, and sets this cookie: setcookie('admin',$username,$userexp) $userexp being the users set time for the cookie to expire. i have a small thing on the top of the page like this : if(isset($_COOKIE['admin'])) $logged = 1; else $logged = 0; on the same page as where the user logged in, it is correct, and $logged is set to '1', but on a seperate page, it always sets to '0'! how would i get the cookie to work on any page on my site, not just the one page i set the cookie on? thanks ahead of time |
|
#2
|
|||
|
|||
|
RE: major cookie problem
Hi the setcookie function has an additional parameters path and domain, which can be used to set a level on which is cookie set. I tryied to use
setcookie('admin',$username,$userexp,'/') and now is cookie visible on other pages too. Read the manual boolean setcookie ( string name [, string value [, int expire [, string path [, string domain [, int secure]]]]]) Zdenek |
|
#3
|
|||
|
|||
|
RE: major cookie problem
thanks, i had so much trouble with this! i read and re-read the manual, and couldnt figure out how to get it to work. ill get back to you on the progress of it.
|
|
#4
|
|||
|
|||
|
RE: major cookie problem
It happens to the best of us
|
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > major cookie problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|