PX : code

Anti-leech bandwidth protector by Corey Milner
Rating: 5.00
Download this code


<?

               /* Anti-leech bandwidth protector by Corey Milner, http://www.odey.com. 
               Turn the refererring URL into a variable */
$from = getenv("HTTP_REFERER");

               /* Check to see if the URL in the variable is a valid referrer.               Add the page URL which you would like people to arrive from here.                */
if ($from != "http://www.yoursite.com/validpage.htm")

               /* If the URL is valid, page loads now */

               /* If URL is invalid the following error message and proper link                appears, enter your custom error message and a hyperlink to the                valid URL you entered above here*/
{print(" Sorry you have tried to link to a page which does not accept visitors directly. <br>
<a href=http://www.yoursite.com/validpage.htm>CLICK HERE</a> to enter");

               /* Prevent the rest of the page from loading */
exit;}

?>

Comments or questions?
PX is running PHP 5.2.17
Thanks to Miranda Productions for hosting and bandwidth.
Use of any code from PX is at your own risk.