Jump to content

Display php script only if from referer?


thepassionofchad

Recommended Posts

Sorry, I'm a bit more of a noob than that. I did a little more research, so it goes:

 

<?php

 

if ($_SERVER['HTTP_REFERER']="https://www.link.com"){

include('script.php');

 

}

 

?>

 

-----------------------------------

So if the person comes through link.com, then the page will include script.php?

Yes, but = is the assignment operator, you should be using == to compare things. Also they could probably leave out the "www." and then it wouldn't work. Or put a slash at the end of the URL. So you'll have to check the HTTP_REFERER with those too.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.