Forum Moderators: phranque
Options +Includes
Options +Indexes
AddType text/html .html
AddOutputFilter INCLUDES .html
AddOutputFilter INCLUDES .html
<div><img alt="Captcha image" src="show-captcha.php?rand=1" style="margin-top: 20px; margin-bottom: 20px;" id="scaptcha_img" /></div>
echo "OK so far!";
http://example.com/contactform.php
[edited by: phranque at 8:12 am (utc) on Mar 18, 2014]
[edit reason] Please Use example.com [webmasterworld.com] [/edit]
<?PHP
require_once("fgcontactform.php");
require_once("captcha-creator.php");
session_start();
if(isset($_POST['fg_validate_captcha']))
{
$captchaobj = new FGCaptchaCreator('scaptcha');
header("pragma: no-cache");
header("cache-control: no-cache");
if(!$captchaobj->ValidateCaptcha($_POST['scaptcha']))
{
echo "The code does not match. Please try again!";
}
else
{
echo "success";
}
}
else
{
$captcha = new FGCaptchaCreator('scaptcha');
header("pragma: no-cache");
header("cache-control: no-cache");
$captcha->DisplayCaptcha();
}
?>
I did some Bing searching, and someone said that an "Options +Indexes" line is needed.
This message was itself an image, not text.
new FGCaptchaCreator('scaptcha')
<?PHP
class FGCaptchaCreator extends FG_CaptchaHandler
{
var $image;
var $width;
var $height;
var $margin_y;
var $charset;
var $nChars;
var $linecolor;
var $code;
var $show_captcha_var;
var $nlines;
var $enc_key;
var $captcha_var_name;
function FGCaptchaCreator($captcha_var_name)
{
$this->width = 150;
$this->height= 60;
$this->charset="2356789ABCDEFGHJKLMNPQRSTUVWXYZ";
$this->nChars=6;
$this->margin_y = 10;
$this->nlines = 2;
$this->font_file = 'SFOldRepublicSCBold.ttf';
$this->enc_key="GhsnR5^Hyhsfg";
$this->captcha_var_name = $captcha_var_name;
}
[/cpde]
The remainder of the file continues a long list of functions, all in this "class." The function is also called in the main file, contactform.php.
By the way, the .htaccess file for this Web site on my VPS is:
[code]
RewriteEngine on
AddHandler server-parsed .html
RewriteCond %{HTTP_HOST} ^example\.org$ [OR]
RewriteCond %{HTTP_HOST} ^www\.example\.org$
RewriteRule ^/?$ "http\:\/\/example\.com\/" [R=301,L]
[edited by: phranque at 8:18 am (utc) on Mar 18, 2014]
[edit reason] Please Use example.com [webmasterworld.com] [/edit]
[edited by: phranque at 8:18 am (utc) on Mar 18, 2014]
[edit reason] unlinked url [/edit]
the real site uses root URLs, but the test site is accessed as a sub-folder
echo "Hi there! I'm your captcha program!" ExpiresActive On
ExpiresDefault "access plus 1 month"
ExpiresByType text/html "access"
(1) "Is the show-captcha program not loading at all, or just not executing? And if it's not loading, is it because the server can't find it or because it contains an error?"
(2) "If you're not sure, add a random line somewhere in the show-captcha file that says something like
echo "Hi there! I'm your captcha program!"
(3) "If this line doesn't show up, proceed to:
comment-out everything in show-captcha except that one line, and now see if it displays."
(4) "Is the whole thing inside <img> tags? If so, try moving the function reference outside of the <img> just to see if it behaves differently."