{NOSPAM_EMAIL} Replacement Tag

Post custom hacks and enhancements for phpwcms here only. Maybe some of these things will be included in official release later.
goshen
Posts: 42
Joined: Mon 4. Oct 2004, 10:57
Location: Geelong, Australia
Contact:

Post by goshen »

Hi,

This mod looks great, but just need a little help.

I have placed the code inside a few file in the Frontend_render folder, and used the following tag inside a Content Part:

{NOSPAM_EMAIL:mail@kitepower.com.au}

It displays on the page fine, but when a user clicks on it (which opens their email program), the address is displayed as:

mail<span>@</span>kitepower<span>.</span>com<span>.</span>au

Is there something wrong that I have done? When a user 'Mouse Overs' the email link, what should they see the Status Bar of the browser?

Thanks in advance.
http://www.kitepower.com.au/news (phpWCMS v1.1)
http://www.gkhome.net (phpWCMS v1.21 DEV)
User avatar
marcus@localhorst
Posts: 815
Joined: Fri 28. May 2004, 11:31
Location: localhorst
Contact:

Post by marcus@localhorst »

mmmh, strange take a look here:
http://www.fieldmuzick.net/fieldcontent/contact.phtml
in thunderbird, the real mailadress will included, the output in sourcecode should look like this:

Code: Select all

<a href="mailto:%6D%61%69%6C%40%61%64%72%65%73%73%2E%74%6C%64">mail<span>@</span>adress<span>.</span>tld</a>
on mouse over, you will see
mailto:%6D%61%69%6C%40%61%64%72%65%73%73%2E%74%6C%64 in the statusbar...

i tried it with your adress with the code which starts the topic and it works?! :-(
goshen
Posts: 42
Joined: Mon 4. Oct 2004, 10:57
Location: Geelong, Australia
Contact:

Post by goshen »

It's working fine now. Thanks for the extra info (although I don't know what I was doing wrong).
http://www.kitepower.com.au/news (phpWCMS v1.1)
http://www.gkhome.net (phpWCMS v1.21 DEV)
Statocast3r
Posts: 31
Joined: Sun 27. Feb 2005, 10:50

Post by Statocast3r »

What should the file uploaded in folder frontend_render be named as?
Visit my handheld gaming site on http://www.handheld-gamers.com/
User avatar
marcus@localhorst
Posts: 815
Joined: Fri 28. May 2004, 11:31
Location: localhorst
Contact:

Post by marcus@localhorst »

call it like you want! i've got one file basic.php in the frontend_render folder which hold my basic Replacementtags/functions.

greetings marcus
User avatar
nekket
Posts: 613
Joined: Tue 18. Nov 2003, 15:46
Location: Baden-Baden
Contact:

Post by nekket »

I love this mod but it doesn't work in the current release... any solutions?
User avatar
marcus@localhorst
Posts: 815
Joined: Fri 28. May 2004, 11:31
Location: localhorst
Contact:

Post by marcus@localhorst »

any error?
it works for me on the newest version.
turn on frontend_end folder?

greetings marcus
User avatar
nekket
Posts: 613
Joined: Tue 18. Nov 2003, 15:46
Location: Baden-Baden
Contact:

Post by nekket »

Same problem like here (goshin)
goshen wrote:Hi,

This mod looks great, but just need a little help.

I have placed the code inside a few file in the Frontend_render folder, and used the following tag inside a Content Part:

{NOSPAM_EMAIL:mail@kitepower.com.au}

It displays on the page fine, but when a user clicks on it (which opens their email program), the address is displayed as:

mail<span>@</span>kitepower<span>.</span>com<span>.</span>au

Is there something wrong that I have done? When a user 'Mouse Overs' the email link, what should they see the Status Bar of the browser?

Thanks in advance.
User avatar
marcus@localhorst
Posts: 815
Joined: Fri 28. May 2004, 11:31
Location: localhorst
Contact:

Post by marcus@localhorst »

how looks the rendered link?

i get this:

Code: Select all

<a href="mailto:%6D%75%7A%69%63%6B%40%6E%61%75%7A%65%6D%75%7A%69%63%6B%2E%6E%65%74">muzick<span>@</span>nauzemuzick<span>.</span>net</a>
with this code:

Code: Select all

