zer0uk Posted March 24, 2020 Share Posted March 24, 2020 Hello I have moved my web site from local machine to a hosted server (Ionos) I seem to be having issues with any code that has redirects or checks if the user is logged in, I just get a blank page, any idea's ? works fine on my local Xamp version two examples below (if I remove the code the page runs) // We need to use sessions, so you should always start sessions using the below code. session_start(); // If the user is not logged in redirect to the login page... if (!isset($_SESSION['loggedin'])) { header('Location: login.php'); exit(); } ?> <?php // database connect include('../db_connect.php'); // We need to use sessions, so you should always start sessions using the below code. session_start(); // If the user is not logged in redirect to the login page... if (!isset($_SESSION['loggedin'])) { header('Location: login.php'); exit(); } // if submit button selected run code if(isset($_POST['submit'])){ $_SESSION['district'] = $_POST['district']; header('Location: add_d_choice.php'); } ?> <!DOCTYPE html> <html> <head> </head> Quote Link to comment Share on other sites More sharing options...
gw1500se Posted March 24, 2020 Share Posted March 24, 2020 Recheck your code to make sure there is nothing being output (including white space) prior to the headers. You don't show all your code but I'm guessing there is some output preceding the header. Quote Link to comment Share on other sites More sharing options...
ginerjm Posted March 24, 2020 Share Posted March 24, 2020 And turn on php error checking - it will probably point out the error GW has diagnosed with a line number 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.