Jump to content
Larry Ullman's Book Forums

Recommended Posts

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.

    }

Share this post


Link to post
Share on other sites

Your location is wrong. Also, you should not be printing something and then redirecting. 

 

(Edit: Sorry! Forgot the "not"!)

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Okay, I found it.. a <?php ?> in the line above. I think you probably meant I "could" be printing something instead of "should".

 

thanks

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...