black_pearl Posted July 31, 2015 Share Posted July 31, 2015 (edited) hey guys, i have just uploaded my website online and the headers seems to be broken whenever i login it has to normally redirect me to the home page but it just jam there and nothing happens and i have to refresh the page or go to the home page on my own and on my localhost they work fine no problem at all and i am using the same code nothing has changed someone told me it might be coz of the php version on my localhost i have 5.5.12 and online its 5.5.27 code : <?php class LoginController { public function __construct() { } public function run() { // if user already connected redirect to user home page if (!empty ( $_SESSION ['authentification'] )){ header ( 'Location: index.php?action=home' ); die (); } // initial notification $notification = ''; if (! empty ( $_POST )) { if (empty ( $_POST ['username'] ) && empty ( $_POST ['password'] )) { $notification = 'Entrez un login et mot de passe non vides.'; } elseif (empty ( $_POST ['username'] )) { $notification = 'Entrez un login non vide.'; } elseif (empty ( $_POST ['password'] )) { $notification = 'Entrez un mot de passe non vide.'; } elseif (preg_match ( '/^[a-z]{4,5}$/', $_POST ['username'] )) { $login = htmlentities ( $_POST ['username'] ); $password = htmlentities ( $_POST ['password'] ); if (Db::getInstance ()->login_exists ( $login )) { // authentication if (Db::getInstance ()->authentication ( $login, $password )) { // create session username and copy login $_SESSION ['login'] = $login; $_SESSION ['authentification'] = 'admin'; // Redirection HTTP to home page header ( 'Location: index.php?action=home' ); die (); } } // in case login doesn't exist in db or incorrect paswsord $notification = 'Nom d\'utilisateur et/ou mot de passe incorrecte(s).'; } else { // in case login doesn't match preg_match $notification = 'Nom d\'utilisateur et/ou mot de passe incorrecte(s).'; } } // view : login.php require_once (VIEWS_PATH . 'login.php'); } } ?> Edited July 31, 2015 by black_pearl Quote Link to comment Share on other sites More sharing options...
Solution iarp Posted July 31, 2015 Solution Share Posted July 31, 2015 You most likely cannot see any errors as display_errors = Off within your php.ini Try adding the code below to the top of that script, or whatever script you're getting a blank page on. <?php error_reporting(E_ALL); ini_set("display_errors", 1); Quote Link to comment Share on other sites More sharing options...
black_pearl Posted August 1, 2015 Author Share Posted August 1, 2015 hey iarp i tried the code and it gives me this error Warning: Cannot modify header information - headers already sent by (output started at /customers/8/c/6/bemotors.be/httpd.www/views/header.php:7) in /customers/8/c/6/bemotors.be/httpd.www/controllers/LoginController.php on line 39 Quote Link to comment Share on other sites More sharing options...
black_pearl Posted August 1, 2015 Author Share Posted August 1, 2015 oke thanks found the solution 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.