Hi there,
I am kinda new to php and i am trying to figure out how to make recaptcha work on my site.
Here is an excerpt from my "signup.php" and i have corresponding signup.html which acts like a template... The head part of it looks like below...
<?php
require_once('includes/config.php');
require_once('includes/functions/func.global.php');
require_once('includes/classes/class.template_engine.php');
require_once('includes/lang/lang_'.$config['lang'].'.php');
// Connect to database
db_connect($config);
// Start Session
session_start();
The security part of the code is...
if($config['security'])
{
$_POST['security_code'] = trim($_POST['security_code']);
if(strtoupper($_POST['security_code']) != strtoupper($_SESSION['seccode']))
{
$security_error = $lang['INVALIDSECWORD'];
$errors++;
}
}
if($errors == 0)
{
$rem = md5(mt_rand(0,56)*time());
if($config['validation'] == '1')
{
mysql_query("INSERT INTO `".$config['db']['pre']."users` ( `user_id` , `username` , `password` , `email` , `remember` , `status` ) VALUES ('', '".validate_input($_POST['username'])."', '".validate_input(md5($_POST['password']))."', '".validate_input($_POST['email'])."', '".validate_input($rem)."', '0');");
$user_id = mysql_insert_id();
At the very end...it loads the signup template...
// Load signup template
$page = new HtmlTemplate ('templates/' . $config['tpl_name'] . '/signup.html');
$page->SetParameter ('OVERALL_HEADER', create_header($config,$lang,$cats,$lang['SIGNUP']));
$page->SetParameter ('OVERALL_FOOTER', create_footer($config,$lang));
$page->SetLoop ('CATS', $cats);
if(isset($_POST['username']))
{
$page->SetParameter ('USERNAME_FIELD', $_POST['username']);
$page->SetParameter ('EMAIL_FIELD', $_POST['email']);
$page->SetParameter ('USERNAME_ERROR', $username_error);
$page->SetParameter ('PASSWORD_ERROR', $password_error);
$page->SetParameter ('EMAIL_ERROR', $email_error);
$page->SetParameter ('AGREE_ERROR', $agree_error);
$page->SetParameter ('SECURITY_ERROR', $security_error);
}
else
{
$page->SetParameter ('USERNAME_FIELD', '');
$page->SetParameter ('EMAIL_FIELD', '');
$page->SetParameter ('USERNAME_ERROR', '');
$page->SetParameter ('PASSWORD_ERROR', '');
$page->SetParameter ('EMAIL_ERROR', '');
$page->SetParameter ('AGREE_ERROR', '');
$page->SetParameter ('SECURITY_ERROR', '');
}
if(isset($_SESSION['duser']['id']))
{
$page->SetParameter ('LOGGEDIN', 1);
}
else
{
$page->SetParameter ('LOGGEDIN', 0);
}
$page->SetParameter ('SECURITY_CODE',$config['security']);
$page->SetParameter ('SITE_TITLE',$config['site_title']);
$page->CreatePageEcho($lang,$config);
Now i am wondering where i need to insert the code for recaptcha...i have signed up and i got to the part where i user require function to include recaptcha lib but after that, i am not sure what code i need to insert in which part to replace usual generation of random image with recaptcha...
Any directions, tips or solutions would really be appreciated.
Thanks