rofl90 Posted February 5, 2008 Share Posted February 5, 2008 I had a header error so I used ob_start(), now it's giving me an unexpected require error :S Havn't got a clue. <?php ob_start() require("config.php"); //Includes the configuration file we made earlier. if(!isset($_POST['login'])){ //If they haven't posted the login form... echo("Please enter the password to edit the site status!<br /> <form method=\"post\"> Password: <input type=\"password\" name=\"password\"> <br /> <input type=\"submit\" value=\"Login\" name=\"login\"> </form>"); //^^ Then show the login form so they can login. }else{ //If they have posted the login form... $s_password = $_POST['password']; //Change the password variable to something easier to handle. if($s_password != $set_password){ //If the supplied password doens't match the set password in the configuration file... die("You did not enter the correct password!"); //Tell them so, and close the session so they can't edit anything. } //Ends the if statement (the supplied password didn't match the set one) setcookie("loggedin","yes"); //Sets a cookie with the users information in, will be used in the next step. header("Location: edit.php"); //Sends them off to the edit info page. } //End the if statement (the login from hasn't been posted) mysql_close(); //Close any remaining MySQL connections. ?> Quote Link to comment Share on other sites More sharing options...
rofl90 Posted February 5, 2008 Author Share Posted February 5, 2008 Hmm, now its even wierder now i have this i got the rest working but when its online heres my code: but it gives me this error: Warning: Cannot modify header information - headers already sent by (output started at e:\domains\p\prowebdesigns.co.uk\user\htdocs\config.php:13) in e:\domains\p\prowebdesigns.co.uk\user\htdocs\index.php on line 4 i read the headers thing but didn't really understand it. <?php require("config.php"); //Includes the configuration file we made earlier. if($i->status == "on"){ //If the site status is set to on... header('Location: http://www.prowebdesigns.co.uk/'); //Then forward the user to the online page. } elseif($i->status == "off"){ //If the site status is set to off... echo("The site is currently in offline mode!<br />The reason for this is: <b>" . $i->offmsg . "</b><br />We appologise for any disturbance this may cause."); //^^ Then tell them so, and show the offline message. } //Closes the statement. mysql_close(); //Stops any MySQL connections we had running. ?> Quote Link to comment Share on other sites More sharing options...
revraz Posted February 5, 2008 Share Posted February 5, 2008 Your included file config.php has output on line 13. You can't sent anything to the browser before calling a Header. Quote Link to comment Share on other sites More sharing options...
haku Posted February 5, 2008 Share Posted February 5, 2008 The reason for your parse error is that you don't have a semi-colon after ob_start() 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.