/******************************************** 
titel:          {NOSPAM_EMAIL} Replacement-Tag 
description:    {NOSPAM_EMAIL:mail@adress.tld} 
                this tag will encode your emailadress to hexcode 
                        the output looks like this: 
                        <a href="mailto:%6D%61%69%6C%40%61%64%72%65%73%73%2E%74%6C%64">mail<span>@</span>adress<span>.</span>tld</a> 
notice:         these two vars replace @ and . with the chars you prefer like this: mail (at) adress (dot) tdl 
                $ats = "(at)"; 
                        $dots = "(dot)"; 
                         
                        look at this too: 
                        http://www.phpwcms.de/forum/viewtopic.php?t=4819 
                
author:         Marcus Obst 
last modified:  26.01.2005 created 
********************************************/ 
function no_spam($mail='') { 
// these vars replace the @s and dots 
$ats = "<span>@</span>"; 
$dots = "<span>.</span>"; 

      $str = "";          
      $a = unpack("C*", $mail); 
      foreach ($a as $b) 
         $str .= sprintf("%%%X", $b); 
             $enc_mail = str_replace("@",$ats,$mail); 
             $enc_mail = str_replace(".",$dots,$enc_mail); 
             //here the link is rendered
             $str = "<a href=\"mailto:" . $str . "\">" . $enc_mail . "</a>"; 
      return $str; 
   } 

if( ! ( strpos($content["all"],'{NOSPAM_EMAIL')===false ) ) { 
  $content["all"] = preg_replace('/\{NOSPAM_EMAIL:(.*?)\}/e','no_spam("$1");',$content["all"]); 
} 

// -------------------------------------------------------------
here is the output:
http://sser540.lw-s13.sserv.de/contact.phtml
User avatar
nekket
Posts: 613
Joined: Tue 18. Nov 2003, 15:46
Location: Baden-Baden
Contact:

Post by nekket »

Hi,

This mod looks great, but just need a little help.

I have placed the code inside a few file in the Frontend_render folder, and used the following tag inside a Content Part:

{NOSPAM_EMAIL:mail@kitepower.com.au}

It displays on the page fine, but when a user clicks on it (which opens their email program), the address is displayed as:

mail<span>@</span>kitepower<span>.</span>com<span>.</span>au

Is there something wrong that I have done? When a user 'Mouse Overs' the email link, what should they see the Status Bar of the browser?

Thanks in advance.

My solution:

i had a "mailto"-link in my wysiwyg editor... so there was a link in the source code.... this was the problem... just remove the link and it should work properly...
User avatar
StudioZ
Posts: 802
Joined: Fri 28. May 2004, 19:57
Location: Québec, Canada
Contact:

Post by StudioZ »

Hi Marcus !

Is there any chance that your awesome
Replacement Tag could be used also
to protect the recipient: field
in the email form generator and
email contact form content parts?
That would be so great! :P

Cheers,
Image
PhpWCMS Evangelist, -- iRoutier.com Running phpWCMS 1.4.2, r354 -> Great Version!!!!
User avatar
marcus@localhorst
Posts: 815
Joined: Fri 28. May 2004, 11:31
Location: localhorst
Contact:

Post by marcus@localhorst »

I've update the tag to use it with individual link text like or not.
Both Tags are possible:
{NOSPAM_EMAIL:mail@adress.de}
{NOSPAM_EMAIL:mail@adress.de:write email}

see start post.
greetings marcus
Buletti
Posts: 43
Joined: Tue 27. Sep 2005, 10:51
Location: Hamburg / Berlin / Germany

Google and friends

Post by Buletti »

Hi folks,
i recognized that this nospam replacemant works fine, but in the google cache the email is show in the "right" way.

Means that the "max@mustermann.de" adress has been "fotographed".

Maybe this is a way for spiders to catch the adresses...
User avatar
marcus@localhorst
Posts: 815
Joined: Fri 28. May 2004, 11:31
Location: localhorst
Contact:

Post by marcus@localhorst »

thanks for the info.
i don't know that.
what is the best way to hide e-mails for spam?
maybe to have no email adresses :-)


:cry:
Nik2004
Posts: 132
Joined: Mon 9. Aug 2004, 14:31
Location: Athens,Greece

Post by Nik2004 »

Installed it in v1.3.3 and it works.

However, when I click the generated email address in the page using IE 7, I get the message "Could not perform this operation because the default mail client is not properly installed" and the mail composition window does not pop up. I am using Thunderbird 2.0.0.6. Also, I see that the email address hyperlink in IE 7 is (when I put the mouse pointer over it, or when I right-click and do "Copy Shortcut"): "mailto:unborn%40unborn.gr". So, the @ symbol does not get generated as it should.

Any suggestion?

Everything works fine from Firefox 2.0.0.6.

Also: Any fix for the problem mentioned above (that google "photographs" emails)?
Post Reply