chop Posted May 15, 2017 Share Posted May 15, 2017 I've used header() a hundred times. For some reason this just gives me a blank screen. The url exists and the script gets into the conditional and exits. This is a modification of Larry's script in chapter 16 that I get get to work because of this. thanks very much if (!isset($_SESSION['first_name']) || $_SESSION['user_level'] == 0 ) { echo "Hello, I should be redirecting now..."; header('Location: https://tenthousandeyes.org/.php'); exit(); // Quit the script. } Link to comment Share on other sites More sharing options...
Larry Posted May 15, 2017 Share Posted May 15, 2017 Your location is wrong. Also, you should not be printing something and then redirecting. (Edit: Sorry! Forgot the "not"!) Link to comment Share on other sites More sharing options...
chop Posted May 15, 2017 Author Share Posted May 15, 2017 Sorry, I copied it incorrectly. The code is as follows. Also, I don't know what you mean when you say "print". Do you mean a php print statemet? What is the purpose of that? $url = 'index.php'; // Define the URL. echo "Hello, I should be redirecting now..."; header('Location: https://tenthousandeyes.org'); exit(); // Quit the script. Link to comment Share on other sites More sharing options...
chop Posted May 15, 2017 Author Share Posted May 15, 2017 I should mention that there is an index.html it should go to. Also, I have tried it with a specific page.php as part of the location. Link to comment Share on other sites More sharing options...
chop Posted May 15, 2017 Author Share Posted May 15, 2017 Okay, I found it.. a <?php ?> in the line above. I think you probably meant I "could" be printing something instead of "should". thanks Link to comment Share on other sites More sharing options...
Larry Posted May 15, 2017 Share Posted May 15, 2017 Sorry! Sorry! I meant "should not be printing"! But glad you figured it out. Link to comment Share on other sites More sharing options...
Recommended Posts