Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: zepp on August 21, 2009, 08:43:04 AM

Title: RandomSecure_1.00
Post by: zepp on August 21, 2009, 08:43:04 AM
Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=2063)

Random Verification Questions

Version: 1.00 Date 2009-8-8
Compatibility: SMF 1.1.7..???

Features

Adds Random verification questions.  You can add up to 2 questions which must be answered by the applicant before registration is permitted.

The administrator creates up to 2 text files of questions and answers with "~" delimiter and places the files in the Sources directory. the registration program then parses the file and randomly selects a Q & A from each file and presents them on the registration screen.

These can be used for anti spam as in the original Mod or for registering a community of people who have common knowledge of the questions being asked.
(this is the reason I made the Modifications to this Mod....)

The questions should be kept relatively short  to be able to fit on one line per question. the text file can have any name, but must use the format

What month is has 28 days normally~february
What state is the largest~alaska
What color are bananas~yellow


Configuration

The settings for this modification are located in Admin -> Members -> Registration -> Settings.


Title: Re: RandomSecure_1.00
Post by: Dzonny on August 21, 2009, 01:18:30 PM
Nice mod zepp, it could be very userful as spam prevention....

Regards.
Title: Re: RandomSecure_1.00
Post by: zepp on August 24, 2009, 04:15:42 PM
Thanks,

I'm glad it might be useful for others....

I would like to start doing more programming, and this is a cool way to hone the skills needed. Any feedback or insight is welcomed.

Zepp
Title: Re: RandomSecure_1.00
Post by: Fra_Co on March 08, 2010, 10:57:33 AM
at every reg i see this on error log:

8: Undefined offset: 1
File: /blablabla/forum/Sources/Register.php
Line: 201


the code block is:

Quoteif (!empty($modSettings['rnd_ver_file_1']) && file_exists($sourcedir . '/' . $modSettings['rnd_ver_file_1']))
      {
      $QA_file = fopen($sourcedir . '/' . $modSettings['rnd_ver_file_1'], 'r');
      while(!feof($QA_file))
         $qna[]= fgets($QA_file);
      fclose($QA_file);   
      array_pop($qna);
      shuffle($qna);
      $qna = explode("~", $qna[0]);
      $modSettings['rnd_ver_ques_1']= $qna[0];// question from file
      $txt['rnd_ver_ans_1'] = $qna[1];//answer from file
    
      }
   if (!empty($modSettings['rnd_ver_file_2']) && file_exists($sourcedir . '/' . $modSettings['rnd_ver_file_2']))
      {
      $QA_file = fopen($sourcedir . '/' . $modSettings['rnd_ver_file_2'], 'r');
      while(!feof($QA_file))
         $qna[]= fgets($QA_file);
      fclose($QA_file);   
      array_pop($qna);
      shuffle($qna);
      $qna = explode("~", $qna[0]);
      $modSettings['rnd_ver_ques_2']= $qna[0];// question from file
      $txt['rnd_ver_ans_2'] = $qna[1];//answer from file
      }
   }

?
Title: Re: RandomSecure_1.00
Post by: TAB004 on March 23, 2010, 04:17:29 AM
This mod is great except for that as I have been refreshing the registration page to see the questions randomly cycle through, sometimes there will be errors, such as:

Answer all questions below
What color is spelled like grown?:    
brown :

Answer all questions below
What color is grass?:    
green :

Answer all questions below
What color sounds like bold?:    
gold :

Answer all questions below
What color sounds like bold?:    
What color sounds like bold?:

Answer all questions below
What color is grass?:    
What color is grass?:

Answer all questions below
What color are oranges?:    
orange :

Answer all questions below
What color is spelled like grown?:    
What color is spelled like grown?:

Answer all questions below
What color is cloudless sky?:    
blue :

Most of the time it works fine, like this:


Answer all questions below
What color is cloudless sky?:    
What shape has three sides?:

Answer all questions below
What color is spelled like grown?:    
What is the 7th letter in the English alphabet?:

I would love to see this resolved because I think it is a great mod!
  :)
Title: Re: RandomSecure_1.00
Post by: TAB004 on March 23, 2010, 07:40:05 PM
How do I change:

"Answer all questions below"

?
Title: Re: RandomSecure_1.00
Post by: Dzonny on March 24, 2010, 09:04:16 AM
Quote from: TAB004 on March 23, 2010, 07:40:05 PM
How do I change:

"Answer all questions below"

?

Take a look at your Modifications.english.php and search for that string.