SEVIZ Posted March 17, 2009 Share Posted March 17, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/149753-only-load-page-if-came-to-from-specific-url/ Share on other sites More sharing options...
.josh Posted March 17, 2009 Share Posted March 17, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/149753-only-load-page-if-came-to-from-specific-url/#findComment-786370 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.