PDA

View Full Version : [help] Must come from specific page?



cjj
May 14th, 2007, 04:12 PM
Is there anyway in PHP to determine if the user came from a specific page?

So that if the user came from the right page (page1.php) then they get certain info and if they came from any other page they get an error message?

Im sure I have seen this before. I would really appreciate any help with this! :h:

Seb Hughes
May 14th, 2007, 05:15 PM
Is there anyway in PHP to determine if the user came from a specific page?

So that if the user came from the right page (page1.php) then they get certain info and if they came from any other page they get an error message?

Im sure I have seen this before. I would really appreciate any help with this! :h:

Well, if they clicked a link to get to the page you can use:


$_SERVER['HTTP_REFERER'];

Does this solve your question?

foodpk
May 14th, 2007, 05:24 PM
Yeah, what Seb said, although be absolutely certain that you don't use the referer header for security purposes, because it's about the easiest thing to circumvent. It should never be trusted and is to be used in a purely informational manner.
Every script kiddie gets a boner when he sees someone using that as security, haha!

simplistik
May 14th, 2007, 05:30 PM
You could write to a session... if the page finds the specific key from the session then it shows that content... if not it'll redirect to another page.

That's a method I use for mail form thank you pages... so that people can't just go straight to the thankyou.php page for example... they have to submit something first which then stores a code that activates that page.

Seb Hughes
May 14th, 2007, 05:36 PM
@Foodpk: Direct em to pr0n ROFL.

cjj
May 15th, 2007, 02:44 AM
Thanks for the replies! :beam:
I'm not using it for security reasons. Its basically a similar idea to what simplistik uses it for.