I have heard that Fenng got a lot of spam message even with SCode plugins in his blog system, seems some spam robot are able to get the security code from image. Imaged security code are widely used in everywhere, to SCode plugins, maybe the image is too simple, we can modify it. I made two changes here:
- Draw four digit in different color.
- Draw a verticle line with background color in the middle of digit
Hopefully this change can help to prevent from spam message, but there is no spam message on my own site because of lower traffic. This time we just modify the mt-scode.cgi file. As following:
# define the color we going to use
$c_background = $im->colorAllocate(224,224,224);
$c_border = $im->colorAllocate(0,0,0);
$c_line = $im->colorAllocate(224,224,224);
# color of first character
$c_code1 = $im->colorAllocate(###,###,###);
# color of second character
$c_code2 = $im->colorAllocate(###,###,###);
# color of third character
$c_code3 = $im->colorAllocate(###,###,###);
# color of forth character
$c_code4 = $im->colorAllocate(###,###,###);
# Fill in the background
$im->fill(50,50,$c_background);
# Write the code
$im->string(gdGiantFont,10,1,substr($scode,0,1),$c_code1);
$im->string(gdGiantFont,18,3,substr($scode,1,1),$c_code2);
$im->string(gdGiantFont,26,2,substr($scode,2,1),$c_code3);
$im->string(gdGiantFont,34,4,substr($scode,3,1),$c_code4);
$im->line( 5,0, 5,19,$c_line);
$im->line(13,0,13,19,$c_line);
$im->line(21,0,21,19,$c_line);
$im->line(29,0,29,19,$c_line);
$im->line(37,0,37,19,$c_line);
$im->line(45,0,45,19,$c_line);
$im->rectangle(0,0,$im_length-1,19,$c_border);
To see the effect, check the security code image in this article.