Font verification code

More
17 years 1 month ago #694 by jop
Font verification code was created by jop
Hi, visitors on my site complain about the used font in the image verification code.
For instant, a l,1, capital I are not that much different.
Is it possible to change the used font in the verification code?

Please Log in or Create an account to join the conversation.

More
17 years 1 month ago #696 by Pete
Replied by Pete on topic Font verification code

jop wrote: Hi, visitors on my site complain about the used font in the image verification code.
For instant, a l,1, capital I are not that much different.
Is it possible to change the used font in the verification code?


Hi,

Open the file "random.php", and replace the contents of it with the following (using notepad):
Code:
<?php //start session session_start(); // Set the content-type header("Content-type: image/png"); //define your string $string = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; //generate the code $rand = substr(str_shuffle($string), 0, 5); //put the md5 hash of the code into a session $_SESSION['image_random_value'] = md5($rand); $im = imagecreatetruecolor(100, 30); // Create some colors $white = imagecolorallocate($im, 255, 255, 255); $grey = imagecolorallocate($im, 128, 128, 128); $black = imagecolorallocate($im, 0, 0, 0); imagefilledrectangle($im, 0, 0, 399, 29, $white); // The text to draw $text = $rand; // Replace path by your own font path $font = 'times.ttf'; // Add some shadow to the text imagettftext($im, 20, 0, 11, 21, $grey, $font, $text); // Add the text imagettftext($im, 20, 0, 10, 20, $black, $font, $text); // Using imagepng() results in clearer text compared with imagejpeg() imagepng($im); imagedestroy($im); ?>

Then download the following zip file, and extract the "times.ttf" font into your guestbook directory (same directory as guestbook.php file):

www.digioz.com/fonts/times.zip

That should do the trick for you.

DigiOz Webmaster
www.digioz.com

Please Log in or Create an account to join the conversation.

More
14 years 10 months ago #1162 by kylboy06
Replied by kylboy06 on topic Font verification code
I tried this and it doesn't work. It displays no verification image at all, just the text field for the verification code to be entered.

Please Log in or Create an account to join the conversation.

More
14 years 10 months ago #1163 by Pete
Replied by Pete on topic Font verification code
Can you email us a PHP Info output of your webserver?

Pete

DigiOz Webmaster
www.digioz.com

Please Log in or Create an account to join the conversation.

More
14 years 10 months ago #1164 by kylboy06
Replied by kylboy06 on topic Font verification code
you can find the php info output here: thehammakers.110mb.com/phpinfo.php

Please Log in or Create an account to join the conversation.

Time to create page: 0.123 seconds
Powered by Kunena Forum