vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Email, MSN and Yahoo adresses as GD Images (https://vborg.vbsupport.ru/showthread.php?t=83128)

corn 06-14-2005 10:00 PM

Email, MSN and Yahoo adresses as GD Images
 
First of all, I'm not sure if this is a hack or a template mod.
so, if its placed wrong, please advise.
this is my first 'hack', so be nice ;)

My forum members were complaining about the load of spam they received after the emailaddresses were publicly viewable.
We wouldn't use the secure mail function, because the users wanted to see eachothers mail addresses.


Installation:
Create a file called email.php.
It must contain the following lines of code:
Code:

<?php
  header("Content-type: image/png");

########## Email, MSN and Yahoo adresses as GD Images ############
########## Made by Corn for vb.org ##########

  $im    = imagecreatefrompng("email.png");
  $color  = imagecolorallocate($im, 0, 0, 0);
  $px    = (imagesx($im) - 7.5 * strlen($user)) / 2;
  imagestring($im, 4, $px, 1, $user, $color);
  imagepng($im);
  imagedestroy($im);
?>

or use the one attached.

in the attached .zip, you can find a email.png file.
put the files in your forum root dir.

Go to the AdminCP and open the MEMBERINFO template, and search for
Code:

$userinfo[msn]
replace that with
Code:

<img src="email.php?user=$userinfo[msn]" border="0">
also in the MEMBERINFO template, search for
Code:

$userinfo[yahoo]
replace that with
Code:

<img src="email.php?user=$userinfo[yahoo]" border="0">
Go to the Phrase manager, and search for showemail variable.
you will find the following:
Code:

The email address for $destusername is <a href="mailto:$email">$email</a>
replace with:
Code:

The email address for $destusername is <a href="mailto:$email"><img src="email.php?user=$email" border="0"></a>
thats all :)

tamarian 06-15-2005 11:18 AM

Quote:

First of all, I'm not sure if this is a hack or a template mod.
so, if its placed wrong, please advise.
this is my first 'hack', so be nice
This is a hack, and a very good one :up:

cinq 06-15-2005 11:26 AM

Was trying to do this a while back

Good job :)
You can probably apply this to any email address posted as well by amending the functions_bbcode.php in your includes folder.

Andreas 06-15-2005 11:49 AM

IMHO this does not make much sense, as the eMail address is still in the HTML and can be processed automatically by spammers.
If you really want to do this (which isn't worth it) you might want to use smth. like the attached script.

jugo 06-15-2005 12:37 PM

Very nice Kirby.

tamarian 06-15-2005 01:03 PM

Quote:

Originally Posted by KirbyDE
If you really want to do this (which isn't worth it) you might want to use smth. like the attached script.

I think obfuscating emails is really worth it, if that's what you meant?

And as always, great job with the code recommendations :up:

One issue, I think, that might be a problem with both versions is the image caching. As it's called email.png and browsers will often cache this, and one will end up sending emails to the wrong members :)

I'd call the image something like this,
PHP Code:

  $im     imagecreatefrompng('email-' $userinfo['userid']  . '.png'); 

or with a random string as a cache buster.

Andreas 06-15-2005 01:21 PM

Quote:

Originally Posted by tamarian
I think obfuscating emails is really worth it, if that's what you meant?

I meant that, but as said it's IMHO not worth it the processing overhead, aus you can simply turn off displaying eMails.

Quote:

I'd call the image something like this,
PHP Code:

  $im     imagecreatefrompng('email-' $userinfo['userid']  . '.png'); 


Erm ... for this to work you would need tohse image-userid.png files on your servers HD ;)
The users browser never gets to see this email.png, however if you want to prevent caching (which should only be an issue when a user changes his eMail) you can add No-Cache Headers.

tamarian 06-15-2005 02:19 PM

Quote:

Originally Posted by KirbyDE
I meant that, but as said it's IMHO not worth it the processing overhead, aus you can simply turn off displaying eMails.

That won't work, as it would fail the original requirement :)

Quote:

My forum members were complaining about the load of spam they received after the emailaddresses were publicly viewable.
We wouldn't use the secure mail function, because the users wanted to see eachothers mail addresses.
Quote:

Erm ... for this to work you would need tohse image-userid.png files on your servers HD
The users browser never gets to see this email.png, however if you want to prevent caching (which should only be an issue when a user changes his eMail) you can add No-Cache Headers.
What would be best, IMHO, and eliminate some of the overhead, is to be able to generate the image without calling a new php file.

Is this doable? Can it be done in a plugin through a hook? And be able to show the image on the fly?

Andreas 06-15-2005 02:23 PM

This is the vB 3.0.x section, so there are no Plugins/Hooks ;)

Well, doing this without creating the images on the fly means you must create them when the user enters/changes his emai/msn/yahoo - and store them somewhere for later retrival (either in the database or on disk).


All times are GMT. The time now is 08:39 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01058 seconds
  • Memory Usage 1,746KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (7)bbcode_code_printable
  • (2)bbcode_php_printable
  • (7)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete