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
https://forums.phpfreaks.com/topic/215540-php-cookies-being-messed-up-by-htaccess/
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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.