Forum Moderators: coopster

Message Too Old, No Replies

php to hide email from spam harvesters

         

Malachim

12:03 am on Sep 23, 2004 (gmt 0)

10+ Year Member



I have been using javascript to hide email from Spammers bots and a few uglies keep rearing their head...

What if JS is disabled?
JS raises issues with accessibility.
Js can be a begger to validate for XHTML.

I have looked at a few variations on formmail.pl / formmail.php but what I wanted was a simple mailto: for the masses

Here's what I come up with:

<a tabindex="0" href="<?php require 'mail2.php';?><?php require 'yourname.php';?>yourdomain.com<?php require 'subjectline.php';?>">Send us your questions</a>

mail2 pulls in the 'mailto:'
yourname puls in 'youname@'
subjectline (optional really?) calls '?Subject=Feedback_message'

The latter I use with procmailrc to validate. The subject line is either whitelisted, or not. Crude, but when you get a million Spam a month sledgehammers start to look appealing.

What you you reckon?

jatar_k

12:22 am on Sep 23, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld Malachim,

the key to this though is that harvesters are getting the same as client browsers. So what do you see in the browser?

It looks like it will just be a plain link if you view source.

PHP being server side you need something that can hide the address from the client side yet still make it usable, like js.

Timotheos

3:36 am on Sep 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Here's an example of mixing js with php. So if js is enabled the link will popup their email client. If not, then it will go to a standard php mail form.

<a href="mail.php?name=Fred" onmouseover="this.href='mai' + 'lto:' + 'Fred' + '@' + 'example' + '.' + 'com'">Send us your questions</A>

Malachim

8:13 am on Sep 23, 2004 (gmt 0)

10+ Year Member



Thanks jatar_k

the key to this though is that harvesters are getting the same as client browsers.

Really? I always thought they scanned the raw files. How long have they been able to pull in called text?
*mutter*

Timotheos: OK, that works. Nice, Thanks. I really need to play a lot more I guess.

PCInk

9:16 am on Sep 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



They do pull the raw file. Raw HTML, not raw PHP. PHP is server side and the program is run on the server, not at the client or harvester side. The client or harvester gets the commands that you print or echo to the browser - not the source code. This applies to any server side programming language (ASP, PHP, Perl) but not to client side who get the source code and then the client machine runs that code.

One method you can use is to use two email addresses depending on the user_agent variable for known harvesters, known IP addresses or perhaps the contact page could lookup a log file created and give out the junk mail for any IP which has requested pages far too fast to be a real user. You could use emails such as sales@.... and jsales@.... where jsales are automatically deleted at your email server or application you use.

It takes time, but you want all users to get the email address and no harvesters. I am afraid it is an impossible task, but certainly you can reduce the number of harvesters.

jatar_k

4:34 pm on Sep 23, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I use an ascii to unicode converter [google.com]

works pretty well