Worked on this a bit tonight, thought it might help someone out there! I
looked at the bottomw of phpclasses.org at what they'd done to obfuscate
their e-mail address using JavaScript. While theirs is much more complex, I
couldn't figure a way to do it their way when you don't know the exact
user@domain of people in your database. I thought this might do the trick,
at least to some extent, by separating the user and domain in the source
code and not put them together until the mailto: link is clicked. Sorry if
something like this has been posted before - if so, here it is again! :)

<script language="JavaScript">
<!--
<?php

        $email = "[EMAIL PROTECTED]";    //replace with e-mail addy from db
        $new_email = explode("@", $email); //separate into two sections based on
the "@"

        print "function hide_me()\n";
        print "{\n";
        print "var usr= '$new_email[0]';\n"; //the user of user@domain
        print "var dom= '$new_email[1]';\n"; //the domain of user@domain

        print "window.location=\"mailto:\"+usr+\"@\"+dom;\n";; //print JS to
recombine the parts
        print "}\n";
?>
//--!>
</script>
<a href="javascript:hide_me()">E-mail me</A>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to