scramble emailaddress

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
clonemaster
Forum Newbie
Posts: 12
Joined: Sun Aug 02, 2009 1:10 pm

scramble emailaddress

Post by clonemaster »

Hi,
I have a form for a guestbook, where visitors of the website can leave a message, including their emailaddress.
All input is written to a txt file which is displayed on the page where the form is.
Is there a way to display the emailadress funtional but not readable for spambots?
This is the code that read the txt file:

Code: Select all

<?
          $gastenboek=array_reverse($gastenboek);
          for ($i=$start;$i<$start+$amount && $i<sizeof($gastenboek);$i++) {
            list($name,$email,$date,$url,$message)=explode('|||',$gastenboek[$i]);
            $message=str_replace('{{',"\n",$message);
            echo '<TR><TD><B>'.($email!=""?'<A href="mailto:'.$email.'">'.$name.'</A>':$name).'</B></TD><TD align="right"><B>'.$date.'</B></TD></TR>'."\n";
            echo ($url!=""?'<TR><TD colspan="2"><A href="'.$url.'" target="_blank">'.$url.'</A></TD></TR>':'')."\n";
            echo '<TR><TD colspan="2"><SPAN>'.str_replace("\n",'<BR>',htmlspecialchars($message)).'</SPAN></TD></TR>'."\n";
            echo '<TR><TD colspan="2"><HR></TD></TR>'."\n";
          }
        ?>
Thanks for helping out :bow:
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: scramble emailaddress

Post by requinix »

Apparently you didn't preview your post before submitting it. Check your code: that look right?
Use

Code: Select all

 tags instead of [php]. There's a "PHP Code" button for you to use as well.

The term is "obfuscation", as in the phrase "[url=http://www.google.com/search?q=obfuscate+email+address]obfuscate email address[/url]".
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: scramble emailaddress

Post by John Cartwright »

tasairis wrote:Apparently you didn't preview your post before submitting it. Check your code: that look right?
Use

Code: Select all

 tags instead of [php]. There's a "PHP Code" button for you to use as well.

The term is "obfuscation", as in the phrase "[url=http://www.google.com/search?q=obfuscate+email+address]obfuscate email address[/url]".[/quote]

Fixed.

Also see http://www.csarven.ca/hiding-email-addresses
clonemaster
Forum Newbie
Posts: 12
Joined: Sun Aug 02, 2009 1:10 pm

Re: scramble emailaddress

Post by clonemaster »

Now that's the reply I was waiting for !
Thank you so much for pointing this out for me.
I wasn't aware of those tags..
Phew... imagine how I must feel now.

:crazy:

Thought this was a forum where people helped eachother with coding questions..
Must be my mistake..
Post Reply