Made some change to mt-scode.cgi, just for fun!

    I make two changes to the security code display on my blog, first is to use different color for each digit, the second is change the location of each digit. Why I do this change is that some spam comments software have been able to read the digit from image file, Fenng's site has received lots of spam comments. My site almost has no comments, I made the change just for fun.

    The first thing is to generate for different color, I changed the code from:

$c_code4 = $im->colorAllocate(128,128,128);

to:

$c_code1 = $im->colorAllocate(xxx,xxx,xxx);
$c_code2 = $im->colorAllocate(xxx,xxx,xxx);
$c_code3 = $im->colorAllocate(xxx,xxx,xxx);
$c_code4 = $im->colorAllocate(xxx,xxx,xxx);

    Then change the code which draw the text to image:

$im->string(gdGiantFont,8,2,$scode,$c_code);

to:

$im->string(gdGiantFont,xx,yy,substr($scode,0,1),$c_code1);
$im->string(gdGiantFont,xx,yy,substr($scode,1,1),$c_code2);
$im->string(gdGiantFont,xx,yy,substr($scode,2,1),$c_code3);
$im->string(gdGiantFont,xx,yy,substr($scode,3,1),$c_code4);

    I am not sure whether this change could help you prevent spam comments. Maybe it's a really useless idea.

Post a comment

SCode:
Mail(*, but will not be displayed):
Home: