Page 1 of 1

Referring URL check

Posted: Mon Oct 30, 2006 6:45 pm
by SommerNyte
I have a page on mysite.com (not the real URL, obviously) that I allow my members to link to to promote services. When they link to mysite.com/page.php, it is passed like this:

http://www.mysite.com/page.php?user=bob

The script on the page checks the username "bob" against the database to make sure bob is a member in good standing, and if he is, the page loads and has his contact info on it. Yay.

However, I also need to make it so that the page can ONLY be loaded if linked from bobssite.com

From what I have read, using http_referer is not very useful, and .htaccess is the way to go. The problem is that the databse is constantly changing as to who is an active member, etc. So I either need a php snippet that can check the referer and ONLY load the page is the refering URL matches what's in the DB for the user, or some script that could automatically update my htaccess file every time member info is changed in the DB.

Could someone help me? :)

Posted: Mon Oct 30, 2006 8:12 pm
by feyd
$_SERVER['HTTP_REFERER'] may be of interest, however it is extremely unreliable as it's up to the requesting client whether to send the header or not.