Jump to content

Only load page if came to from specific url


SEVIZ

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.