Good afternoon everyone. I borrowed this code from another site. I hope that wasn’t illegal. Anyway, I want to check to see where a certain page is being accessed from and if it isn’t from one specific page then I want to redirect to that specific page. I got the below for checking on where the person is coming from but how do I make them go back to that specific page. For instance they try to access http://domain.com/page1.html from somewhere else by direct linking to it, instead of coming from http://domain.com/page.html. How do I redirect them back to http://domain.com/page.html to force entry from that page? There is nothing being protected or anything I don’t want seen. I want to force them to read something and agree to it before accessing page1.html
Any help is appreciated!
<?php
// This is to check if the request is coming from a specific URL
$ref = $_SERVER['HTTP_REFERER'];
if($ref !== 'http://domain.com/page.html') {
die("Hotlinking not permitted");
}
echo "Executing code here";
?>