I keep getting an error that says "Warning: imagettfbbox() [function.imagettfbbox]: Could not find/open font in /home/a6079442/public_html/rebuild/includes/csi.php on line 48 Error in imagettfbbox function"
I am trying to include a captcha image in this form, and it just doesn't seem to be working. I've got csi.php included on FormToEmail.php
print_r($_POST); session_start(); //check the captcha
if(!empty($_SESSION['sc'])&&$_SESSION['sc']==$_POST['sc']){unset($_SESSION['sc']); print 'captcha is right';} else {$valCheck=false;$appMessage='Sorry, you have provided an invalid security code';} ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html class="embed firefox" xmlns="http://www.w3.org/1999/xhtml"> <head> <title> want to advertise? contact us! </title>
<li style="display: none;"> <label for="comment">Do Not Fill This Out</label> <textarea name="comment" id="comment" rows="1" cols="1"></textarea> <input id="idstamp" name="idstamp" value="VuXFID/UrijtCYffVp7xRB3O98Q+v/DvyIxYt88ZyXM=" type="hidden"> </li> </ul> </form>
</div><!--container--> <img id="bottom" src="contactform/bottom.png" alt=""> <script type="text/javascript"> __EMBEDKEY = "false" </script></body></html> Also, here is the code to csi.php:
Code:<?php
session_start();
class csi { public $font = 'mf.ttf';
public function generateCode($characters) { /* list all possible characters, similar looking characters and vowels have been removed */ $possible = '23456789bcdfghjkmnpqrstvwxyz'; $code = ''; $i = 0; while ($i < $characters) { $code .= substr($possible, mt_rand(0, strlen($possible)-1), 1); $i++; } return $code; }
public function csi($width='120',$height='40',$characters='6') { $code = $this->generateCode($characters);
/* font size will be 75% of the image height */ $font_size = $height * 0.75; $image = @imagecreate($width, $height) or die('Cannot initialize new GD image stream');