cformsII Support Forum
Current User: Guest *Frequently Asked Questions*
Search 
Search Forums:


 




Where does the Q&A comparison takes place

Add a New Topic Reply to Post
Post

Ann - Guest

10:42 am - January 16, 2008

1

Please replace the ??? with your data!

  • Your URL: http://???
  • The browser used: ???
  • cforms version: ???
  • Your Wordpress version: ???

Hi Oliver,
Thank you for your excellent plugin and continuous professionalism (you have helped me many times before :) ).

When having Q&A verification enabled, where in your code does the comparison between the answer and the userinput takes place?
I.e. where in your code do you have something like:
if ($_POST[‘cforms_a’.$no] ==  $_POST[‘cforms_q’.$no]) ….
Is it in cforms.php or cform.src.js ?

What I need to do is to add another md5() on the user input since it is compared to a custom WP-field (instead of cforms custom questions).
This field corresponds to a password and has been hashed for protection.
Your help is much appreciated.

Oliver - Admin

7:41 pm - January 16, 2008

posts 3909

2

It happens in two areas. For JS in cforms.js and for non-JS (or nonAjax for that matter) in lib_nonajax.php.

My suggestion however would be to modify cforms.php instead, at the source (pun intended):

$qall = explode( "\r\n", get_option('cforms_sec_qa') );

Look for the above line and replace get_option('cforms_sec_qa') with your hashed value.

Second change would require the md5() to be removed, since the above value is already md5'ed:

$content .= $nttt .'<input type="hidden" name="cforms_a'.$no.'" id="cforms_a'.$no.'" value="' . md5(rawurlencode(strtolower($q[1]))) . '"/>';

Two relatively easy changes, and it should work.

Ann - Guest

10:10 am - January 22, 2008

3

Thanks, as always your suggestion is a working solution.
However the passwords, which are stored as custom wp-fields, will be shown (hashed) inside the page source code, which is not preferable.

In your opinion, do you think it is possible to create a custom function inside cform.php that compares user input (cform_q) with values inside the WP-database and then calls for cform.js for the displaying of error messages etc.
Alternatively is it possible to pass on the password as an argument to the verification-function in cform.js without it being shown in the page source code.

Which option do you think is most feasible or would you suggest another approach?
Perhaps it is not possible to use AJAX enabled forms and use custom wp-fields for verification.

Oliver - Admin

11:01 pm - January 22, 2008

posts 3909

4

Ann said:

Thanks, as always your suggestion is a working solution.
However the passwords, which are stored as custom wp-fields, will be shown (hashed) inside the page source code, which is not preferable. 

In your opinion, do you think it is possible to
create a custom function inside cform.php that compares user input
(cform_q) with values inside the WP-database and then calls for
cform.js for the displaying of error messages etc.

Yes, very doable. With the limitation that it would have to happen in non-Ajax (lib_nonajax.php). 

Alternatively is it possible to pass on the password as an argument to
the verification-function in cform.js without it being shown in the
page source code.

 Nope. The only way you could have Javascript (which runs locally on your browser) read any server data is by having somewhere in the HTML source code.

Which option do you think is most feasible or would you suggest another approach?
Perhaps it is not possible to use AJAX enabled forms and use custom wp-fields for verification.

Correct. I would then suggest to simply use a single line input field (textfield), and add a 'special case' to the error routine in the non ajax llibrary (see above) for textfields to check it against your custom password.

Check lines 72-88, it would have to go in there for special treatment (validation).

Reply to Post


Reply to Topic: Where does the Q&A comparison takes place
PLEASE READ THE FAQs FIRST! THANK YOU.

NOTE: New Posts are subject to administrator approval before being displayed

Guest Name (Required):

Guest EMail (Required):

Topic Reply:

Save New PostSmileysOptions

Guest URL (required)

Math Required!
What is the sum of:
12 + 7
   

 
Confused Cool Cry Embarassed Frown Kiss Laugh Smile Surprised Wink Yell

Search