Login Retreive lost passwordRegister
Search

Forum Index / General / Captcha field doesn't display

[ This topic is solved ]

  Steve R 22 February 09 / 18:36  
Hello,

I'm loving FormHandler, but I can't get a captcha field to work. I tried it in a form I had made which was working fine and when I included the captcha code none of the form displayed. So now I'm using the code straight from the manual, the only thing I change is the path to the class. I use this path in the code of the form that works without the captcha field, so I know it is correct.

When I use this code, nothing at all displays in the browser.

<?php

// include the class
include("../../FormHandler/class.FormHandler.php");

echo 
"here";

// make a new $oForm object
$oForm = new FormHandler();

// a textfield
$oForm->CaptchaField("Verify the code""code");

// submitbutton beneath it
$oForm->submitButton("Save");

// set the 'commit after form' function
$oForm->onCorrect("FH_RUN");

// send the form to the screen
$oForm->flush();

// function to show a message
function FH_RUN($aData
{
    return 
"You entered the correct code "$aData["code"];
}
?>


Any help is greatly appreciated.

Steve

  Johan Wiegel (Admin) 22 February 09 / 20:05  
Changed at 22 February 09 / 20:13
I did copy your exact code to here http://www.jwiegel.com/FH/test.php
if you visit this url can you see the captcha code?

  Steve R 23 February 09 / 01:19  
Yes, it does display. So what can be different/missing with mine?

  Johan Wiegel (Admin) 23 February 09 / 08:58  
Is your error reporting on?

try this in:

..\formhandler\includes\class.Validator.php on line 438

replace
require('../'.FH_FHTML_DIR.'securimage/securimage.php');

with:
require($_SERVER['DOCUMENT_ROOT'] . FH_FHTML_DIR . 'securimage/securimage.php');

  Remco van Arkelen (Admin) 23 February 09 / 09:27  
Changed at 23 February 09 / 09:28
 Quote
 
When I use this code, nothing at all displays in the browser.


Did you enable error-reporting in PHP? A blank screen sometimes means an error occurred and PHP configuration prevents you from seeing the error.

Try to add these lines on top of your script (development use only)

<?php
error_reporting
E_ALL );
ini_set'display_errors');
?>


Maybe an error shows up now?
Also take a look at what phpinfo() tells you. To use the CaptchaField GD support must be activated in PHP.

  Johan Wiegel (Admin) 24 February 09 / 15:17  
Steve try the new version, we released today

  matthijs van noort 26 March 09 / 21:41  
replace
require('../'.FH_FHTML_DIR.'securimage/securimage.php');

with:
require($_SERVER['DOCUMENT_ROOT'] . FH_FHTML_DIR . 'securimage/securimage.php');[/quote]

I had exactly the same. Check your HTML source. The reference to the image is probably not correct.

FH_FHTML_DIR, in my case (IIS shared server) referenced to E:\wwwroot\etc., so a no go. $_SERVER['...'] the same.
I hardcoded the path 'FHTML/securimage/securimage.php', for testing, and voila. This works if the testing file is in the same folder as class.FormHandler.php, obviously.

  matthijs van noort 26 March 09 / 21:42  
OH... and be aware:
This PATH is coded in the class.Validator.ph (438)
AS WELL AS class.FormHandler.php (369)

  Johan Wiegel (Admin) 27 March 09 / 18:38  
maybe use the last version where this is replaced by:

require(FH_FHTML_INCLUDE_DIR . 'securimage/securimage.php');

  Top


powered by PHP-GLOBE   © 2004 - 2012 FormHandler. All rights reserved.   -   Open source license