Jump to content

[noob] Need help implementing a captcha


roger01

Recommended Posts

Hello

 

So i have 0 knowledge in php, i just need to implement this captcha:

 

i have a webserver php file which contains:

$content .= "<some html code>";

i have the captcha code which looks like this:

if (!class_exists('KeyCAPTCHA_CLASS')) {
	include('keycaptcha.php');
}
$kc_o = new KeyCAPTCHA_CLASS();
echo $kc_o->render_js();

so far, the only way i've managed to make it display the captcha on the page is by doing this:

$content .= "<first part of html code>";

if (!class_exists('KeyCAPTCHA_CLASS')) {
	include('keycaptcha.php');
}
$kc_o = new KeyCAPTCHA_CLASS();
echo $kc_o->render_js();

$content .= "<second part of html code>";

now, the problem is, the captcha isn't displayed where the html code is, but as the first thing on the page, in the upper left corner.

 

any idea how to make it display inside the html code?

 

the html code is actually a <form>

 

thank you!

Link to comment
Share on other sites

The string returned by KeyCAPTCHA_CLASS::render_js() must be inserted into the form at the exact location where you want the CAPTCHA.

 

This would be a lot easier if you (or the code author) had properly separated the HTML markup from the PHP code. Now you need to split your HTML string to inject the CAPTCHA snippet:

$content = '<other elements><form><prior input elements>'.$kc_o->render_js().'<next input elements></form><other elements>';

In the long run, however, you'll need an actual programmer to fix the mess.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.