Cookies and page includes
Posted: Wed Jan 23, 2008 10:30 am
Howdy Folks,
I'm having a problem, and cannot seem to figure out why. I'm hoping one of you wizards can help me out.
I have some index.php pages that are basically there to feed a cookie to a main index.php page.
You can see the code for the feeder index pages here:
The layout of the page is handled on the main index file "../launcher/index.php" which depends on having the correct cookie to display properly, and that is not happening. If you reload the page in the browser, it works fine and displays the correct layout, but the first load, for some strange reason, loads the wrong way, as if it still had the old cookie.
I theorized that maybe I needed to pause the script before including the main page, but that didn't work.
Any advice or direction would be greatly appreciated. Thanks,
peteywheats
I'm having a problem, and cannot seem to figure out why. I'm hoping one of you wizards can help me out.
I have some index.php pages that are basically there to feed a cookie to a main index.php page.
You can see the code for the feeder index pages here:
Code: Select all
<?php
// This is one of the index pages, it's purpose is to feed the value "setting_one"
// to the included index page and display the properly formatted page
$domain = "censored.removed.redacted.com";
// Removes old cookie value, sets new cookie to last 1 year.
setcookie ( "channelidcookie", "", time () - 360, "/", $domain );
setcookie ( "channelidcookie", "setting_one", time () + (60 * 60 * 24 * 365), "/", $domain );
// include the main index page
include ("../launcher/index.php");
?>I theorized that maybe I needed to pause the script before including the main page, but that didn't work.
Any advice or direction would be greatly appreciated. Thanks,
peteywheats