Hi,
I am trying to setup and use a class that will be used to create security image (to be used in forms).
I have the class defined in a inc.php file, used a wrapper and called the wrapper in the form where the image is to displayed.
file: includes/security-image.inc.php:
class SecurityImage {
var $oImage;
....
function SecurityImage( $iWidth=130, $iHeight=30 , $iNumChars=5 , $iNumLines=3)
{
....
}
// bunch of other functions
}
file: security-image.php
<?php
// start PHP session
session_start();
// include security image class
require('includes/security-image.inc.php');
// get parameters
isset($GET['width']) ? $iWidth = (int)$GET['width'] : $iWidth = 150;
isset($GET['height']) ? $iHeight = (int)$GET['height'] : $iHeight = 30;
// create new image
$oSecurityImage = new SecurityImage($iWidth, $iHeight);
if ($oSecurityImage->Create()) {
// assign corresponding code to session variable
// for checking against user entered value
$SESSION['code'] = $oSecurityImage->GetCode();
error_log("\nImage GIF library is installed.\nsession['code']=".$SESSION['code'],3,"debug.txt");
} else {
echo 'Image GIF library is not installed.';
error_log("\nImage GIF library is not installed.",3,"debug.txt");
}
?>
index.php:
// for fields defined here including the following security image
<img src="security-image.php" width="150" height="30" alt="Security Image" />
The problem is that when I run index.php, nothing shows for security image. Whe I run security-image.php, I see the following error message:
Fatal error: Cannot instantiate non-existent class: securityimage in security-image.php on line 13
where line 13 is:
$oSecurityImage = new SecurityImage($iWidth, $iHeight);
The sample page is in http://www.hosteam.com/demo/securityimage/
Thanks for your help.