1
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 = '.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 = '.XOOPS_URL.'/emailprotection.php?uid='.$thisUser->getVar("uid").'">';
$xoopsTpl->assign('user_email', $protectedEmail);
} else {
$xoopsTpl->assign('user_email', ' ');
}
}
}
(explanation: as you can see, I added one new line $protectedEmail = '
';
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)