iarp Posted January 19, 2009 Share Posted January 19, 2009 <?php if(!isset($_COOKIE['cms_theme'])) { $r = $cms->cquery('theme'); setcookie('cms_theme', $r); $url = $_SERVER['REQUEST_URI']; header("Location: $url"); } elseif (isset($_GET['theme'])) { $get = escape_data($_GET['theme']); setcookie('cms_theme', $get); $url = $parts[0]; //$parts[0] = everything before the ? header("Location: $url"); } ?> Problem, whenever i view example.com and then view example.com/programs/ i keep getting more cookies made. Ive installed an addon in FF so i can see what cookies are related to the website i'm working on and it's path shows / and the others /programs/. How is a path set for a cookie so that no matter where the cookie is called wether it be / or /programs/ or /gui/ it's always the same one. Quote Link to comment https://forums.phpfreaks.com/topic/141483-cookies-being-remade-with-different-paths/ Share on other sites More sharing options...
revraz Posted January 19, 2009 Share Posted January 19, 2009 If you want the cookie to remain after you close the browser, make sure you set a duration. To have your entire site use the same cookie, use the path "/" http://us.php.net/setcookie Quote Link to comment https://forums.phpfreaks.com/topic/141483-cookies-being-remade-with-different-paths/#findComment-740604 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.