Topic: hide email

I got a old forum with plenty of email in the posts. I would like to use the mod : Spam Protect Email 1.0.0 http://punbb.org/forums/viewtopic.php?id=6208 to "code" all the email adresses in viewtopic and post ... How should I process ?

Tx

Re: hide email

Just install the mod. It will "spam protect" any e-mail addresses it displays.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: hide email

Of course not !

"spam protect" just "encrypted" email adresses inside bbcode [ email ]. Not the ones which are outside bbcode

My problem is : I tranfert my own system archive list (full of email) in punBB this is OK but I will like too "encrypt" the emails ... I think it should be easy with this mod to do it for post.php and viewtopic.php, but i couldn't manage to do it

Re: hide email

Aha, I see. Well, it shouldn't be all that difficult to extend the mod. A few more lines and the mod could detect e-mail addresses and encrypt them. It's not my mod though, so you'd have to ask the author.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

5 (edited by Dexus 2005-04-11 20:56)

Re: hide email

just add (+) line into parser.php->do_clickable simple version of mail (without any special chars):

    $text = preg_replace('#([\s\(\)])(https?|ftp|news){1}://([\w\-]+\.([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^"\s\(\)<\[]*)?)#ie', '\'$1\'.handle_url_tag(\'$2://$3\')', $text);
    $text = preg_replace('#([\s\(\)])(www|ftp)\.(([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^"\s\(\)<\[]*)?)#ie', '\'$1\'.handle_url_tag(\'$2.$3\', \'$2.$3\')', $text);
+    $text = preg_replace('#((mailto:)?([\w\d][\w\d$.-]*[\w\d]@[\w\d][\w\d.-]*[\w\d]\.[a-z0-9]{2,5}))#ie', 'handle_email_tag(\'$3\')', $text);

after that all mail-like URLs will be hot-linked, and automaticly crypted by this method (handle_email_tag)

Re: hide email

It's work ...

Many thanks !!!

Re: hide email

druvans
that`s exactly what I mean ! but instead of email at right should by profile id for example smile but this is small changes...

can you send me a copy of it to http://www.gotoguide.org/email.php?rightText=aleksei.zaitsev@gmail.com please.

edit: find this one

 <?php
$temp=$_GET["w"];
$order=$_GET["r"];
$color=$_GET['color'];
$font=4;
if (isset($color))
{
$color = str_replace('#','',$color);
$rgb = array('r' => hexdec(substr($color,0,2)),
             'g' => hexdec(substr($color,2,2)),
             'b' => hexdec(substr($color,4,2)));
}
else
 
$rgb = array('r' => 0,
             'g' => 150,
             'b' => 0);
 
 
if (isset($order))
 $temp=implode('~',array_reverse(split('~',$temp)));
 
 
$mail=preg_replace('/~/','@',$temp,1);
$mail=str_replace('~','.',$mail);
 
$width=ImageFontWidth($font)*strlen($mail);
$height=ImageFontHeight($font);
$im = imagecreate($width, $height);
$bg = imagecolorallocate($im, 255, 255, 255);
imagecolortransparent($im,$bg);
imagefill($im,0,0,$bg);
$textcolor = imagecolorallocate($im, $rgb[r], $rgb[g], $rgb[b]);
imagestring($im, $font, 0, 0, $mail, $textcolor);
header("Content-type: image/png");
imagepng($im);
?>

Re: hide email

Here u go.

http://www.gotoguide.org/email.zip

both php file and the reqiuired png file

9 (edited by druvans 2005-04-13 04:54)

Re: hide email

I wrote a smaller program to do the same, This can be included as a bbcode tag, I need to figure out how to it

<?php
/***********************************************************************
Druvan (druvan@gmail.com)
Use it anyway you want it.
************************************************************************/

function imagize($email){
header("Content-type: image/png");
$fontsize=4;
// Create the image
$im = @imagecreatetruecolor( strlen($email)*8, 15 ) or die( "Cannot Initialize new GD image stream" );
imagefilledrectangle( $im, 0,0,strlen($email)*8, 15, ImageColorAllocateHex( $im,'FFFFFF' ) );

// Create some colors
$color = imagecolorallocate($im, 125,  125,125);
// write the string at the top left
imagestring($im,$fontsize=3, 0, 0, $email, $color);


// Using imagepng() results in clearer text compared with imagejpeg()

return imagepng($im,"email.png");
//imagedestroy($im);
}
  
// Parse an RGB value
function getRGB( $hex )
{
    for( $i = 0; $i < 3; $i++ )
    {
        $temp = substr( $hex, 2 * $i, 2 );
        $rgb[$i] = 16 * hexdec( substr( $temp, 0, 1 ) ) + hexdec( substr( $temp, 1, 1 ) );
    }
    return $rgb;
}

// Allocate a GD color
function ImageColorAllocateHex( $image, $hex )
{
    $rgb = getRGB( $hex );
    $rgb = ImageColorAllocate( $image, $rgb[0], $rgb[1], $rgb[2] );
    return $rgb;
}

?> 
    <span>Mail to:<?php imagize("druvan@gmail.com"); ?><img src="email.png"/></span></h2>

I revised the script

Re: hide email

It creates a very small png file, the file names needs to be fixed to make it unique per email id.