• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Just quickly - parsing HTML to secure eMail addresses?

Hey fella's, have had a hunt around for the answer to this question, I know I've seen it somewhere before but can't find it now when I need it...

Simply, it's the ability to parse a whole chunk of HTML and strip out and secure/obfuscate an eMail addresses present in that HTML block....

Can someone please tell me the name of the helper / class that does this?



[eluser]CI Lee[/eluser]
As in takes entry from a form field and encodes it using something like Hivelogic's Enkoder?

not sure, will look that up - I was under the impression there was a function/helper etc that would read in my page HTML from my DB table [or any source] and replace any mailto: tags with an obfuscated version...maybe I dreamt about it...not sure, but it's intended to allow ordinary everyday people to plant email addresses all over their own sites thru the CMS I've built without having to think about it...if not I'm sure I can work one out, just thought I'd read it in the user manual but I've scoured that like a gazillion times and can't find it.

Cheers tho


You can replace parts of the string if that is what you want
$page = str_replace('@',' replace with at character ',$page);
To get the mailto working again you could reverse your replacements with javascript it they click on it

I dont believe there is a helper for what you want, HOWEVER! hunting google there is a code example in the php documentation which looks like exactly what you need!!

[url="http://uk3.php.net/preg_match_all"]PHP EXAMPLE (written/posted by aaron at parecki dot com)[/url] (serach for obfuscate)

[eluser]Derek Allard[/eluser]

sorry for the misinfo Sad

[eluser]Derek Allard[/eluser]
Not misinfo at all! Its great to have several different approaches. Mine is just an alternative... and there are lots of good ways. The problem with the CI one is that it relies on javascript to work... which I don't like, and don't use.

Alistapart.com has an article now called Graceful E-Mail Obfuscation which I think is kind of overkill, but does present other options nicely.

Alistpart solution requires javascript also. ><

I am thinking about making a captcha function/class like google uses in groups.google.com.

[eluser]Derek Allard[/eluser]
The list apart one has non-js solutions in there also, but I agree they are needlessly complex for most needs.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.