i want to use this captcha script.My link
this script has this code below to verify if the answer posted is right.
session_start();
if ($_POST['answer']!=$_SESSION['result']) {
echo "Your answer is wrong! Are you human?";
} else {
echo "Your answer is correct!";
}
I'm suppose to paste this piece of code in the page that processes the form. MY login script does not do it this way. It processes the form in the same page. So could you help me out in this.
MY login script file that processes the form is shown below:
<?php
error_reporting (E_ERROR | 0);
include 'constants.php';
include 'mail.php';
if(isset($_GET['log_out'])) {
$Login_Process = new Login_Process;
$Login_Process->log_out($_SESSION['email_address'], $_SESSION['password']); }
class Login_Process {
var $cookie_user = CKIEUS;
var $cookie_pass = CKIEPS;
function connect_db() {
$conn_str = mysql_connect(DBHOST, DBUSER, DBPASS);
mysql_select_db(DBNAME, $conn_str) or die ('Could not select Database.');
}
function query($sql) {
$this->connect_db();
$sql = mysql_query($sql);
$num_rows = mysql_num_rows($sql);
$result = mysql_fetch_assoc($sql);
return array("num_rows"=>$num_rows,"result"=>$result,"sql"=>$sql);
}
function set_session($email_address, $password) {
$query = $this->query("SELECT * FROM ".DBTBLE." WHERE email_address='$email_address' AND password='$password'");
ini_set("session.gc_maxlifetime", Session_Lifetime);
session_start();
$_SESSION['name'] = $query['result']['name'];
$_SESSION['department'] = $query['result']['department'];
$_SESSION['email_address'] = $query['result']['email_address'];
$_SESSION['company'] = $query['result']['company'];
$_SESSION['mobile'] = $query['result']['mobile'];
$_SESSION['user_level'] = $query['result']['user_level'];
$_SESSION['password'] = $query['result']['password'];
}
function Register($post, $process) {
if(isset($process)) {
$pass1 = $post['pass1'];
$pass2 = $post['pass2'];
$email_address = $post['email_address'];
$name = $post['name'];
$department = $post['department'];
$company = $post['company'];
$address = $post['address'];
echo $phone;
$phone = $post['phoneno'];
$fax = $post['fax'];
$mobile = $post['mobile'];
$country = $post['country'];
$city = $post['city'];
$postalcode = $post['postalcode'];
if((!$pass1) || (!$pass2) || (!$email_address) || (!$email_address) || (!$name) || (!$department) || (!$company)) {
return "Some Fields Are Missing";
}
if ($pass1 !== $pass2) {
return "Passwords do not match";
}
$query = $this->query("SELECT email_address FROM ".DBTBLE." WHERE email_address = '$email_address'");
if($query['num_rows'] > 0){
return "email_address unavialable, please try a new email_address";
}
$query = $this->query("SELECT email_address FROM ".DBTBLE." WHERE email_address = '$email_address'");
if($query['num_rows'] > 0){
return "Emails address registered to another account.";
}
if(Admin_Approvial == true) {
$status = "pending";
} else {
$status = "live";
}
$this->query("INSERT INTO ".DBTBLE." (name, department, company, email_address, password,phone,mobile,fax,address,country,city,postalcode) VALUES ('$name', '$department', '$company', '$email_address', '".md5($pass1)."','$phone','$mobile','$fax','$address','$country','$city','$postalcode')");
User_Created($email_address, $email);
if(Admin_Approvial == true) {
return 'Sign up was sucessful, your account must be reviewed by the administrator before you can login.';
} else {
return 'Sign up was sucessful, you may now log in.';
}
}
}

New Topic/Question
Reply



MultiQuote





|