GodFoca <mailto:[EMAIL PROTECTED]> on Friday, May 21, 2004 1:29 PM said:
> Warning: Cannot add header information - headers already sent by > (output started at /home/tiempodemaria/main.php:3) in > /home/tiempodemaria/main.php on line 11 [snip] > Does anybody knows what's going on? I don't understand which header > is being sent before the setting of the cookie, and I don't > understand the ":3" in the error description. This page is a frame, > so I don't have any head tag, does that matter to php? headers != <head> it's basically this: 1. you cannot create/write a cookie after you send any html output to the client. 2. you cannot create/write a session value after you send any html output to the client. for one, you've got <html> at the very top of main.php. try rearranging your file like this: <?php define(SECONDS_IN_THREE_MONTHS, 3600*24*90); define(OFFSET_WITH_GMT, -3*3600); $has_visited = isset($_COOKIE["TdM_visited"]); if (!$has_visited) { setcookie("TdM_visited", (string) (time() + OFFSET_WITH_GMT), time() + OFFSET_WITH_GMT + SECONDS_IN_THREE_MONTHS); // the above (not blank) is line 11 } else { $latestVisit = (int) $_COOKIE["TdM_visited"]; setcookie("TdM_visited", (string) (time() + OFFSET_WITH_GMT), time() + OFFSET_WITH_GMT + SECONDS_IN_THREE_MONTHS); } ?> <html> <meta http-equiv="Content-Type" ...> <link href="styles/main_style.css" ...> <body> ... hope this helps, chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php