Re: Newbie error with cookies and headers already declared
| From: | Kevin Murphy | Date: | Fri, 21 May 2004 21:33:32 +0000 |
| Subject: | Re: Newbie error with cookies and headers already declared | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-186729@lists.php.net to get a copy of this message | ||
I'm a newbie to PHP too, but....
I think its the HTML tag. Move it down below the PHP and see what happens.....
--
Kevin Murphy
Web Designer - Stubborn Donkey Productions
www.stubborndonkey.com
On May 21, 2004, at 1:28 PM, GodFoca wrote:
> I'm getting this error:
>
> 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
>
> With this code in "main.php":
>
> <html>
> <?
> 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);
> }
> ?>
> <meta http-equiv="Content-Type" content="text/html;
> charset=iso-8859-1">
> <link href="styles/main_style.css" rel="stylesheet"
> type="text/css">
>
> <body>
> .....
>
> 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?
>
> Thanks in advance,
> Nicolas
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>