Unfortunately I include the session_start(); method in the file header.php (because I am checking for a value here to determine whether to show a logout button or not) therefore I cant do the
<? if(session_is_registered('userId')) { header("Location: membersArea.php"); } else { include("header.php"); ?> at the top of the page because the server will not be able to get hold of the session to see if session_is_registered('userId') evaluates to true! I suppose I could remove session_start(); from the header.php and hard code it at the top of every page ! Matt. ----- Original Message ----- From: "Ben Ramsey" <[EMAIL PROTECTED]> Newsgroups: php.general To: "Matthew Oatham" <[EMAIL PROTECTED]> Sent: Thursday, March 04, 2004 12:49 AM Subject: Re: server side redirects > > guess this is because I have already output html before this php command > > Exactly right. Why don't you use the header() function at the top of > the page before sending any other headers? It will definitely work that > way. And if the problem is because you're doing some evaluation down in > your page, take that evaluation out and bring it up above the headers, > as well. I usually do all my page processing and evaluation at the top > of my pages before I write any HTML. > > As for the meta redirect, I'm not sure of any problems there (others > will likely know better than I), but I think it's best to have your > application do the redirect from the server-side rather than the > client-side. If your evaluation is high enough in the page to know to > print the meta redirect tag, then you can probably afford to move it > just a few lines higher than the <html> tag and use header() instead. > Doing things on the server-side is always best and more secure; > end-users are less likely to be able to screw things up. > > -- > Regards, > Ben Ramsey > http://benramsey.com > http://www.phpcommunity.org/wiki/People/BenRamsey > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php