Jump to content

php cookies being messed up by htaccess??


turkman

Recommended Posts

I have a huge anonymous posting board, which relies on cookies to keep track of people. Everything works fine except for logging out. When i print_r the cookie i can see the following.

 

When i log out the cookie is reset ... i can go to pages like www.mysite.com/page.php - but as soon as i go to a site with a modrewrite it goes back to the old cookie.

 

ive tried setting cookies with the ending "\" however this does not seem to fix the problem.

 

I believe the problem comes from the login cookie is set in the mysite/login/ tab and it checks for the cookie in the mysite.com/index.php tab.

Link to comment
Share on other sites

i dont know whats wrong. I clear my cookies and go to the site.  get a new cookie say for eg cookie1 i browse around the normal pages and the rewrite pages and it always displays cookie1 -> i login and it sets the cookie to the database cookie. now say its called cookie2 -> i can go around and view all the pages and it displays as cookie2 which is what i want! thats great! Then if i logout, it will redirect to a non mod rewrite page and show as cookie3 This is great, i can look though any non rewrite page and it will display as cookie 3. However as soon as i go into a mod rewrite page it changes back to cookie2 and now all pages no matter if they are mod rewrite or not display as cookie 2

Link to comment
Share on other sites

I would consider looking into sessions also, but not your customary $_SESSION well not fully atleast, im thinking more of a database driven session, where you can keep the sessions going with the ip/browser check and you can still give it an expiration like you could your cookies. But thats just a thought I know not everyone wants to jump from cookie to session, let alone cookie to database driven sessions. I think it might be a worthy move though for you, or at the least something to look into for maybe down the road.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.