Jump to content

spam protecting email addresses


bcamp1973

Recommended Posts

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.

[code]
$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
[/code]

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
Link to comment
Share on other sites

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?
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.