1

I have a web page and I need to accept some of visitors if it is just from a spesific page.

For Example: If visitor goes example.com/member to example.com/specific it will ok. But if user goes any other place or just from address bar of browser, It will say "connection failed"

How can I do this with php? Thanks.

Brandon
  • 16,382
  • 12
  • 55
  • 88
Ugur Ozer
  • 49
  • 7

1 Answers1

1

This isn't fool proof though, so don't use it for any authentication or security purpose

<?php
if(strtolower($_SERVER['HTTP_REFERER'])=="http://yourallowedurl.com/etc.html")
{
    echo "OK";
}
else
{
    echo "connection failed";
}
?>

Review This

And This

Note: You might want to create a session for the people who are logged in and allow only those with proper session values set to visit that protected page.

Community
  • 1
  • 1
Hanky Panky
  • 46,730
  • 8
  • 72
  • 95