robert_gsfame Posted August 4, 2009 Share Posted August 4, 2009 i got this code <?php require_once('config.php');?> <?php if(isset($_POST['login'])){ if(empty($_POST['username'])||(empty($_POST['password']))){header('location:failure.php');}}?> when i run it, then this statement appeared CANNOT MODIFY HEADER(HEADER ALREADY SENT can anyone find out which part is wrong? thx Quote Link to comment Share on other sites More sharing options...
taquitosensei Posted August 4, 2009 Share Posted August 4, 2009 something in config.php is outputting to the screen. Or you have a space before before one of the <?php's Quote Link to comment Share on other sites More sharing options...
robert_gsfame Posted August 4, 2009 Author Share Posted August 4, 2009 this is what my config.php look like <?php $localhost='localhost'; $username='xxxxxx'; $password='XXXXX'; $database='YYYYYYY'; mysql_connect($localhost,$username,$password); mysql_select_db($database);?> which part is wrong, it seems i don't have any space wrongly placed Quote Link to comment Share on other sites More sharing options...
WolfRage Posted August 4, 2009 Share Posted August 4, 2009 I think your database is spitting out an error, thus the headers are being sent. You should run that page by it's self. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted August 4, 2009 Share Posted August 4, 2009 The whole error message states where the output is occurring that is preventing the headers from working. Reading the error message would indicate where to look. The problem is either characters or content being output from the files or due to the Unicode/UTF-8 BOM characters that an editor places at the start of the file. The problem could be with either the main file or the file being included. Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted August 4, 2009 Share Posted August 4, 2009 the second you break out of php and output markup OR whitespace headers are sent. you can prevent this by coding so that all logic is executed/all processing done BEFORE you start building the page OR by using output buffering buffering may not be the best option but if you have lots of legacy code it will solve it in the short term. Quote Link to comment Share on other sites More sharing options...
robert_gsfame Posted August 4, 2009 Author Share Posted August 4, 2009 okay guys thanx A LOT!!!!!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.