Welcome, Guest. Please login or register.
January 06, 2009, 03:27:41 AM

Login with username, password and session length
Search:     Advanced search
Website Baker 2.7.0 (stable) released!
For more information look here.
The announcement board can be found here.
71093 Posts in 11245 Topics by 6867 Members
Latest Member: sababa
* Home Help Search Login Register
+  Website Baker Community Forum
|-+  English
| |-+  Help/Support (Moderators: Argos, ruebenwurzel, BerndJM)
| | |-+  Embedding Anti-spam email link obfuscator
Pages: [1] Go Down Print
Author Topic: Embedding Anti-spam email link obfuscator  (Read 807 times)
Hans
Master Baker
*****
Offline Offline

Posts: 370


Email
« on: February 26, 2007, 09:00:49 PM »

I really don't know if it helps, but it will prevent some spambots at least I hope.
I want to embed this code into a contact page. I pasted it in a wysiwyg page and it works fine, but when I go and edit the page again, the code disappears.
So I think it has to be placed in a code page, and of course I tried that by echo ' <code> ';
But that doesn't work.
I hope there is a solution for it.
Here's the code:
Code:
<script type="text/javascript" language="javascript">
<!--
{ coded = "5OSQjFZ95t@HuZ9M.Oh"
  key = "48TalNouG9wWzKbmRrxiksZh1QCfnUPvBeFXjI56M37y2DSOpJcVtALgEH0Ydq"
  shift=coded.length
  link=""
  for (i=0; i<coded.length; i++) {
    if (key.indexOf(coded.charAt(i))==-1) {
      ltr = coded.charAt(i)
      link += (ltr)
    }
    else {     
      ltr = (key.indexOf(coded.charAt(i))-shift+key.length) % key.length
      link += (key.charAt(ltr))
    }
  }
document.write("<a href='mailto:"+link+"'>stuur me dan een mailtje.</a>")
}
//-->
</script><noscript>Sorry, you need Javascript on to email me.</noscript></p>
.
Oh b.t.w. it's from here:
http://www.jottings.com/obfuscator.htm
Logged

Hans - Nijmegen - The Netherlands
kweitzel
Forum Team
A Baker's Baker
*****
Offline Offline

Posts: 4528


WWW
« Reply #1 on: February 26, 2007, 09:04:40 PM »

The issue lies within the wysiwyg editors, which do sanitise the code. What possible solutions do you have ...

1) put code into a codepage and echo every single line (have fun dowing that)
2) put the code into a HTML page and use include in a codepage/section to load the page (not shure if this will work though).
3) use cURL to inculde the HTML page if include is not active on your host.
4) last but not least just put the code into your template ... (do-oh)

Hope one of them works for you.

cheers

Klaus
Logged

marathoner
Geek-Like Baker
*****
Online Online

Posts: 414


« Reply #2 on: February 26, 2007, 09:10:32 PM »

Another possible solution would be to modify the form module code so that the email address is within the code of the module and is not listed on the contact page.

I haven't done this but have thought about modifying the form module so that on the contact page I could allow the user to select who to send the email to (i.e. sales, marketing, accounting, webmaster) and then the module would use a table to associate the proper email address for each of these possible addressees to send the email. This prevents the email address from appearing in the contact page and also gives the user more control over where the email is sent to. Has anyone done this?
Logged
doc
Addons Team
A Baker's Baker
******
Offline Offline

Posts: 2497

Never mind!!!


« Reply #3 on: February 26, 2007, 09:13:53 PM »

Hello Hans,

code does not work on WYSIWYG pages. So add a code page as additional section and place the code their. As you need ot output the whole Javascript within PHP, try the following code:
Code:
$js_text = <<< EOS
<script type="text/javascript" language="javascript">
<!--
{ coded = "5OSQjFZ95t@HuZ9M.Oh"
  key = "48TalNouG9wWzKbmRrxiksZh1QCfnUPvBeFXjI56M37y2DSOpJcVtALgEH0Ydq"
  shift=coded.length
  link=""
  for (i=0; i<coded.length; i++) {
    if (key.indexOf(coded.charAt(i))==-1) {
      ltr = coded.charAt(i)
      link += (ltr)
    }
    else {     
      ltr = (key.indexOf(coded.charAt(i))-shift+key.length) % key.length
      link += (key.charAt(ltr))
    }
  }
document.write("<a href='mailto:"+link+"'>stuur me dan een mailtje.</a>")
}
//-->
</script><noscript>Sorry, you need Javascript on to email me.</noscript></p>
EOS;

echo $js_text;

Regards Christian

[Edit]
Code:
$js_text = <<< EOS ... EOS;
is a so called heredoc syntax and can be used to output long strings
« Last Edit: February 26, 2007, 09:19:16 PM by doc » Logged
Hans
Master Baker
*****
Offline Offline

Posts: 370


Email
« Reply #4 on: February 26, 2007, 09:43:03 PM »

Thanks Klaus,  and Christian!
I tried the solutions offered by Klaus, but either they didn't work or it was not possible to implement them.
The solution offerd by Christian worked.
@ marathoner: modifying the form module is way byond my skills, as you'll understand from my posting, but I hope this is a way to hide an emailaddress in the form.
Thanks again
Hans
« Last Edit: February 26, 2007, 09:49:26 PM by Hans » Logged

Hans - Nijmegen - The Netherlands
Pages: [1] Go Up Print 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!