Banner

Sponsor

Login


Welcome Back!
Guest
Guest

Register

Lost your password?

46 users online



php not detecting cookie it set

php not detecting cookie it set

Currently viewing this thread: 1 (0 members and 1 guests)


schoi

schoi

funny and cheeky
Status: Offline!

php not detecting cookie it set

The idea was the script would attempt to set a cookie then check if it has been set. As far as I know, php sessions uses cookies to store the session id. Hence the browser must have cookies switched on. However when it comes to test if the cookie was created it says it hasn't been set. When you look in cookies browser its there. When u refresh the page it says it has been created ???

I just used the set cookies command

setcookie("test","testing");

tested if it was created using $_COOKIE and the isset

Noel

Noel

Nobody fucks with my title.
Status: Offline!

Cookie creation is sent back in the HTTP response from the server, and as a result the cookie(s) is/are not available in $_COOKIE until the next request from the client, since that's when $_COOKIE is populated.

___________________

<3

Waldir

Waldir

God's Son
Status: Offline!

since cookies have to be set before any of your content is rendered to be viewed you can always set the cookies and than redirect the user to the same page, some what of a refresh using header location header("Location: index.php"); for example, this will alow you to use $_COOKIE since it will be able to be used after the refresh of the page

___________________

"The secret to creativity is knowing how to hide your sources." -- Albert Einstein

schoi

schoi

funny and cheeky
Status: Offline!

ah I thought it might be something like that. It actually makes a lot of sence because the server has no control over the client hence it would have to be sent in the http headers.

Quick Jump:

Main Navigation


Site & Graphic Design by Aeon Tan
Developed by Jeremie Pelletier & Scott Roach


NeverAPI generated this page in 0.0163 seconds.