eaglelegend Posted April 4, 2008 Share Posted April 4, 2008 I am getting this on one of my pages: Warning: Cannot modify header information - headers already sent by (output started at /misc/39/000/171/334/2/user/web/eaglelegend.com/header.php:5) in /misc/39/000/171/334/2/user/web/eaglelegend.com/members.php on line 3 This is members.php: <?php if($_COOKIE['elv2']=="") { Header("Location: http://www.eaglelegend.com/index.php?message=You are logged out! Please log back in!"); } $creditsSQL = mysql_query("SELECT * FROM `members` WHERE `username`='{$_COOKIE['ELv2']}'"); while($creditsROW = mysql_fetch_array($creditsSQL)) { $MONEY = $creditsROW["money"]; $POINTS = $creditsROW["points"]; $FROZEN = $creditsROW["frozen"]; } if($FROZEN==1) { print "<b>YOUR ACCOUNT IS FROZEN! PLEASE CONTACT THE SITE ADMIN. YOU HAVE BEEN LOGGED OUT!</b>"; setcookie("ELv2",null); } ?> Link to comment https://forums.phpfreaks.com/topic/99535-warning-cannot-modify-header-information/ Share on other sites More sharing options...
soycharliente Posted April 4, 2008 Share Posted April 4, 2008 Maybe it's the spaces in your url. You also need and exit() statement after the header() call. I also changed your check for an empty string to use empty(). <?php if (empty($_COOKIE['elv2'])) { $url = rawurlencode("message=You are logged out! Please log back in!"); header("Location: http://www.eaglelegend.com/index.php?$url"); exit(); } ?> Link to comment https://forums.phpfreaks.com/topic/99535-warning-cannot-modify-header-information/#findComment-509203 Share on other sites More sharing options...
PFMaBiSmAd Posted April 4, 2008 Share Posted April 4, 2008 Read the error message - output started at ..../header.php:5 Your header.php file is sending output to the browser at or before line 5 and this is preventing the header() statement in members.php on line 3 from working. Link to comment https://forums.phpfreaks.com/topic/99535-warning-cannot-modify-header-information/#findComment-509296 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.