JJohnsenDK Posted February 22, 2007 Share Posted February 22, 2007 Hey i get this error: Warning: Cannot modify header information - headers already sent by (output started at C:\Programmer\xampp\xampp\htdocs\test\login\config.php:29) in C:\Programmer\xampp\xampp\htdocs\test\login\log_out.php on line 14 config.php script: <?php set_include_path('../../../php/pear/'); include ('DB.php'); $type = "mysql"; $host = "localhost"; //mySQL server $user = "root"; //mySQL brugernavn $pass = ""; //mySQL kodeord $database = "login"; //mySQL database //Åbner Forbindelsen til mysql serveren og vælger database $dsn = "$type://$user:$pass@$host/$database"; $dbconn = DB::connect($dsn); if (DB::isError($dbconn)) { die($dbconn->getMessage()); } require('check_login.php'); ?> line 29 is empty, the last line in script after the php closer ?> log_out.php script: <?php require('config.php'); // database connect script. if ($logged_in == 0) { die('You are not logged in so you cannot log out.'); } unset($_SESSION['username']); unset($_SESSION['password']); // kill session variables $_SESSION = array(); // reset session array session_destroy(); // destroy session. // redirect them to anywhere you like. header("Location: login.php"); ?> line 14 is the header line... hope someone can help out. Link to comment https://forums.phpfreaks.com/topic/39607-solved-header-problem/ Share on other sites More sharing options...
heckenschutze Posted February 22, 2007 Share Posted February 22, 2007 according to the HTTP protocol, headers can only be sent once (before any content is sent)... In other words, you cannot send anymore headers if you have sent content (this includes anything as small as a space)... Link to comment https://forums.phpfreaks.com/topic/39607-solved-header-problem/#findComment-191123 Share on other sites More sharing options...
mmarif4u Posted February 22, 2007 Share Posted February 22, 2007 remove spaces from ur code where header is included. sent the header 1st. Link to comment https://forums.phpfreaks.com/topic/39607-solved-header-problem/#findComment-191126 Share on other sites More sharing options...
JJohnsenDK Posted February 22, 2007 Author Share Posted February 22, 2007 nice and simple answer... Nice... Thanks mate .. Link to comment https://forums.phpfreaks.com/topic/39607-solved-header-problem/#findComment-191127 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.