Jump to content


Photo

spam protecting email addresses


  • Please log in to reply
3 replies to this topic

#1 bcamp1973

bcamp1973
  • Members
  • PipPipPip
  • Advanced Member
  • 133 posts

Posted 28 October 2006 - 03:54 PM

I'd like to create a function that detects email addresses in text and rewrites them so they're spam proof.  has anyone done this?  has it been effective for you?  how did you go about it?

#2 Janus13

Janus13
  • Members
  • PipPipPip
  • Advanced Member
  • 54 posts

Posted 28 October 2006 - 04:02 PM

I haven't done it but you should be able to do it fairly simple.  For example if you wanted to add the email address joe@poolhall.com, and you wanted to spam protect it by adding NOSPAM in the middle you could do something like an explode on the text string of the post variable of the email address text box.

$email = $_POST['email']; //posted address is joe@poolhall.com
$split = explode('@', $email); //splits the email address at the @ symbol of the address
$email = $split[0] . "NOSPAM@" . $split[1]; //$email now equals joeNOSPAM@poolhall.com

This seems a simple way to do it.  You could also put some checks to make sure the original email address is a valid formatted email address as well.  Hope this is somewhat helpful!

Jonathon

#3 bcamp1973

bcamp1973
  • Members
  • PipPipPip
  • Advanced Member
  • 133 posts

Posted 29 October 2006 - 12:07 AM

sorry, i didn't explain myself well enough :)  my goal is to have the email address show up on a web page so it remains readable to the viewer.  So they would see something like, "Please contact support@whatever.com if you have issues with this website", but in the code the address needs to be encoded so the spambots can't read it.  does that make sense?

#4 pendelton

pendelton
  • Members
  • PipPip
  • Member
  • 20 posts
  • LocationUK

Posted 29 October 2006 - 12:30 AM

If you write the e-mail to the page in its standard format then the spam bots will also read it. You could write code to output the e-mail address as an image using the PHP image processing and creation functions.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users