ソースを参照

Add (much) better text questions.

tags/v0.4
Skylar Ittner 1年前
コミット
f18680c020
5個のファイルの変更379行の追加9行の削除
  1. 23
    8
      api.php
  2. バイナリ
      database.mwb
  3. 159
    1
      database.sql
  4. 164
    0
      db_upgrade/0.3_to_0.4.sql
  5. 33
    0
      scrapetexts.php

+ 23
- 8
api.php ファイルの表示

@@ -18,32 +18,47 @@ switch ($VARS['action']) {
18 18
         // generate unique session ID that has an essentially zero chance of being a duplicate.
19 19
         // Contains a hash of a secure random number, a hash of the user's IP, and 23 uniqid() characters.
20 20
         $skey = uniqid(substr(hash("md5", mt_rand()), 3, 5) . hash("md5", getUserIP()), true);
21
-        $answers = $database->select('answers', ['aid', 'aname']);
21
+        
22
+        // Image problem
23
+        // 
24
+        // Get five random options
25
+        $answer_count = $database->count('answers');
26
+        $answers = $database->select('answers', ['aid', 'aname'], ["LIMIT" => [mt_rand(0, $answer_count - 6), 5]]);
22 27
         shuffle($answers);
23
-        $answers = array_slice($answers, 0, 5);
24
-        //var_dump($answers);
28
+        // Pick a correct one at random
25 29
         $correct_answer = $answers[mt_rand(0, count($answers) - 1)];
30
+        // Scramble the answer names so the client doesn't know the real answers.
26 31
         $scrambled = ["real" => [], "fake" => []];
27 32
         foreach ($answers as $a) {
28 33
             $scrambled["real"][] = $a['aid'];
29 34
             $scrambled["fake"][] = substr(hash("md5", mt_rand()), 0, 20);
30 35
         }
31
-        $database->insert("sessions", ["skey" => $skey, "aid" => $correct_answer['aid'], "expired" => 0, "#timestamp" => "NOW()", "ipaddr" => getUserIP()]);
36
+        
37
+        // Text problem
38
+        //
39
+        // Get random question
40
+        $access_count = $database->count('access_questions');
41
+        $access_question = $database->select('access_questions', ['acqid', 'acqtext'], ["LIMIT" => [mt_rand(0, $access_count - 1), 1]])[0];
42
+        
43
+        // Save the session data
44
+        $database->insert("sessions", ["skey" => $skey, "aid" => $correct_answer['aid'], "acqid" => $access_question['acqid'], "expired" => 0, "#timestamp" => "NOW()", "ipaddr" => getUserIP()]);
32 45
         $sid = $database->id();
46
+        // Save the answer data
33 47
         $scrambled_insert = [];
34 48
         for ($i = 0; $i < count($scrambled['real']); $i++) {
35 49
             $scrambled_insert[] = ["sid" => $sid, "aid" => $scrambled['real'][$i], "acode" => $scrambled['fake'][$i]];
36 50
         }
37 51
         $database->insert("scrambled_answers", $scrambled_insert);
52
+        
53
+        // Vary question wording a little
38 54
         $questions = ["Please click on the [].", "Click the [].", "Find the []."];
39
-        $accessible_questions = ["Please type [] here.", "Enter [] into the box.", "Type []."];
40 55
         shuffle($questions);
41
-        shuffle($accessible_questions);
56
+        
42 57
         $resp = [
43 58
             "session" => $skey,
44 59
             "id_prefix" => substr(hash("md5", mt_rand()), 3, 5),
45 60
             "question_i" => str_replace("[]", $correct_answer['aname'], $questions[0]),
46
-            "question_a" => str_replace("[]", $correct_answer['aname'], $accessible_questions[0]),
61
+            "question_a" => $access_question['acqtext'],
47 62
             "answers" => $scrambled["fake"]
48 63
         ];
49 64
         exit(json_encode($resp));
@@ -99,7 +114,7 @@ switch ($VARS['action']) {
99 114
         if ($database->has("scrambled_answers", ["AND" => ["sid" => $sid, "acode" => $VARS['answer_id']]])) {
100 115
             // Image maybe correct
101 116
             $image = true;
102
-        } else if ($database->has("sessions", ["[>]answers" => ["aid" => "aid"]], ["AND" => ["sid" => $sid, "aname" => $VARS['answer_id']]])) {
117
+        } else if ($database->has("sessions", ["[>]access_answers" => ["acqid" => "acqid"]], ["AND" => ["sid" => $sid, "OR" => ["acatext" => $VARS['answer_id'], "acahash" => hash('md5', $VARS['answer_id'])]]])) {
103 118
             // Accessible text correct
104 119
             $image = false;
105 120
         } else {

バイナリ
database.mwb ファイルの表示


+ 159
- 1
database.sql ファイルの表示

@@ -1,8 +1,3 @@
1
-
2 1
 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
3 2
 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
4 3
 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
@@ -29,6 +24,17 @@ CREATE TABLE IF NOT EXISTS `captcheck`.`answers` (
29 24
 ENGINE = InnoDB;
30 25
 
31 26
 
27
+-- -----------------------------------------------------
28
+-- Table `captcheck`.`access_questions`
29
+-- -----------------------------------------------------
30
+CREATE TABLE IF NOT EXISTS `captcheck`.`access_questions` (
31
+  `acqid` INT NOT NULL AUTO_INCREMENT,
32
+  `acqtext` VARCHAR(255) NOT NULL,
33
+  PRIMARY KEY (`acqid`),
34
+  UNIQUE INDEX `qaid_UNIQUE` (`acqid` ASC))
35
+ENGINE = InnoDB;
36
+
37
+
32 38
 -- -----------------------------------------------------
33 39
 -- Table `captcheck`.`sessions`
34 40
 -- -----------------------------------------------------
@@ -36,16 +42,23 @@ CREATE TABLE IF NOT EXISTS `captcheck`.`sessions` (
36 42
   `sid` INT NOT NULL AUTO_INCREMENT,
37 43
   `skey` VARCHAR(60) NOT NULL,
38 44
   `aid` INT NOT NULL,
45
+  `acqid` INT NOT NULL,
39 46
   `expired` TINYINT(1) NOT NULL DEFAULT 0,
40 47
   `timestamp` DATETIME NOT NULL,
41 48
   `ipaddr` VARCHAR(45) NULL,
42 49
   PRIMARY KEY (`sid`),
43 50
   UNIQUE INDEX `sid_UNIQUE` (`sid` ASC),
44 51
   INDEX `fk_sessions_answers1_idx` (`aid` ASC),
52
+  INDEX `fk_sessions_access_qa1_idx` (`acqid` ASC),
45 53
   CONSTRAINT `fk_sessions_answers1`
46 54
     FOREIGN KEY (`aid`)
47 55
     REFERENCES `captcheck`.`answers` (`aid`)
48 56
     ON DELETE NO ACTION
57
+    ON UPDATE NO ACTION,
58
+  CONSTRAINT `fk_sessions_access_qa1`
59
+    FOREIGN KEY (`acqid`)
60
+    REFERENCES `captcheck`.`access_questions` (`acqid`)
61
+    ON DELETE NO ACTION
49 62
     ON UPDATE NO ACTION)
50 63
 ENGINE = InnoDB;
51 64
 
@@ -72,6 +85,25 @@ CREATE TABLE IF NOT EXISTS `captcheck`.`scrambled_answers` (
72 85
 ENGINE = InnoDB;
73 86
 
74 87
 
88
+-- -----------------------------------------------------
89
+-- Table `captcheck`.`access_answers`
90
+-- -----------------------------------------------------
91
+CREATE TABLE IF NOT EXISTS `captcheck`.`access_answers` (
92
+  `acaid` INT NOT NULL AUTO_INCREMENT,
93
+  `acqid` INT NOT NULL,
94
+  `acatext` VARCHAR(45) NULL,
95
+  `acahash` VARCHAR(32) NULL,
96
+  PRIMARY KEY (`acaid`, `acqid`),
97
+  UNIQUE INDEX `acaid_UNIQUE` (`acaid` ASC),
98
+  INDEX `fk_access_answers_access_questions1_idx` (`acqid` ASC),
99
+  CONSTRAINT `fk_access_answers_access_questions1`
100
+    FOREIGN KEY (`acqid`)
101
+    REFERENCES `captcheck`.`access_questions` (`acqid`)
102
+    ON DELETE NO ACTION
103
+    ON UPDATE NO ACTION)
104
+ENGINE = InnoDB;
105
+
106
+
75 107
 SET SQL_MODE=@OLD_SQL_MODE;
76 108
 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
77 109
 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
@@ -114,3 +146,125 @@ INSERT INTO `captcheck`.`answers` (`aid`, `aname`, `aimg`) VALUES (30, 'gear', '
114 146
 
115 147
 COMMIT;
116 148
 
149
+
150
+-- -----------------------------------------------------
151
+-- Data for table `captcheck`.`access_questions`
152
+-- -----------------------------------------------------
153
+START TRANSACTION;
154
+USE `captcheck`;
155
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (1, 'The list pink, yellow, library and purple contains how many colours?');
156
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (2, 'If the sock is black, what colour is it?');
157
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (3, 'Rice, bee and green: how many colours in the list?');
158
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (4, 'Enter the lowest number of seventy four, six or 73:');
159
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (5, '67, twelve, fifty, 34, thirty or thirteen: which of these is the largest?');
160
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (6, '48, sixty six, eighty seven, sixty nine, twenty seven or 69: the largest is?');
161
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (7, '39, twenty two, thirteen and 19: the 3rd number is?');
162
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (8, 'What number is 1st in the series fourteen, 34, 1, 24 and thirty six?');
163
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (9, 'Enter the number eighty three thousand six hundred and thirty one in digits:');
164
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (10, 'Enter the number seventy seven thousand and fifty in digits:');
165
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (11, 'What is the 7th digit in 5044750?');
166
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (12, 'Which digit is 7th in the number 6172149?');
167
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (13, 'What is the 2nd colour in the list black, rice, sock, tongue and green?');
168
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (14, 'What is sixty seven thousand one hundred and eighty six as digits?');
169
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (15, 'Which of ten, fifty nine or fifty four is the highest?');
170
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (16, 'The list rainjacket, hand, brown and tracksuit contains how many colours?');
171
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (17, 'The list thumb, bread, arm, church, glove and shark contains how many body parts?');
172
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (18, 'The 1st number from 32, 5 and twenty three is?');
173
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (19, 'What is seventy four thousand and three as digits?');
174
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (20, 'Fifteen - four equals ?');
175
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (21, 'Enter the biggest number of eleven, ninety, 58 or 84:');
176
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (22, 'If the trousers is green, what colour is it?');
177
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (23, 'The 1st number from six, twenty four and twenty two is?');
178
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (24, 'Enter the number twenty thousand six hundred and five in digits:');
179
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (25, 'If a person is called Elizabeth, what is their name?');
180
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (26, 'If tomorrow is Tuesday, what day is today?');
181
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (27, 'Six plus 10 is what?');
182
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (28, '83, seventy seven or forty one: the smallest is?');
183
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (29, 'In the number 2244803, what is the 1st digit?');
184
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (30, 'Steven\'s name is?');
185
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (31, 'The list house, finger, eye and stomach contains how many body parts?');
186
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (32, 'What is the 2nd digit in 3658990?');
187
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (33, 'If the rainjacket is red, what colour is it?');
188
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (34, 'Of the numbers fifty nine, 21, 51, fourteen or 6, which is the biggest?');
189
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (35, 'The name of Elizabeth is?');
190
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (36, 'The purple cake is what colour?');
191
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (37, 'The 2nd colour in white, ear, pink, red, fruit and brown is?');
192
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (38, 'What is the 1st colour in the list butter, red, purple and snake?');
193
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (39, 'What is the 3rd digit in 8705374?');
194
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (40, 'What is fifty nine thousand five hundred and seven as a number?');
195
+
196
+COMMIT;
197
+
198
+
199
+-- -----------------------------------------------------
200
+-- Data for table `captcheck`.`access_answers`
201
+-- -----------------------------------------------------
202
+START TRANSACTION;
203
+USE `captcheck`;
204
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (1, 1, 'NULL', 'eccbc87e4b5ce2fe28308fd9f2a7baf3');
205
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (2, 1, 'NULL', '35d6d33467aae9a2e3dccb4b6b027878');
206
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (3, 2, 'NULL', '1ffd9e753c8054cc61456ac7fac1ac89');
207
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (4, 3, 'NULL', 'c4ca4238a0b923820dcc509a6f75849b');
208
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (5, 3, 'NULL', 'f97c5d29941bfb1b2fdab0874906ab82');
209
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (6, 4, 'NULL', '1679091c5a880faf6fb5e6087eb1b2dc');
210
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (7, 4, 'NULL', 'f52b5e449a2303c031a0c3a1109360bf');
211
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (8, 5, 'NULL', '735b90b4568125ed6c3f678819b6e058');
212
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (9, 5, 'NULL', 'bd8c596e0540a2e53362ffd8e83c0af1');
213
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (10, 6, 'NULL', 'c7e1249ffc03eb9ded908c236bd1996d');
214
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (11, 6, 'NULL', 'a3862f91f724b3ba93c0d29d596091aa');
215
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (12, 7, 'NULL', 'c51ce410c124a10e0db5e4b97fc2af39');
216
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (13, 7, 'NULL', '422ecc084f2458defc620ecebf2a6448');
217
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (14, 8, 'NULL', 'aab3238922bcc25a6f606eb525ffdc56');
218
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (15, 8, 'NULL', '279e962ea623aa2a3a86739622772e1f');
219
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (16, 9, 'NULL', '99e8619d83ef705cde096f1413284f9d');
220
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (17, 10, 'NULL', '2c078e4b2c48fa83a11b825008177059');
221
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (18, 11, 'NULL', 'cfcd208495d565ef66e7dff9f98764da');
222
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (19, 11, 'NULL', 'd02c4c4cde7ae76252540d116a40f23a');
223
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (20, 12, 'NULL', '45c48cce2e2d7fbdea1afc51c7c6ad26');
224
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (21, 12, 'NULL', 'c785e1ed2950e3e36b1e2ca01f299a54');
225
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (22, 13, 'NULL', '9f27410725ab8cc8854a2769c7a516b8');
226
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (23, 14, 'NULL', '2a21883121a4da3cb0c12e42bf1ab4f9');
227
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (24, 15, 'NULL', '093f65e080a295f8076b1c5722a46aa2');
228
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (25, 15, 'NULL', '674573a74de9d057c6c5a70819b12f5f');
229
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (26, 16, 'NULL', 'c4ca4238a0b923820dcc509a6f75849b');
230
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (27, 16, 'NULL', 'f97c5d29941bfb1b2fdab0874906ab82');
231
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (28, 17, 'NULL', 'c81e728d9d4c2f636f067f89cc14862c');
232
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (29, 17, 'NULL', 'b8a9f715dbb64fd5c56e7783c6820a61');
233
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (30, 18, 'NULL', '6364d3f0f495b6ab9dcf8d3b5c6e0b01');
234
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (31, 18, 'NULL', '8cb16a6da2f0587a3a2b614040dbd2cf');
235
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (32, 19, 'NULL', '1180362fa4d3626eec0aacebeafbe5fc');
236
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (33, 20, 'NULL', '6512bd43d9caa6e02c990b0a82652dca');
237
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (34, 20, 'NULL', '9c8454ddf7aa50116496bac348d7550d');
238
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (35, 21, 'NULL', '8613985ec49eb8f757ae6439e879bb2a');
239
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (36, 21, 'NULL', '2a08e96cadfba8bfb49c392bd4ec27a7');
240
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (37, 22, 'NULL', '9f27410725ab8cc8854a2769c7a516b8');
241
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (38, 23, 'NULL', '1679091c5a880faf6fb5e6087eb1b2dc');
242
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (39, 23, 'NULL', 'f52b5e449a2303c031a0c3a1109360bf');
243
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (40, 24, 'NULL', '1b4f877baadb44b36ff73a44e05ebd4c');
244
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (41, 25, 'NULL', '4af09080574089cbece43db636e2025f');
245
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (42, 26, 'NULL', '944ba223a5c1b5f4b495708e7cd5ee37');
246
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (43, 26, 'NULL', '197639b278057c519189add5413712e3');
247
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (44, 27, 'NULL', 'c74d97b01eae257e44aa9d5bade97baf');
248
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (45, 27, 'NULL', 'bd2c775d9eaf5f71da52b55ade9989a4');
249
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (46, 28, 'NULL', '3416a75f4cea9109507cacd8e2f2aefc');
250
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (47, 28, 'NULL', '7b6cd20827f5a8a4576ef68f45a4ef32');
251
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (48, 29, 'NULL', 'c81e728d9d4c2f636f067f89cc14862c');
252
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (49, 29, 'NULL', 'b8a9f715dbb64fd5c56e7783c6820a61');
253
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (50, 30, 'NULL', '6ed61d4b80bb0f81937b32418e98adca');
254
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (51, 31, 'NULL', 'eccbc87e4b5ce2fe28308fd9f2a7baf3');
255
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (52, 31, 'NULL', '35d6d33467aae9a2e3dccb4b6b027878');
256
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (53, 32, 'NULL', '1679091c5a880faf6fb5e6087eb1b2dc');
257
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (54, 32, 'NULL', 'f52b5e449a2303c031a0c3a1109360bf');
258
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (55, 33, 'NULL', 'bda9643ac6601722a28f238714274da4');
259
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (56, 34, 'NULL', '093f65e080a295f8076b1c5722a46aa2');
260
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (57, 34, 'NULL', '674573a74de9d057c6c5a70819b12f5f');
261
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (58, 35, 'NULL', '4af09080574089cbece43db636e2025f');
262
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (59, 36, 'NULL', 'bb7aedfa61007447dd6efaf9f37641e3');
263
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (60, 37, 'NULL', '4a0b0dcedd48f780778d1cd1bb8f9877');
264
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (61, 38, 'NULL', 'bda9643ac6601722a28f238714274da4');
265
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (62, 39, 'NULL', 'cfcd208495d565ef66e7dff9f98764da');
266
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (63, 39, 'NULL', 'd02c4c4cde7ae76252540d116a40f23a');
267
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (64, 40, 'NULL', '454cba7bd267c3f60d982416d06516f6');
268
+
269
+COMMIT;
270
+

+ 164
- 0
db_upgrade/0.3_to_0.4.sql ファイルの表示

@@ -0,0 +1,164 @@
1
+SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
2
+SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
3
+SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';
4
+
5
+ALTER TABLE `captcheck`.`sessions` 
6
+ADD COLUMN `acqid` INT(11) NOT NULL AFTER `aid`,
7
+ADD INDEX `fk_sessions_access_qa1_idx` (`acqid` ASC);
8
+
9
+CREATE TABLE IF NOT EXISTS `captcheck`.`access_questions` (
10
+  `acqid` INT(11) NOT NULL AUTO_INCREMENT,
11
+  `acqtext` VARCHAR(255) NOT NULL,
12
+  PRIMARY KEY (`acqid`),
13
+  UNIQUE INDEX `qaid_UNIQUE` (`acqid` ASC))
14
+ENGINE = InnoDB
15
+DEFAULT CHARACTER SET = utf8;
16
+
17
+CREATE TABLE IF NOT EXISTS `captcheck`.`access_answers` (
18
+  `acaid` INT(11) NOT NULL AUTO_INCREMENT,
19
+  `acqid` INT(11) NOT NULL,
20
+  `acatext` VARCHAR(45) NULL DEFAULT NULL,
21
+  `acahash` VARCHAR(32) NULL DEFAULT NULL,
22
+  PRIMARY KEY (`acaid`, `acqid`),
23
+  UNIQUE INDEX `acaid_UNIQUE` (`acaid` ASC),
24
+  INDEX `fk_access_answers_access_questions1_idx` (`acqid` ASC),
25
+  CONSTRAINT `fk_access_answers_access_questions1`
26
+    FOREIGN KEY (`acqid`)
27
+    REFERENCES `captcheck`.`access_questions` (`acqid`)
28
+    ON DELETE NO ACTION
29
+    ON UPDATE NO ACTION)
30
+ENGINE = InnoDB
31
+DEFAULT CHARACTER SET = utf8;
32
+
33
+ALTER TABLE `captcheck`.`sessions` 
34
+ADD CONSTRAINT `fk_sessions_access_qa1`
35
+  FOREIGN KEY (`acqid`)
36
+  REFERENCES `captcheck`.`access_questions` (`acqid`)
37
+  ON DELETE NO ACTION
38
+  ON UPDATE NO ACTION;
39
+
40
+
41
+SET SQL_MODE=@OLD_SQL_MODE;
42
+SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
43
+SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
44
+
45
+-- -----------------------------------------------------
46
+-- Data for table `captcheck`.`access_questions`
47
+-- -----------------------------------------------------
48
+START TRANSACTION;
49
+USE `captcheck`;
50
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (1, 'The list pink, yellow, library and purple contains how many colours?');
51
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (2, 'If the sock is black, what colour is it?');
52
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (3, 'Rice, bee and green: how many colours in the list?');
53
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (4, 'Enter the lowest number of seventy four, six or 73:');
54
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (5, '67, twelve, fifty, 34, thirty or thirteen: which of these is the largest?');
55
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (6, '48, sixty six, eighty seven, sixty nine, twenty seven or 69: the largest is?');
56
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (7, '39, twenty two, thirteen and 19: the 3rd number is?');
57
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (8, 'What number is 1st in the series fourteen, 34, 1, 24 and thirty six?');
58
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (9, 'Enter the number eighty three thousand six hundred and thirty one in digits:');
59
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (10, 'Enter the number seventy seven thousand and fifty in digits:');
60
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (11, 'What is the 7th digit in 5044750?');
61
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (12, 'Which digit is 7th in the number 6172149?');
62
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (13, 'What is the 2nd colour in the list black, rice, sock, tongue and green?');
63
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (14, 'What is sixty seven thousand one hundred and eighty six as digits?');
64
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (15, 'Which of ten, fifty nine or fifty four is the highest?');
65
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (16, 'The list rainjacket, hand, brown and tracksuit contains how many colours?');
66
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (17, 'The list thumb, bread, arm, church, glove and shark contains how many body parts?');
67
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (18, 'The 1st number from 32, 5 and twenty three is?');
68
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (19, 'What is seventy four thousand and three as digits?');
69
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (20, 'Fifteen - four equals ?');
70
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (21, 'Enter the biggest number of eleven, ninety, 58 or 84:');
71
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (22, 'If the trousers is green, what colour is it?');
72
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (23, 'The 1st number from six, twenty four and twenty two is?');
73
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (24, 'Enter the number twenty thousand six hundred and five in digits:');
74
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (25, 'If a person is called Elizabeth, what is their name?');
75
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (26, 'If tomorrow is Tuesday, what day is today?');
76
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (27, 'Six plus 10 is what?');
77
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (28, '83, seventy seven or forty one: the smallest is?');
78
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (29, 'In the number 2244803, what is the 1st digit?');
79
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (30, 'Steven\'s name is?');
80
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (31, 'The list house, finger, eye and stomach contains how many body parts?');
81
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (32, 'What is the 2nd digit in 3658990?');
82
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (33, 'If the rainjacket is red, what colour is it?');
83
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (34, 'Of the numbers fifty nine, 21, 51, fourteen or 6, which is the biggest?');
84
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (35, 'The name of Elizabeth is?');
85
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (36, 'The purple cake is what colour?');
86
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (37, 'The 2nd colour in white, ear, pink, red, fruit and brown is?');
87
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (38, 'What is the 1st colour in the list butter, red, purple and snake?');
88
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (39, 'What is the 3rd digit in 8705374?');
89
+INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (40, 'What is fifty nine thousand five hundred and seven as a number?');
90
+
91
+COMMIT;
92
+
93
+
94
+-- -----------------------------------------------------
95
+-- Data for table `captcheck`.`access_answers`
96
+-- -----------------------------------------------------
97
+START TRANSACTION;
98
+USE `captcheck`;
99
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (1, 1, 'NULL', 'eccbc87e4b5ce2fe28308fd9f2a7baf3');
100
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (2, 1, 'NULL', '35d6d33467aae9a2e3dccb4b6b027878');
101
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (3, 2, 'NULL', '1ffd9e753c8054cc61456ac7fac1ac89');
102
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (4, 3, 'NULL', 'c4ca4238a0b923820dcc509a6f75849b');
103
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (5, 3, 'NULL', 'f97c5d29941bfb1b2fdab0874906ab82');
104
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (6, 4, 'NULL', '1679091c5a880faf6fb5e6087eb1b2dc');
105
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (7, 4, 'NULL', 'f52b5e449a2303c031a0c3a1109360bf');
106
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (8, 5, 'NULL', '735b90b4568125ed6c3f678819b6e058');
107
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (9, 5, 'NULL', 'bd8c596e0540a2e53362ffd8e83c0af1');
108
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (10, 6, 'NULL', 'c7e1249ffc03eb9ded908c236bd1996d');
109
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (11, 6, 'NULL', 'a3862f91f724b3ba93c0d29d596091aa');
110
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (12, 7, 'NULL', 'c51ce410c124a10e0db5e4b97fc2af39');
111
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (13, 7, 'NULL', '422ecc084f2458defc620ecebf2a6448');
112
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (14, 8, 'NULL', 'aab3238922bcc25a6f606eb525ffdc56');
113
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (15, 8, 'NULL', '279e962ea623aa2a3a86739622772e1f');
114
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (16, 9, 'NULL', '99e8619d83ef705cde096f1413284f9d');
115
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (17, 10, 'NULL', '2c078e4b2c48fa83a11b825008177059');
116
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (18, 11, 'NULL', 'cfcd208495d565ef66e7dff9f98764da');
117
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (19, 11, 'NULL', 'd02c4c4cde7ae76252540d116a40f23a');
118
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (20, 12, 'NULL', '45c48cce2e2d7fbdea1afc51c7c6ad26');
119
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (21, 12, 'NULL', 'c785e1ed2950e3e36b1e2ca01f299a54');
120
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (22, 13, 'NULL', '9f27410725ab8cc8854a2769c7a516b8');
121
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (23, 14, 'NULL', '2a21883121a4da3cb0c12e42bf1ab4f9');
122
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (24, 15, 'NULL', '093f65e080a295f8076b1c5722a46aa2');
123
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (25, 15, 'NULL', '674573a74de9d057c6c5a70819b12f5f');
124
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (26, 16, 'NULL', 'c4ca4238a0b923820dcc509a6f75849b');
125
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (27, 16, 'NULL', 'f97c5d29941bfb1b2fdab0874906ab82');
126
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (28, 17, 'NULL', 'c81e728d9d4c2f636f067f89cc14862c');
127
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (29, 17, 'NULL', 'b8a9f715dbb64fd5c56e7783c6820a61');
128
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (30, 18, 'NULL', '6364d3f0f495b6ab9dcf8d3b5c6e0b01');
129
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (31, 18, 'NULL', '8cb16a6da2f0587a3a2b614040dbd2cf');
130
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (32, 19, 'NULL', '1180362fa4d3626eec0aacebeafbe5fc');
131
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (33, 20, 'NULL', '6512bd43d9caa6e02c990b0a82652dca');
132
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (34, 20, 'NULL', '9c8454ddf7aa50116496bac348d7550d');
133
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (35, 21, 'NULL', '8613985ec49eb8f757ae6439e879bb2a');
134
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (36, 21, 'NULL', '2a08e96cadfba8bfb49c392bd4ec27a7');
135
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (37, 22, 'NULL', '9f27410725ab8cc8854a2769c7a516b8');
136
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (38, 23, 'NULL', '1679091c5a880faf6fb5e6087eb1b2dc');
137
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (39, 23, 'NULL', 'f52b5e449a2303c031a0c3a1109360bf');
138
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (40, 24, 'NULL', '1b4f877baadb44b36ff73a44e05ebd4c');
139
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (41, 25, 'NULL', '4af09080574089cbece43db636e2025f');
140
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (42, 26, 'NULL', '944ba223a5c1b5f4b495708e7cd5ee37');
141
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (43, 26, 'NULL', '197639b278057c519189add5413712e3');
142
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (44, 27, 'NULL', 'c74d97b01eae257e44aa9d5bade97baf');
143
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (45, 27, 'NULL', 'bd2c775d9eaf5f71da52b55ade9989a4');
144
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (46, 28, 'NULL', '3416a75f4cea9109507cacd8e2f2aefc');
145
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (47, 28, 'NULL', '7b6cd20827f5a8a4576ef68f45a4ef32');
146
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (48, 29, 'NULL', 'c81e728d9d4c2f636f067f89cc14862c');
147
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (49, 29, 'NULL', 'b8a9f715dbb64fd5c56e7783c6820a61');
148
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (50, 30, 'NULL', '6ed61d4b80bb0f81937b32418e98adca');
149
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (51, 31, 'NULL', 'eccbc87e4b5ce2fe28308fd9f2a7baf3');
150
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (52, 31, 'NULL', '35d6d33467aae9a2e3dccb4b6b027878');
151
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (53, 32, 'NULL', '1679091c5a880faf6fb5e6087eb1b2dc');
152
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (54, 32, 'NULL', 'f52b5e449a2303c031a0c3a1109360bf');
153
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (55, 33, 'NULL', 'bda9643ac6601722a28f238714274da4');
154
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (56, 34, 'NULL', '093f65e080a295f8076b1c5722a46aa2');
155
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (57, 34, 'NULL', '674573a74de9d057c6c5a70819b12f5f');
156
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (58, 35, 'NULL', '4af09080574089cbece43db636e2025f');
157
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (59, 36, 'NULL', 'bb7aedfa61007447dd6efaf9f37641e3');
158
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (60, 37, 'NULL', '4a0b0dcedd48f780778d1cd1bb8f9877');
159
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (61, 38, 'NULL', 'bda9643ac6601722a28f238714274da4');
160
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (62, 39, 'NULL', 'cfcd208495d565ef66e7dff9f98764da');
161
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (63, 39, 'NULL', 'd02c4c4cde7ae76252540d116a40f23a');
162
+INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (64, 40, 'NULL', '454cba7bd267c3f60d982416d06516f6');
163
+
164
+COMMIT;

+ 33
- 0
scrapetexts.php ファイルの表示

@@ -0,0 +1,33 @@
1
+<?php
2
+
3
+/**
4
+ * A simple script to scrape text CAPTCHAs from an online service.
5
+ * 
6
+ * Set your email address and the number of CAPTCHAs to download.
7
+ * 
8
+ * For security, this script will by default terminate itself, so comment out 
9
+ * the die() command if you want to use it.
10
+ */
11
+die("Access denied.");
12
+
13
+
14
+require __DIR__ . '/required.php';
15
+header('Content-Type: text/plain');
16
+
17
+
18
+$email = "changeme@example.com";
19
+$rows = 20;
20
+$url = "http://api.textcaptcha.com/$email.json";
21
+
22
+for ($i = 0; $i < $rows; $i++) {
23
+    $data = json_decode(file_get_contents($url), TRUE);
24
+    $database->insert('access_questions', ["acqtext" => $data['q']]);
25
+    $id = $database->id();
26
+    foreach ($data['a'] as $a) {
27
+        $database->insert('access_answers', ["acqid" => $id, "acahash" => $a]);
28
+    }
29
+    echo ".";
30
+    ob_flush();
31
+    sleep(1);
32
+}
33
+echo "\ndone\n";

読み込み中…
キャンセル
保存