Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

PHP Question

0 views
Skip to first unread message

James Sarjeant

unread,
Nov 26, 2007, 9:06:30 AM11/26/07
to
Hi all,
I am trying to get some PHP script to redirect a user if they have not had a
cookie set so far I have:

if(!isset($_COOKIE['user']))
{
header("Location: <url>");
exit();
}

This is the first statement under the <body> tag of every page that calls it
but when I run it from the server it says:

Warning: Cannot modify header information - headers already sent by (output
started at <the include statement for the lines above> ) in <the header line
above>

Any ideas on how to resolve this are greatly welcomed because I am slightly
stumped. I dont know where the header information is being sent other than
the obvious call in the code above.

If you need more information to solve then just say.
Thanks in advance
James


Adrienne Boswell

unread,
Nov 26, 2007, 10:06:35 AM11/26/07
to
Gazing into my crystal ball I observed "James Sarjeant"
<james.sa...@ntlworld.com> writing in
news:GpA2j.6009$B97....@newsfe7-win.ntli.net:

<? 'do all your server side logic up here before headers are sent ?>
<html>
<head>
<title>This IS header information</title>
</head>
<body>
<p>It's too late now</p>
</body>
</html>

--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share

James Sarjeant

unread,
Nov 27, 2007, 3:49:23 AM11/27/07
to
Worked a charm, thanks alot
"Adrienne Boswell" <arb...@yahoo.com> wrote in message
news:Xns99F44817C72C...@69.28.186.121...
0 new messages