Referer Check

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Joe
Forum Regular
Posts: 939
Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow

Referer Check

Post by Joe »

I have been trying to make up a script which checks the referer to see if its being sent from the sendmsg.php page. If not an error message will be displayed informing the user, otherwise the process will continue. I used this a while back but I just cant seem to remember what I used. Can anyone help me please. Im not looking for a long code just the function which is used for referer checking.

Regards


Joe 8)
Unipus
Forum Contributor
Posts: 409
Joined: Tue Aug 26, 2003 2:06 pm
Location: Los Angeles, CA

Post by Unipus »

that's $_SERVER["HTTP_REFERER"], and it's listed on this page along with all the other server vars:

http://www.php.net/reserved.variables

I'd recommend you come up with another way to do this, though, it sounds like it would be prone to problems/spoofing.
User avatar
Joe
Forum Regular
Posts: 939
Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow

Post by Joe »

Yes, It your right that I could be prone to spoofing with something such as Curl or Z-Spoof but I have also made a part which checks the users cookie and Session ID. I know thats not much but its extra security.

Regards and Thanks for that!


Pr0zaK 8) I'll take on the world. Will they take on me?
User avatar
werlop
Forum Commoner
Posts: 68
Joined: Sat Mar 22, 2003 2:50 am
Location: /dev/null

Post by werlop »

Hi, I have given up using referrers as some fire walls (eg Norton Personal Firewall) block the referrer data. Ostensibly Norton changes it to "refewer".
User avatar
phice
Moderator
Posts: 1416
Joined: Sat Apr 20, 2002 3:14 pm
Location: Dallas, TX
Contact:

Post by phice »

Yet another reason why I choose not to use any firewalls.
Image Image
Post Reply