PDA

View Full Version : hiding email address



ThreeDollarBill
October 9th, 2009, 10:58 AM
ok.. can someone tell me if this method of hiding the email address from spam bots will work?
basically, the idea is to create a link, make that link open a new page, and let the new page output the email address...

so there will be 2 files.. "request_email.php" and "print_email.php"

in "request_email.php":

<a href="print_email.php?d=domain&n=myEmailAddress&end=com">The Link</a>in "print_email.php":

<?php
$dm = $_GET['d'];
$nm = $_GET['n'];
$e = $_GEt['end'];
$at = "@";
$dot = ".";

$theAdd = $nm . $at . $dm . $dot . $e;
echo $theAdd; // myEmailAddress@domain.com
?>am i on the right path? or am i being stupid and missing something?

ajcates
October 9th, 2009, 12:42 PM
The spam bot will just follow the link to a correctly outputted email address.

The correct thing todo is leave the email in plain sight and set up good spam filters. No need to mess up the users experience just because you don't want spam.

NeoDreamer
October 11th, 2009, 08:49 PM
Ajcates is right. PHP is not some mystical program that can hide stuff from the webcrawlers. At the end of the day, PHP generates HTML.

Option 1:
Replace your email text with images. Open up Photoshop and type in "name@domain.com" and export it.

Option 2:
Write your emails in such a way that it'll confuse the crawlers.

nameATdomainDOTcom
name {at} domain [no spam] com

simplistik
October 12th, 2009, 12:11 AM
You can obfuscate the email address. Wordpress has a nice function: http://codex.wordpress.org/Function_Reference/antispambot which is located in
/wp-includes/formatting.php

Here are the functions you'll need to get it to work standalone:


function zeroise($number, $threshold) {
return sprintf('%0'.$threshold.'s', $number);
}

function antispambot($emailaddy, $mailto=0) {
$emailNOSPAMaddy = '';
srand ((float) microtime() * 1000000);
for ($i = 0; $i < strlen($emailaddy); $i = $i + 1) {
$j = floor(rand(0, 1+$mailto));
if ($j==0) {
$emailNOSPAMaddy .= '&#'.ord(substr($emailaddy,$i,1)).';';
} elseif ($j==1) {
$emailNOSPAMaddy .= substr($emailaddy,$i,1);
} elseif ($j==2) {
$emailNOSPAMaddy .= '%'.zeroise(dechex(ord(substr($emailaddy, $i, 1))), 2);
}
}
$emailNOSPAMaddy = str_replace('@','@',$emailNOSPAMaddy);
return $emailNOSPAMaddy;
}


to use it all you'd do is:



antispambot('youremail@email.com');


it will display as 'youremail@email.com' but the source, which is what bots see, will be randomly obfuscated to make it harder for bots to figure it out.

I know lots of ppl who do:


Option 2:
Write your emails in such a way that it'll confuse the crawlers.

nameATdomainDOTcom
name {at} domain [no spam] com


and it does work pretty well, the only downside that I've found is that it also confuses potential clients, crazy ... i know :lol: