Re: protecting email addresses on a web site
| From: | Daniel P. Brown | Date: | Tue, 16 Nov 2010 22:25:49 +0000 |
| Subject: | Re: protecting email addresses on a web site | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-309525@lists.php.net to get a copy of this message | ||
On Tue, Nov 16, 2010 at 16:29, ash@ashleysheridan.co.uk
<ash@ashleysheridan.co.uk> wrote:
> Sorry for top post on phone.
>
> Depending on the type of site and location an email address might be legally required. For
> example, a business website in the UK requires a value email address to be made accessible to all
> your visitors, which includes blind people, so no image-only addresses.
>
> Spam is just a fact of life now, and the only real method of protection is a decent spam
> filter.
<?php
/**
* Just hacked this together for your usage now. It's
* a very basic implementation of a graphical display
* of an email address (or any text, for that matter).
* This can still easily be picked up by harvesters that
* employ OCR, but beggars cannot be choosers. Well,
* they can, but they really shouldn't. I mean, seriously,
* there they are, just hoping and praying for a handout,
* and when it finally comes, they bitch and moan that
* I don't have any apples that didn't fall into the
* sewer and sit there for a week that one time I donated
* food to the food kitchen because I wanted this girl
* to like me but it turned out she was a lesbian so
* I just wasted the gas in the first place and my
* car smelled like homeless people and crap-flavored
* apples for three weeks.
*/
function drawEmail($email) {
/**
* Set the width/height of the image.
*/
$im = imagecreate(220,20);
/**
* Define the colors to be used, using RGB values.
*/
$black = imagecolorallocate($im,0,0,0);
$white = imagecolorallocate($im,255,255,255);
/**
* Fill the image with a chosen color.
*/
imagefill($im,0,0,$white);
/**
* Calculate the text size to be used.
*/
$px = (((imagesx($im) - 7.5) * strlen($string)) / 2);
/**
* Write $email in calculated size with chosen color.
*/
imagestring($im,3,$px,9,$email,$black);
/**
* Output the image.
*/
header("Content-type: image/png");
imagepng($im);
/**
* Garbage clean-up, pass-through the status bool.
*/
return imagedestroy($im);
}
drawEmail('danbrown@php.net');
?>
--
</Daniel P. Brown>
Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting
(866-) 725-4321
http://www.parasane.net/