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
url: http://inferium.site11.com/rebuild/contactform.php
Here is my code for the form page:
Code: <?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>
<!-- Meta Tags -->
<meta name="robots" content="noindex, nofollow, noarchive">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- CSS -->
<link rel="stylesheet" href="contactform/dynamic.css" type="text/css">
<link rel="stylesheet" href="contactform/theme.css" type="text/css">
<link rel="stylesheet" href="contactform/wufoo.css" type="text/css">
<!-- JavaScript -->
<script type="text/javascript" src="contactform/dynamic.js"></script>
</head><body id="public">
<div id="container">
<form class="wufoo topLabel page1" autocomplete="off" enctype="multipart/form-data" method="post" action="FormToEmail.php">
<div class="info">
<h2>want to advertise? contact us!</h2>
<div></div>
</div>
<ul>
<li id="fo1li108" class=" ">
<label class="desc" id="title108" for="Field108">
your name:
</label>
<div>
<input id="name" name="name" class="field text medium" maxlength="255" tabindex="1" type="text">
</div>
</li>
<li id="fo1li6" class=" ">
<label class="desc" id="title6" for="Field6">
your email:
</label>
<div>
<input id="email" name="email" class="field text large" maxlength="255" tabindex="2" type="text">
</div>
<p class="instruct" id="instruct6"><small>We won't share this with strangers.</small></p>
</li>
<li id="fo1li112" class=" ">
<label class="desc" id="title112" for="Field112">
your phone:
</label>
<div>
<input id="phone" name="phone" class="field text medium" maxlength="255" tabindex="3" type="text">
</div>
</li>
<li id="fo1li109" class=" ">
<label class="desc" id="title109" for="Field109">
name of your mgmt:
</label>
<div>
<input id="management" name="management" class="field text medium" maxlength="255" tabindex="4" type="text">
</div>
</li>
<li id="fo1li110" class=" ">
<label class="desc" id="title110" for="Field110">
cities your properties are located in:
</label>
<div>
<input id="property_locations" name="property_locations" class="field text medium" maxlength="255" tabindex="5" type="text">
</div>
</li>
<li id="fo1li1" class=" ">
<label class="desc" id="title1" for="Field1">
specific questions or needs:
<span id="req_1" class="req">*</span>
</label>
<div>
<textarea id="questions" name="questions" style="border:0px;background-color:#FFFFFF;" rows="2" cols="50" tabindex="6"></textarea>
</div>
<p class="instruct" id="instruct1"><small>This field is required.</small></p>
</li>
<li class=" ">
<img src="includes/csi.php?w=100&h=40&chr=5" alt="" />
<label class="desc">
please enter the code from above:
</label>
<input type="text" name="sc" id="sc" style="border:0px;background-color:#FFFFFF;" maxlength="255" />
</li>
<li class="buttons">
<input name="currentPage" id="currentPage" value="GI0jR8qooTIIfP2hij1KYssRL4qyfwuBe5cnwuBewqGlzjUSE=" type="hidden">
<input id="saveForm" name="saveForm" class="btTxt submit" value="submit your inquiry" type="submit">
</li>
<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');
/* set the colours */
$background_color = imagecolorallocate($image, 255, 255, 255);
$text_color = imagecolorallocate($image, 20, 40, 100);
$noise_color = imagecolorallocate($image, 100, 120, 180);
/* generate random dots in background */
for( $i=0; $i<($width*$height)/3; $i++ )
{
imagefilledellipse($image, mt_rand(0,$width), mt_rand(0,$height), 1, 1, $noise_color);
}
/* generate random lines in background */
for( $i=0; $i<($width*$height)/150; $i++ )
{
imageline($image, mt_rand(0,$width), mt_rand(0,$height), mt_rand(0,$width), mt_rand(0,$height), $noise_color);
}
/* create textbox and add text */
$textbox = imagettfbbox($font_size, 0, $this->font, $code) or die('Error in imagettfbbox function');
$x = ($width - $textbox[4])/2;
$y = ($height - $textbox[5])/2;
imagettftext($image, $font_size, 0, $x, $y, $text_color, $this->font, $code) or die('Error in imagettftext function');
/* output captcha image to browser */
header('Content-Type: image/jpeg');
imagejpeg($image);
imagedestroy($image);
$_SESSION['sc'] = $code;
}
}
$width = isset($_GET['w']) ? $_GET['w'] : '120';
$height = isset($_GET['h']) ? $_GET['h'] : '40';
$characters = isset($_GET['chr']) && $_GET['chr'] > 1 ? $_GET['chr'] : '6';
$captcha = new csi($width,$height,$characters);
?>
Any help with this would be much appreciated
Merger of 6 sister companies under one flagship company after go live
Dear Experts,
Save file by click
Hello. I'm not understand how to save file from page. I'd like make link to file with save ability.<?phpchdir('upload/');foreach (glob("*.*") as $filename) { $uploadfile =
Using cURL to PUT
Can somebody help with the correct php code to make a cURL PUT request. Here is a sample of code below that uses POST, but I need to modify this one so that it uses PUT instead.Code: <?php
values in array being escaped
I would like to submit some values - back to the same form for checking before processing...Code: [Select]<FORM method="post"><table width="500px"
Small problem with image resize script
Hi!I am a little bit new to php and I have an issue installing an image resize script I downloaded (http://shiftingpixel.com/2008/03/03/smart-image-resizer/) and can't seem to get it working.Here's a
True way to see if action was successful?
If this is a good way to see if action was successful to continue:Code: function changeGameState($GameId) { mysql_query("UPDATE challenges SET status=status+1 WHERE id='$GameId'");
Solution Manager BPR
Does the SolMan-BPR-ARIS-Integration (http://www.ids-scheer.com/en/ARIS/ARIS_Platform/ARIS_Business_Architect_for_SAP/3743.html ) use an interface open to the public? If yes, were can I finde some
Using two $_POST Function / Switch () statements, second does not work.
Hi all. I’m new to php and am having a problem getting $_POST Function / switch () to work. I am coding a registration form. I ask the user a Yes/No question. Depending on the answer I have an
PHP / MySQL Associative Multidimensional Array:
Hello.I have data in a MySQL Table that adheres to the below: (note, no index, could add if necessary)group~~~~~setting~~~~~value1~~~~~~~~~Babble~~~~~Yeah, sure1~~~~~~~~~Dabble~~~~~No, rather
Php - mysql store data and use it later?
Hi, i' making a login page at the moment, however my username + password is stored many different places, and is kinda hard to get, so I have written this entire code:Code: