Welcome, guest | Sign In | My Account | Store | Cart

Adding few lines of code will kick out the spammer by detecting that the URL of the referrer is not the URL of the form.

Python, 5 lines
1
2
3
4
5
import os
FormURL = 'http://example.tld/contact.html'

...
if os.environ['HTTP_REFERER'] !=  FormURL: return

Spammers highjack your contact form to automatically submit automated messages through your email script. This code will prevent that.

Created by Davide Andrea on Wed, 26 Dec 2007 (PSF)
Python recipes (4591)
Davide Andrea's recipes (2)

Required Modules

  • (none specified)

Other Information and Tasks