2015-03-24, 02:31 PM
Hello.
If my thread is in bad forum, please move.
My problem is in form. I downloaded from database questions from "Security Question [ACP]". This to the register page. I need use that my new page.
Ok, I have these questions, but how verify, that in field (input) "answer" entered the correct answer?
This is code in my script (from member.php):
Maybe you have other suggestions?
Use:
My script send on email information from the form. I use "security question" in order to security (not SPAM). Next I need verify correct answer.
Regards.
Sorry if sth not understand, but i wrote in translator..
If my thread is in bad forum, please move.
My problem is in form. I downloaded from database questions from "Security Question [ACP]". This to the register page. I need use that my new page.
Ok, I have these questions, but how verify, that in field (input) "answer" entered the correct answer?
This is code in my script (from member.php):
// Security Question
$questionbox = '';
if($mybb->settings['securityquestion'])
{
$sid = generate_question();
$query = $db->query("
SELECT q.*, s.sid
FROM ".TABLE_PREFIX."questionsessions s
LEFT JOIN ".TABLE_PREFIX."questions q ON (q.qid=s.qid)
WHERE q.active='1' AND s.sid='{$sid}'
");
if($db->num_rows($query) > 0)
{
$question = $db->fetch_array($query);
$refresh = '';
// Total questions
$q = $db->simple_select('questions', 'COUNT(qid) as num', 'active=1');
$num = $db->fetch_field($q, 'num');
if($num > 1)
{
eval("\$refresh = \"".$templates->get("member_register_question_refresh")."\";");
}
eval("\$questionbox = \"".$templates->get("member_register_question")."\";");
$validator_extra = "
$('#answer').rules('add', {
required: true,
remote:{
url: 'xmlhttp.php?action=validate_question',
type: 'post',
dataType: 'json',
data:
{
question: function () {
return $('#question_id').val();
},
my_post_key: my_post_key
},
},
messages: {
remote: '{$lang->js_validator_no_security_question}'
}
});\n";
}
}
eval("\$formularz = \"".$templates->get("formularz")."\";");
Maybe you have other suggestions?
Use:
My script send on email information from the form. I use "security question" in order to security (not SPAM). Next I need verify correct answer.
Regards.
Sorry if sth not understand, but i wrote in translator..