Jump to content

Recommended Posts

Is it possible in PHP to only load the content of a page if the user is coming from a certain link?

 

Example:

Page one holds a drop down of ID numbers. You choose your ID and it takes you to page 2 where it queries the DB and pulls your info based on your ID.

 

What I DON'T want to happen is someone can go to page 2 directly and it will load with no info.  How can I force the user to go to page 1 even if he knows the link to page 2?  Perhaps not have it be a second page at all?  Like page 1 is index.php and page 2 is actually index.php?section=2?

 

I am a total noob to all this so any help is appreciated.

you can use $_SERVER['HTTP_REFERER'] but that's not 100% foolproof.  Alternatively, if both pages are on your server, you can create a session var on page 1 and check for it on page 2.  If its not there, they obviously didn't go to page 1 first.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.