Was wondering - how do you obfuscate the e-mail addresses on your pages? I found some really nice ideas over here: http://techblog.tilllate.com/2008/07/20 ... -compared/ ..but that does not cover wrapping the e-mail address in an anchor (mailto:example@example.com).. So how do you do this?
I was actually looking for a non-javascript solution.
There really is no solution, especially without javascript and even then there are all sorts of accessibility issues. I recommend people use a contact form and if they insist on having a 'mail to' link I just warn them to expect lots of spam. Whatever you do the spammers will always be one step ahead.
I'm a hack when it comes to PHP. I understand what's going on with the code here but can you explain "sanitize the shit out of those variables" please?
I'm a hack when it comes to PHP. I understand what's going on with the code here but can you explain "sanitize the shit out of those variables" please?
thx -Michael
The PHP code from above takes GET variables and uses them to execute a bit of code, but because GET variables are very easy to manipulate you should always limit the input possibilities ('sanitizing'). This security thingie is similar to SQL injection (the Wikipedia article explains more)
@danilolee: There are crawlers/bots out there that can read out ASCII characters...
@mattvot: your PHP solution sounds like something, but I'll have to keep looking for a non-PHP solution as some of my clients have a hosting provider that does not support php :-/. I like your idea of the web app, I'd be glad to help you set up something for that. Just shoot me a PM.
Was wondering - how do you obfuscate the e-mail addresses on your pages? I found some really nice ideas over here:
http://techblog.tilllate.com/2008/07/20 ... -compared/
..but that does not cover wrapping the e-mail address in an anchor (mailto:example@example.com).. So how do you do this?
I was actually looking for a non-javascript solution.
Regards,
-H
I recommend people use a contact form and if they insist on having a 'mail to' link I just warn them to expect lots of spam.
Whatever you do the spammers will always be one step ahead.
Maybe so. I just thought of this now, tested it and it works
Make an anchor link go to something like http://in.com/email.php and in that have the address code:
You could even get adventurous:
and make the anchor link hit http://in.com/email.php?f=mattvot&d=domain&t=.com
Here's a more compressed version of the code above to reduce file size:
<?php header('Location:mailto:'.$_GET[\"f\"].'@'.$_GET[\"d\"].$_GET[\"t\"].'');?>So your final HTML markup would look something like this:
Or even:
1. I utilize this CSS class (below) which reverts the orientation of the content from right to left.
.email {unicode-bidi: bidi-override;
direction: rtl;
}
2. Then, I convert ASCII characters to Unicode at http://www.mikezilla.com/exp0012.html
3. The final code looks like:
I'm a hack when it comes to PHP. I understand what's going on with the code here but can you explain "sanitize the shit out of those variables" please?
thx
-Michael
The PHP code from above takes GET variables and uses them to execute a bit of code, but because GET variables are very easy to manipulate you should always limit the input possibilities ('sanitizing'). This security thingie is similar to SQL injection (the Wikipedia article explains more)
@danilolee: There are crawlers/bots out there that can read out ASCII characters...
@mattvot: your PHP solution sounds like something, but I'll have to keep looking for a non-PHP solution as some of my clients have a hosting provider that does not support php :-/.
I like your idea of the web app, I'd be glad to help you set up something for that. Just shoot me a PM.
You can use this PHP function I wrote to convert to ascii.
<?php
# http://bcdc.us
function mailacsii($name, $domain, $link=NULL) {
$email = $name . '@' . $domain;
if (!$link): $link = $email; endif;
foreach (str_split($email) as $obj)
{
$ascii .= '&#' . ord($obj) . ';';
$output = '<a href="mailto:' . $ascii . '">'. $link .'</a>';
}
return $output;
}
?>
<html>
<!-- usage examples -->
example a) <?php echo mailacsii('hello', 'world.com', 'Send Email'); ?><br />
example b) <?php echo mailacsii('hello', 'world.com'); ?>
</html>