xoops forums

KubaZ

Just popping in
Posted on: 2005/5/30 12:25
KubaZ
KubaZ (Show more)
Just popping in
Posts: 37
Since: 2002/10/9
#1

Email protection hack in userinfo.php

Hi XOOPS World :)

Few days ago I read in polish magazine the way of protecting emails, simply create image with email address and spam robot's will be unable to read our addresses :)

I've made a little hack to use this protection in my XOOPS service.

DEMO: http://www.kongresruchow.pl/userinfo.php?uid=1

LINK:
http://www.kongresruchow.pl/kuba/xoops/emailprotection.tgz (200kb)


files:
[new] ./emailprotection.php
[new] ./include/arial.ttf
[need to change] ./userinfo.php

requirements:
GD library
Your famous font (I've put only arial.ttf )

To run this hack you will have to change userinfo.php
so Find this code:
if ($thisUser->getVar('user_viewemail') == 1) {
    
$xoopsTpl->assign('user_email'$thisUser->getVar('email''E'));
} else {
    if (
is_object($xoopsUser)) {
         
// All admins will be allowed to see emails, even those that are not allowed to edit users (I think it's ok like this)
        
if ($xoopsUserIsAdmin || ($xoopsUser->getVar("uid") == $thisUser->getVar("uid"))) {
            
$xoopsTpl->assign('user_email'$thisUser->getVar('email''E'));
        } else {
            
$xoopsTpl->assign('user_email'' ');
        }
    }
}


and change it into :

if ($thisUser->getVar('user_viewemail') == 1) {
    
$protectedEmail '<img src="'.XOOPS_URL.'/emailprotection.php?uid='.$thisUser->getVar("uid").'">';
    
$xoopsTpl->assign('user_email'$protectedEmail);
} else {
    if (
is_object($xoopsUser)) {
         
// All admins will be allowed to see emails, even those that are not allowed to edit users (I think it's ok like this)
        
if ($xoopsUser->isAdmin() || ($xoopsUser->getVar("uid") == $thisUser->getVar("uid"))) {
            
$protectedEmail '<img src="'.XOOPS_URL.'/emailprotection.php?uid='.$thisUser->getVar("uid").'">';
            
$xoopsTpl->assign('user_email'$protectedEmail);
        } else {
            
$xoopsTpl->assign('user_email''&nbsp;');
        }
    }
}


(explanation: as you can see, I added one new line $protectedEmail = '<img src="'.XOOPS_URL.'/emailprotection.php?uid='.$thisUser->getVar("uid").'">';
which call our script file 'emailprotected.php'
and change
$xoopsTpl->assign('user_email', $thisUser->getVar('email', 'E')); to $xoopsTpl->assign('user_email', $protectedEmail); to display image

TIPS: You can look into emailprotection.php if you want change color of font, size, etc.

And finally the link ! :
http://www.kongresruchow.pl/kuba/xoops/emailprotection.tgz (200kb)

It weight so much because of size of Arial.tff (stupid MS font)

philou

Quite a regular
Posted on: 2006/9/3 4:33
philou
philou (Show more)
Quite a regular
Posts: 384
Since: 2002/5/6 8
#2

Re: Email protection hack in userinfo.php

very good... but the link is dead for download the emailprotector.php

do you know where we can find it ???
Resized Image - - Resized Image

Rapor

Just popping in
Posted on: 2006/9/3 7:24
Rapor
Rapor (Show more)
Just popping in
Posts: 26
Since: 2006/5/29
#3

Re: Email protection hack in userinfo.php

Download Error

[Error : Błąd]

[404] File Not Found : Plik nie istnieje

.Rar ?

KubaZ

Just popping in
Posted on: 2007/3/12 11:40
KubaZ
KubaZ (Show more)
Just popping in
Posts: 37
Since: 2002/10/9
#4

Re: Email protection hack in userinfo.php

Hi,

today I got a message that link is dead.
Apparently I deleted this because I didnt use XOOPS for a long time.
I will try to repair link, and post a message on forum.

Edit: link works

Cheers
KubaZ