ryanfilard Posted March 15, 2012 Share Posted March 15, 2012 I have been trying to fix this for a really long time. It does not show an error on my local server but on my demo server it does.' What am I doing wrong? I have tried changing the location of the default.php file. I even tried require_once and require. Nothing worked. try logging in with random details with this link. You will see the error. http://goo.gl/3IetJ default.php <?php $hostname_default = "localhost"; $database_default = "mypass"; $username_default = "my_user"; $password_default = "my_pass"; $default = mysql_pconnect($hostname_default, $username_default, $password_default) or trigger_error(mysql_error(),E_USER_ERROR); ?> login.php <?php if (!isset($_SESSION)) { session_start(); } if (!empty($_REQUEST['password'])) { include("../Connections/default.php"); $username = $_REQUEST['username']; $password = md5(md5($_REQUEST['password'])+salt); mysql_select_db($database_default, $default); $login_check = "SELECT * FROM users WHERE username = '$username' AND password = '$password'"; $login = mysql_query($login_check, $default) or die(mysql_error()); $row_login = mysql_fetch_assoc($login); $val_login = mysql_num_rows($login); if ($val_login == '1') { $_SESSION['E_User'] = $row_login['username']; header('Location: index.php'); } else { header('Location: login.php?error=1&username='.$username.''); } } ?> Link to comment https://forums.phpfreaks.com/topic/259017-header-error/ Share on other sites More sharing options...
tiger2380 Posted March 15, 2012 Share Posted March 15, 2012 Add this to first line of each page: <?php ob_start(); Add this to the bottom: <?php ob_end_flush(); ?> Link to comment https://forums.phpfreaks.com/topic/259017-header-error/#findComment-1327876 Share on other sites More sharing options...
ryanfilard Posted March 15, 2012 Author Share Posted March 15, 2012 Thank you, this really helped. Link to comment https://forums.phpfreaks.com/topic/259017-header-error/#findComment-1327879 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.