Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k & phranque

Message Too Old, No Replies

Adding referrer check to existing script

6:51 pm on Oct 22, 2009 (gmt 0)

New User

5+ Year Member

joined:Oct 22, 2009
posts: 1
votes: 0

This is my first post here folks so be gentle with me. I am not a PERL guy at all, but I am using a suite a perl scripts (ez scripts if anyone has heard of them) for a simple project I am doing. I have recently hit a streak of spam coming from outside my domain (obviously) Until I can convert my whole system over to php I wanted to at least add a referrer check the the head of the script if possible. This will at least slow down my spamming issue. Is it even possible to add a simple referrer check to the script and if so what would the code look like? Thanks to any help out there!


8:43 pm on Oct 22, 2009 (gmt 0)


WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
votes: 126

welcome to WebmasterWorld [webmasterworld.com], newjay1000!

have you tried checking the ENV hash?

if there is a referrer and it has been set by the user agent and is passed through to the web server then $ENV{HTTP_REFERER} will have that value in your script.

be aware that there are often cases where the request is referred but the referrer is not specified in the request.