forked from nikkilocke/Captcheck
Compare commits
24 Commits
Author | SHA1 | Date | |
---|---|---|---|
a9b363c0b1 | |||
b2adec2271 | |||
97929c6731 | |||
1c725e7170 | |||
9d889455cc | |||
bc7e250972 | |||
b91d5c6872 | |||
9ad8d37858 | |||
897831e76c | |||
fb298289cf | |||
288d6aaf44 | |||
6c12179b49 | |||
f5ca72b318 | |||
987639decd | |||
f592ce0975 | |||
528b4b5954 | |||
7753d696b8 | |||
e955fa9885 | |||
b72de471fe | |||
60f8ae266f | |||
3758078b2d | |||
f18680c020 | |||
11231af4cd | |||
37ed36fa22 |
10
.env
Executable file
10
.env
Executable file
@ -0,0 +1,10 @@
|
||||
SUBNET=172.16.28
|
||||
EXPOSE_APACHE_WEB_SERVER_ON_PORT=8787
|
||||
EXPOSE_APACHE_WEB_SERVER_ONLY_ON_IP_ADDRESS_COLON=
|
||||
EXPOSE_MARIADB_ON_PORT=3386
|
||||
MARIADB_ROOT_PASSWORD=qwerty
|
||||
MARIADB_USERNAME=root
|
||||
MARIADB_PASSWORD=qwerty
|
||||
MARIADB_HOSTNAME=mariadb
|
||||
MARIADB_PORT=3306
|
||||
MARIADB_DATABASE_NAME=captcheck
|
2
.htaccess
Normal file
2
.htaccess
Normal file
@ -0,0 +1,2 @@
|
||||
RewriteEngine On
|
||||
RewriteRule ^captcheck.dist.js captcheck.min.js [L]
|
24
LICENSE
24
LICENSE
@ -1,9 +1,23 @@
|
||||
Copyright (C) 2017 Netsyms Technologies.
|
||||
Copyright (C) 2017-2021 Netsyms Technologies.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL NETSYMS TECHNOLOGIES BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
NETSYMS TECHNOLOGIES BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name and other identifying marks of Netsyms Technologies shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Netsyms Technologies.
|
||||
Except as contained in this notice, the name and other identifying marks of
|
||||
Netsyms Technologies shall not be used in advertising or otherwise to promote
|
||||
the sale, use or other dealings in this Software without prior written
|
||||
authorization from Netsyms Technologies.
|
38
api.php
38
api.php
@ -1,14 +1,17 @@
|
||||
<?php
|
||||
|
||||
require __DIR__ . '/required.php';
|
||||
use Medoo\Medoo;
|
||||
header("Content-Type: application/json");
|
||||
|
||||
// Oldest session allowed
|
||||
$session_min_date = date("Y-m-d H:i:s", strtotime("-" . SESSION_EXPIRE_MINUTES . " minutes"));
|
||||
// Delete old sessions
|
||||
$old_sessions = $database->select("sessions", "sid", ["timestamp[<]" => $session_min_date]);
|
||||
$database->delete("scrambled_answers", ["sid" => $old_sessions]);
|
||||
$database->delete("sessions", ["sid" => $old_sessions]);
|
||||
foreach ($old_sessions as $sid) {
|
||||
$database->delete("scrambled_answers", ["sid" => $sid]);
|
||||
$database->delete("sessions", ["sid" => $sid]);
|
||||
}
|
||||
|
||||
switch ($VARS['action']) {
|
||||
case "ping":
|
||||
@ -18,32 +21,47 @@ switch ($VARS['action']) {
|
||||
// generate unique session ID that has an essentially zero chance of being a duplicate.
|
||||
// Contains a hash of a secure random number, a hash of the user's IP, and 23 uniqid() characters.
|
||||
$skey = uniqid(substr(hash("md5", mt_rand()), 3, 5) . hash("md5", getUserIP()), true);
|
||||
$answers = $database->select('answers', ['aid', 'aname']);
|
||||
|
||||
// Image problem
|
||||
//
|
||||
// Get five random options
|
||||
$answer_count = $database->count('answers');
|
||||
$answers = $database->select('answers', ['aid', 'aname'], ["LIMIT" => [mt_rand(0, $answer_count - 6), 5]]);
|
||||
shuffle($answers);
|
||||
$answers = array_slice($answers, 0, 5);
|
||||
//var_dump($answers);
|
||||
// Pick a correct one at random
|
||||
$correct_answer = $answers[mt_rand(0, count($answers) - 1)];
|
||||
// Scramble the answer names so the client doesn't know the real answers.
|
||||
$scrambled = ["real" => [], "fake" => []];
|
||||
foreach ($answers as $a) {
|
||||
$scrambled["real"][] = $a['aid'];
|
||||
$scrambled["fake"][] = substr(hash("md5", mt_rand()), 0, 20);
|
||||
}
|
||||
$database->insert("sessions", ["skey" => $skey, "aid" => $correct_answer['aid'], "expired" => 0, "#timestamp" => "NOW()", "ipaddr" => getUserIP()]);
|
||||
|
||||
// Text problem
|
||||
//
|
||||
// Get random question
|
||||
$access_count = $database->count('access_questions');
|
||||
$access_question = $database->select('access_questions', ['acqid', 'acqtext'], ["LIMIT" => [mt_rand(0, $access_count - 1), 1]])[0];
|
||||
|
||||
// Save the session data
|
||||
$database->insert("sessions", ["skey" => $skey, "aid" => $correct_answer['aid'], "acqid" => $access_question['acqid'], "expired" => 0, "timestamp" => Medoo::raw("NOW()"), "ipaddr" => getUserIP()]);
|
||||
$sid = $database->id();
|
||||
// Save the answer data
|
||||
$scrambled_insert = [];
|
||||
for ($i = 0; $i < count($scrambled['real']); $i++) {
|
||||
$scrambled_insert[] = ["sid" => $sid, "aid" => $scrambled['real'][$i], "acode" => $scrambled['fake'][$i]];
|
||||
}
|
||||
$database->insert("scrambled_answers", $scrambled_insert);
|
||||
|
||||
// Vary question wording a little
|
||||
$questions = ["Please click on the [].", "Click the [].", "Find the []."];
|
||||
$accessible_questions = ["Please type [] here.", "Enter [] into the box.", "Type []."];
|
||||
shuffle($questions);
|
||||
shuffle($accessible_questions);
|
||||
|
||||
$resp = [
|
||||
"session" => $skey,
|
||||
"id_prefix" => substr(hash("md5", mt_rand()), 3, 5),
|
||||
"question_i" => str_replace("[]", $correct_answer['aname'], $questions[0]),
|
||||
"question_a" => str_replace("[]", $correct_answer['aname'], $accessible_questions[0]),
|
||||
"question_a" => $access_question['acqtext'],
|
||||
"answers" => $scrambled["fake"]
|
||||
];
|
||||
exit(json_encode($resp));
|
||||
@ -99,7 +117,7 @@ switch ($VARS['action']) {
|
||||
if ($database->has("scrambled_answers", ["AND" => ["sid" => $sid, "acode" => $VARS['answer_id']]])) {
|
||||
// Image maybe correct
|
||||
$image = true;
|
||||
} else if ($database->has("sessions", ["[>]answers" => ["aid" => "aid"]], ["AND" => ["sid" => $sid, "aname" => $VARS['answer_id']]])) {
|
||||
} else if ($database->has("sessions", ["[>]access_answers" => ["acqid" => "acqid"]], ["AND" => ["sid" => $sid, "OR" => ["acatext" => strtolower($VARS['answer_id']), "acahash" => hash('md5', strtolower($VARS['answer_id']))]]])) {
|
||||
// Accessible text correct
|
||||
$image = false;
|
||||
} else {
|
||||
|
@ -12,12 +12,17 @@ Don't use this file in your site; captcheck.js contains it.
|
||||
padding: 3px;
|
||||
margin: 5px 2px 5px 1px;
|
||||
background-color: #f5f5f5;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.captcheck_label_message,
|
||||
.captcheck_label_message b {
|
||||
color: black;
|
||||
font-family: Ubuntu, Arial, sans-serif;
|
||||
font-family: Ubuntu, Roboto, Arial, sans-serif;
|
||||
}
|
||||
|
||||
.captcheck_answer_label {
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
.captcheck_answer_label > input {
|
||||
@ -58,6 +63,7 @@ Don't use this file in your site; captcheck.js contains it.
|
||||
cursor: pointer;
|
||||
color: inherit;
|
||||
text-decoration: inherit;
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
.captcheck_answer_images {
|
||||
|
@ -1 +0,0 @@
|
||||
function chooseAnswer(e,t){var a=document.getElementById("captcheck_"+e+"_answer_"+t);return a.checked=!0,!1}function switchMode(e){var t=document.getElementById("captcheck_"+e+"_alt_question_button"),a=document.getElementById("captcheck_"+e+"_question_image"),c=document.getElementById("captcheck_"+e+"_question_access"),n=document.getElementById("captcheck_"+e+"_answer_images"),s=document.getElementById("captcheck_"+e+"_answer_access");"> Text mode"==t.innerHTML?(t.innerHTML="> Image mode",a.style.display="none",c.style.display="initial",n.style.display="none",s.style.display="initial",s.innerHTML="<input type='text' name='captcheck_selected_answer' aria-label='Type your answer here.' autocomplete='off' autofill='off'/>"):(t.innerHTML="> Text mode",a.style.display="initial",c.style.display="none",n.style.display="initial",s.style.display="none",s.innerHTML="")}window.onload=function(){var e="https://captcheck.netsyms.com/api.php",t=document.createElement("style");t.innerHTML=".captcheck_box,.captcheck_label_message,.captcheck_label_message b{color:#000;font-family:Ubuntu,Arial,sans-serif}.captcheck_box{border:1px solid #e0e0e0;border-radius:3px;display:inline-block;padding:3px;margin:5px 2px 5px 1px;background-color:#f5f5f5}.captcheck_answer_label>input{visibility:hidden;position:absolute}.captcheck_answer_label>input+img{cursor:pointer;border:2px solid transparent;border-radius:3px;min-width:32px;width:18%;max-width:64px}.captcheck_answer_label>input:checked+img{cursor:pointer;border:2px solid #424242;border-radius:3px}.captcheck_error_message{color:red}.captcheck_question_image{display:initial}.captcheck_question_access{display:none}.captcheck_alt_question_button{float:right;font-size:80%;cursor:pointer;color:inherit;text-decoration:inherit}.captcheck_answer_images{display:initial}.captcheck_answer_access{display:none}",document.body.appendChild(t),Array.prototype.forEach.call(document.getElementsByClassName("captcheck_container"),function(t){var a=new XMLHttpRequest;a.open("GET",e+"?action=new",!0),a.onreadystatechange=function(){if(4==this.readyState){var a=this.status,c=this.responseText,n=document.createElement("div");if(n.setAttribute("class","captcheck_box"),t.appendChild(n),200==a){for(var s=JSON.parse(c),i=s.id_prefix,r="<div class='captcheck_answer_images' id='captcheck_"+i+"_answer_images'>",o=0,l=s.answers.length;l>o;o++){var p=e+"?action=img&s="+s.session+"&c="+s.answers[o];r+="<a class='captcheck_answer_label' href='' tabindex='0' onClick='chooseAnswer(\""+i+'","'+s.answers[o]+"\"); return false;' onEnter='chooseAnswer(\""+i+'","'+s.answers[o]+"\"); return false;'><input id='captcheck_"+i+"_answer_"+s.answers[o]+"' type='radio' name='captcheck_selected_answer' value='"+s.answers[o]+"' /><img src='"+p+"' /></a>"}r+="</div>";var d=document.createElement("div");d.innerHTML=r+"<div class='captcheck_answer_access' id='captcheck_"+i+"_answer_access'></div>";var _=document.createElement("div");_.setAttribute("class","captcheck_label_message"),_.setAttribute("id","captcheck_"+i+"_label_message"),_.innerHTML="<span class='captcheck_question_image' id='captcheck_"+i+"_question_image'>"+s.question_i+"</span><span class='captcheck_question_access' id='captcheck_"+i+"_question_access'>"+s.question_a+"</span><a href='' class='captcheck_alt_question_button' onClick='switchMode(\""+i+"\"); return false;' onEnter='switchMode(\""+i+"\"); return false;' id='captcheck_"+i+"_alt_question_button' aria-label='Switch between image and text question' tabindex='0'>> Text mode</a>",n.appendChild(_),n.appendChild(d);var h=document.createElement("span");h.innerHTML="<input type='hidden' name='captcheck_session_code' value='"+s.session+"' />",n.appendChild(h)}else n.innerHTML="<span class='captcheck_error_message'>There was a problem loading the CAPTCHA.</span>"}},a.send()})};
|
148
captcheck.js
148
captcheck.js
@ -1,62 +1,7 @@
|
||||
window.onload = function () {
|
||||
|
||||
var api_url = "https://captcheck.netsyms.com/api.php";
|
||||
|
||||
/* Add custom styles */
|
||||
var styles = document.createElement('style');
|
||||
/* Remove newlines/comments from captcheck.css and put it here */
|
||||
styles.innerHTML = ".captcheck_box,.captcheck_label_message,.captcheck_label_message b{color:#000;font-family:Ubuntu,Arial,sans-serif}.captcheck_box{border:1px solid #e0e0e0;border-radius:3px;display:inline-block;padding:3px;margin:5px 2px 5px 1px;background-color:#f5f5f5}.captcheck_answer_label>input{visibility:hidden;position:absolute}.captcheck_answer_label>input+img{cursor:pointer;border:2px solid transparent;border-radius:3px;min-width:32px;width:18%;max-width:64px}.captcheck_answer_label>input:checked+img{cursor:pointer;border:2px solid #424242;border-radius:3px}.captcheck_error_message{color:red}.captcheck_question_image{display:initial}.captcheck_question_access{display:none}.captcheck_alt_question_button{float:right;font-size:80%;cursor:pointer;color:inherit;text-decoration:inherit}.captcheck_answer_images{display:initial}.captcheck_answer_access{display:none}";
|
||||
document.body.appendChild(styles);
|
||||
|
||||
/* Loop over all the CAPTCHA containers on the page, setting up a different CAPTCHA in each */
|
||||
Array.prototype.forEach.call(document.getElementsByClassName("captcheck_container"), function (container) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', api_url + "?action=new", true);
|
||||
xhr.onreadystatechange = function () {
|
||||
if (this.readyState == 4) {
|
||||
var status = this.status;
|
||||
var json = this.responseText;
|
||||
/* Create captcha div */
|
||||
var captcha = document.createElement("div");
|
||||
captcha.setAttribute("class", "captcheck_box");
|
||||
container.appendChild(captcha);
|
||||
|
||||
if (status == 200) {
|
||||
var data = JSON.parse(json);
|
||||
// ID prefix to use for this instance
|
||||
var idp = data.id_prefix;
|
||||
/* Create answer buttons */
|
||||
var answers = "<div class='captcheck_answer_images' id='captcheck_" + idp + "_answer_images'>";
|
||||
for (var i = 0, len = data.answers.length; i < len; i++) {
|
||||
var src = api_url + "?action=img&s=" + data.session + "&c=" + data.answers[i];
|
||||
answers += "<a class='captcheck_answer_label' href='' tabindex='0' onClick='chooseAnswer(\"" + idp + "\",\"" + data.answers[i] + "\"); return false;' onEnter='chooseAnswer(\"" + idp + "\",\"" + data.answers[i] + "\"); return false;'><input id='captcheck_" + idp + "_answer_" + data.answers[i] + "' type='radio' name='captcheck_selected_answer' value='" + data.answers[i] + "' /><img src='" + src + "' /></a>";
|
||||
}
|
||||
answers += "</div>";
|
||||
var answer_div = document.createElement("div");
|
||||
answer_div.innerHTML = answers + "<div class='captcheck_answer_access' id='captcheck_" + idp + "_answer_access'></div>";
|
||||
/* Create question */
|
||||
var question_div = document.createElement("div");
|
||||
question_div.setAttribute("class", "captcheck_label_message");
|
||||
question_div.setAttribute("id", "captcheck_" + idp + "_label_message")
|
||||
question_div.innerHTML = "<span class='captcheck_question_image' id='captcheck_" + idp + "_question_image'>" + data.question_i + "</span><span class='captcheck_question_access' id='captcheck_" + idp + "_question_access'>" + data.question_a + "</span><a href='' class='captcheck_alt_question_button' onClick='switchMode(\"" + idp + "\"); return false;' onEnter='switchMode(\"" + idp + "\"); return false;' id='captcheck_" + idp + "_alt_question_button' aria-label='Switch between image and text question' tabindex='0'>> Text mode</a>";
|
||||
|
||||
/* Add question and answers */
|
||||
captcha.appendChild(question_div);
|
||||
captcha.appendChild(answer_div);
|
||||
|
||||
/* Add hidden session ID element */
|
||||
var skey_input = document.createElement("span");
|
||||
skey_input.innerHTML = "<input type='hidden' name='captcheck_session_code' value='" + data.session + "' />";
|
||||
captcha.appendChild(skey_input);
|
||||
} else {
|
||||
/* Add error message */
|
||||
captcha.innerHTML = "<span class='captcheck_error_message'>There was a problem loading the CAPTCHA.</span>";
|
||||
}
|
||||
}
|
||||
};
|
||||
xhr.send();
|
||||
});
|
||||
}
|
||||
|
||||
function chooseAnswer(idp, ans) {
|
||||
var box = document.getElementById("captcheck_" + idp + "_answer_" + ans);
|
||||
box.checked = true;
|
||||
@ -85,3 +30,94 @@ function switchMode(idp) {
|
||||
acc_a.innerHTML = "";
|
||||
}
|
||||
}
|
||||
|
||||
var nonce = "";
|
||||
/* Loop over all the CAPTCHA containers on the page, setting up a different CAPTCHA in each */
|
||||
Array.prototype.forEach.call(document.getElementsByClassName("captcheck_container"), function (container) {
|
||||
if (container.dataset.stylenonce) {
|
||||
nonce = container.dataset.stylenonce;
|
||||
}
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', api_url + "?action=new", true);
|
||||
xhr.onreadystatechange = function () {
|
||||
if (this.readyState == 4) {
|
||||
var status = this.status;
|
||||
var json = this.responseText;
|
||||
/* Prevent rare bug where two CAPTCHAs appear in one container */
|
||||
if (container.innerHTML.trim() != "") {
|
||||
return;
|
||||
}
|
||||
/* Create captcha div */
|
||||
var captcha = document.createElement("div");
|
||||
captcha.setAttribute("class", "captcheck_box");
|
||||
container.appendChild(captcha);
|
||||
|
||||
if (status == 200) {
|
||||
var data = JSON.parse(json);
|
||||
// ID prefix to use for this instance
|
||||
var idp = data.id_prefix;
|
||||
/* Create answer buttons */
|
||||
var answers = "<div class='captcheck_answer_images' id='captcheck_" + idp + "_answer_images'>";
|
||||
for (var i = 0, len = data.answers.length; i < len; i++) {
|
||||
var src = api_url + "?action=img&s=" + data.session + "&c=" + data.answers[i];
|
||||
answers += "<a class='captcheck_answer_label' href='' data-prefix='" + idp + "' data-answer='" + data.answers[i] + "' tabindex='0' aria-role='button'><input id='captcheck_" + idp + "_answer_" + data.answers[i] + "' type='radio' name='captcheck_selected_answer' value='" + data.answers[i] + "' data-prefix='" + idp + "' data-answer='" + data.answers[i] + "' /><img src='" + src + "' data-prefix='" + idp + "' data-answer='" + data.answers[i] + "'/></a>";
|
||||
}
|
||||
answers += "</div>";
|
||||
var answer_div = document.createElement("div");
|
||||
answer_div.innerHTML = answers + "<div class='captcheck_answer_access' id='captcheck_" + idp + "_answer_access'></div>";
|
||||
/* Create question */
|
||||
var question_div = document.createElement("div");
|
||||
question_div.setAttribute("class", "captcheck_label_message");
|
||||
question_div.setAttribute("id", "captcheck_" + idp + "_label_message")
|
||||
question_div.innerHTML = "<span class='captcheck_question_image' id='captcheck_" + idp + "_question_image'>" + data.question_i + "</span><span class='captcheck_question_access' id='captcheck_" + idp + "_question_access'>" + data.question_a + "</span><a href='' class='captcheck_alt_question_button' data-prefix='" + idp + "' id='captcheck_" + idp + "_alt_question_button' aria-role='button' aria-label='Switch between image and text question' tabindex='0'>> Text mode</a>";
|
||||
|
||||
/* Add question and answers */
|
||||
captcha.appendChild(question_div);
|
||||
captcha.appendChild(answer_div);
|
||||
|
||||
/* Add hidden session ID element */
|
||||
var skey_input = document.createElement("span");
|
||||
skey_input.innerHTML = "<input type='hidden' name='captcheck_session_code' value='" + data.session + "' />";
|
||||
captcha.appendChild(skey_input);
|
||||
|
||||
var answer_buttons = document.querySelectorAll(".captcheck_answer_label[data-prefix=\"" + idp + "\"]");
|
||||
for (var i = 0; i < answer_buttons.length; i++) {
|
||||
answer_buttons[i].addEventListener("click", function (ev) {
|
||||
chooseAnswer(ev.target.getAttribute("data-prefix"), ev.target.getAttribute("data-answer"));
|
||||
ev.preventDefault();
|
||||
});
|
||||
answer_buttons[i].addEventListener('keydown', function (ev) {
|
||||
if (ev.key === "Enter" || ev.which === 13 || ev.keyCode === 13 || ev.key === ' ' || ev.which === 32 || ev.keyCode === 32) {
|
||||
chooseAnswer(ev.target.getAttribute("data-prefix"), ev.target.getAttribute("data-answer"));
|
||||
ev.preventDefault();
|
||||
}
|
||||
});
|
||||
}
|
||||
document.querySelector(".captcheck_alt_question_button[data-prefix=\"" + idp + "\"]").addEventListener("click", function (ev) {
|
||||
switchMode(ev.target.getAttribute("data-prefix"));
|
||||
ev.preventDefault();
|
||||
});
|
||||
document.querySelector(".captcheck_alt_question_button[data-prefix=\"" + idp + "\"]").addEventListener('keydown', function (ev) {
|
||||
if (ev.key === "Enter" || ev.which === 13 || ev.keyCode === 13 || ev.key === ' ' || ev.which === 32 || ev.keyCode === 32) {
|
||||
switchMode(ev.target.getAttribute("data-prefix"));
|
||||
ev.preventDefault();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
/* Add error message */
|
||||
captcha.innerHTML = "<span class='captcheck_error_message'>There was a problem loading the CAPTCHA.</span>";
|
||||
}
|
||||
}
|
||||
};
|
||||
xhr.send();
|
||||
});
|
||||
|
||||
/* Add custom styles */
|
||||
var styles = document.createElement('style');
|
||||
if (nonce != "") {
|
||||
styles.setAttribute("nonce", nonce);
|
||||
}
|
||||
/* Remove newlines/comments from captcheck.css and put it here */
|
||||
styles.innerHTML = ".captcheck_box{font-family:Ubuntu,Arial,sans-serif;color:black;border:1px solid #e0e0e0;border-radius:3px;display:inline-block;padding:3px;margin:5px 2px 5px 1px;background-color:#f5f5f5;text-decoration:none}.captcheck_label_message,.captcheck_label_message b{color:black;font-family:Ubuntu,Roboto,Arial,sans-serif}.captcheck_answer_label{border:0}.captcheck_answer_label>input{visibility:hidden;position:absolute}.captcheck_answer_label>input+img{cursor:pointer;border:2px solid transparent;border-radius:3px;min-width:32px;width:18%;max-width:64px}.captcheck_answer_label>input:checked+img{cursor:pointer;border:2px solid #424242;border-radius:3px}.captcheck_error_message{color:red}.captcheck_question_image{display:initial}.captcheck_question_access{display:none}.captcheck_alt_question_button{float:right;font-size:80%;cursor:pointer;color:inherit;text-decoration:inherit;border:0}.captcheck_answer_images{display:initial}.captcheck_answer_access{display:none}";
|
||||
document.body.appendChild(styles);
|
||||
}
|
9
captcheck.min.js
vendored
Normal file
9
captcheck.min.js
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
window.onload=function(){function m(c,g){document.getElementById("captcheck_"+c+"_answer_"+g).checked=!0;return!1}function n(c){var g=document.getElementById("captcheck_"+c+"_alt_question_button"),b=document.getElementById("captcheck_"+c+"_question_image"),d=document.getElementById("captcheck_"+c+"_question_access"),f=document.getElementById("captcheck_"+c+"_answer_images");c=document.getElementById("captcheck_"+c+"_answer_access");"> Text mode"==g.innerHTML?(g.innerHTML="> Image mode",b.style.display=
|
||||
"none",d.style.display="initial",f.style.display="none",c.style.display="initial",c.innerHTML="<input type='text' name='captcheck_selected_answer' aria-label='Type your answer here.' autocomplete='off' autofill='off'/>"):(g.innerHTML="> Text mode",b.style.display="initial",d.style.display="none",f.style.display="initial",c.style.display="none",c.innerHTML="")}var k="";Array.prototype.forEach.call(document.getElementsByClassName("captcheck_container"),function(c){c.dataset.stylenonce&&(k=c.dataset.stylenonce);
|
||||
var g=new XMLHttpRequest;g.open("GET","https://captcheck.netsyms.com/api.php?action=new",!0);g.onreadystatechange=function(){if(4==this.readyState){var b=this.status,d=this.responseText;if(""==c.innerHTML.trim()){var f=document.createElement("div");f.setAttribute("class","captcheck_box");c.appendChild(f);if(200==b){d=JSON.parse(d);b=d.id_prefix;for(var h="<div class='captcheck_answer_images' id='captcheck_"+b+"_answer_images'>",e=0,g=d.answers.length;e<g;e++)h+="<a class='captcheck_answer_label' href='' data-prefix='"+
|
||||
b+"' data-answer='"+d.answers[e]+"' tabindex='0' aria-role='button'><input id='captcheck_"+b+"_answer_"+d.answers[e]+"' type='radio' name='captcheck_selected_answer' value='"+d.answers[e]+"' data-prefix='"+b+"' data-answer='"+d.answers[e]+"' /><img src='"+("https://captcheck.netsyms.com/api.php?action=img&s="+d.session+"&c="+d.answers[e])+"' data-prefix='"+b+"' data-answer='"+d.answers[e]+"'/></a>";h+="</div>";e=document.createElement("div");e.innerHTML=h+"<div class='captcheck_answer_access' id='captcheck_"+
|
||||
b+"_answer_access'></div>";h=document.createElement("div");h.setAttribute("class","captcheck_label_message");h.setAttribute("id","captcheck_"+b+"_label_message");h.innerHTML="<span class='captcheck_question_image' id='captcheck_"+b+"_question_image'>"+d.question_i+"</span><span class='captcheck_question_access' id='captcheck_"+b+"_question_access'>"+d.question_a+"</span><a href='' class='captcheck_alt_question_button' data-prefix='"+b+"' id='captcheck_"+b+"_alt_question_button' aria-role='button' aria-label='Switch between image and text question' tabindex='0'>> Text mode</a>";
|
||||
f.appendChild(h);f.appendChild(e);h=document.createElement("span");h.innerHTML="<input type='hidden' name='captcheck_session_code' value='"+d.session+"' />";f.appendChild(h);f=document.querySelectorAll('.captcheck_answer_label[data-prefix="'+b+'"]');for(e=0;e<f.length;e++)f[e].addEventListener("click",function(a){m(a.target.getAttribute("data-prefix"),a.target.getAttribute("data-answer"));a.preventDefault()}),f[e].addEventListener("keydown",function(a){if("Enter"===a.key||13===a.which||13===a.keyCode||
|
||||
" "===a.key||32===a.which||32===a.keyCode)m(a.target.getAttribute("data-prefix"),a.target.getAttribute("data-answer")),a.preventDefault()});document.querySelector('.captcheck_alt_question_button[data-prefix="'+b+'"]').addEventListener("click",function(a){n(a.target.getAttribute("data-prefix"));a.preventDefault()});document.querySelector('.captcheck_alt_question_button[data-prefix="'+b+'"]').addEventListener("keydown",function(a){if("Enter"===a.key||13===a.which||13===a.keyCode||" "===a.key||32===
|
||||
a.which||32===a.keyCode)n(a.target.getAttribute("data-prefix")),a.preventDefault()})}else f.innerHTML="<span class='captcheck_error_message'>There was a problem loading the CAPTCHA.</span>"}}};g.send()});var l=document.createElement("style");""!=k&&l.setAttribute("nonce",k);l.innerHTML=".captcheck_box{font-family:Ubuntu,Arial,sans-serif;color:black;border:1px solid #e0e0e0;border-radius:3px;display:inline-block;padding:3px;margin:5px 2px 5px 1px;background-color:#f5f5f5;text-decoration:none}.captcheck_label_message,.captcheck_label_message b{color:black;font-family:Ubuntu,Roboto,Arial,sans-serif}.captcheck_answer_label{border:0}.captcheck_answer_label>input{visibility:hidden;position:absolute}.captcheck_answer_label>input+img{cursor:pointer;border:2px solid transparent;border-radius:3px;min-width:32px;width:18%;max-width:64px}.captcheck_answer_label>input:checked+img{cursor:pointer;border:2px solid #424242;border-radius:3px}.captcheck_error_message{color:red}.captcheck_question_image{display:initial}.captcheck_question_access{display:none}.captcheck_alt_question_button{float:right;font-size:80%;cursor:pointer;color:inherit;text-decoration:inherit;border:0}.captcheck_answer_images{display:initial}.captcheck_answer_access{display:none}";
|
||||
document.body.appendChild(l)};
|
24
composer.lock
generated
24
composer.lock
generated
@ -1,23 +1,23 @@
|
||||
{
|
||||
"_readme": [
|
||||
"This file locks the dependencies of your project to a known state",
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "3d60b6d6d1ba750afa45d307e067f006",
|
||||
"packages": [
|
||||
{
|
||||
"name": "catfan/medoo",
|
||||
"version": "v1.4.4",
|
||||
"version": "v1.7.10",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/catfan/Medoo.git",
|
||||
"reference": "bcabbef4d8355d52fc4d19f17463e5e816c9ef44"
|
||||
"reference": "2d675f73e23f63bbaeb9a8aa33318659a3d3c32f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/catfan/Medoo/zipball/bcabbef4d8355d52fc4d19f17463e5e816c9ef44",
|
||||
"reference": "bcabbef4d8355d52fc4d19f17463e5e816c9ef44",
|
||||
"url": "https://api.github.com/repos/catfan/Medoo/zipball/2d675f73e23f63bbaeb9a8aa33318659a3d3c32f",
|
||||
"reference": "2d675f73e23f63bbaeb9a8aa33318659a3d3c32f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -31,7 +31,7 @@
|
||||
"ext-pdo_oci8": "For Oracle version 8 database",
|
||||
"ext-pdo_pqsql": "For PostgreSQL database",
|
||||
"ext-pdo_sqlite": "For SQLite database",
|
||||
"ext-pdo_sqlsrv": "For MSSQL database on Windows platform"
|
||||
"ext-pdo_sqlsrv": "For MSSQL database on both Window/Liunx platform"
|
||||
},
|
||||
"type": "framework",
|
||||
"autoload": {
|
||||
@ -49,10 +49,11 @@
|
||||
"email": "angel@catfan.me"
|
||||
}
|
||||
],
|
||||
"description": "The lightest PHP database framework to accelerate development",
|
||||
"description": "The lightweight PHP database framework to accelerate development",
|
||||
"homepage": "https://medoo.in",
|
||||
"keywords": [
|
||||
"database",
|
||||
"database library",
|
||||
"lightweight",
|
||||
"mariadb",
|
||||
"mssql",
|
||||
@ -63,7 +64,11 @@
|
||||
"sql",
|
||||
"sqlite"
|
||||
],
|
||||
"time": "2017-06-02T15:25:04+00:00"
|
||||
"support": {
|
||||
"issues": "https://github.com/catfan/Medoo/issues",
|
||||
"source": "https://github.com/catfan/Medoo"
|
||||
},
|
||||
"time": "2020-02-11T08:20:42+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [],
|
||||
@ -73,5 +78,6 @@
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": [],
|
||||
"platform-dev": []
|
||||
"platform-dev": [],
|
||||
"plugin-api-version": "2.0.0"
|
||||
}
|
||||
|
BIN
database.mwb
BIN
database.mwb
Binary file not shown.
164
database.sql
164
database.sql
@ -1,8 +1,3 @@
|
||||
-- MySQL Script generated by MySQL Workbench
|
||||
-- Fri 09 Jun 2017 01:26:04 PM MDT
|
||||
-- Model: New Model Version: 1.0
|
||||
-- MySQL Workbench Forward Engineering
|
||||
|
||||
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
|
||||
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
|
||||
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
|
||||
@ -29,6 +24,17 @@ CREATE TABLE IF NOT EXISTS `captcheck`.`answers` (
|
||||
ENGINE = InnoDB;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `captcheck`.`access_questions`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `captcheck`.`access_questions` (
|
||||
`acqid` INT NOT NULL AUTO_INCREMENT,
|
||||
`acqtext` VARCHAR(255) NOT NULL,
|
||||
PRIMARY KEY (`acqid`),
|
||||
UNIQUE INDEX `qaid_UNIQUE` (`acqid` ASC))
|
||||
ENGINE = InnoDB;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `captcheck`.`sessions`
|
||||
-- -----------------------------------------------------
|
||||
@ -36,16 +42,23 @@ CREATE TABLE IF NOT EXISTS `captcheck`.`sessions` (
|
||||
`sid` INT NOT NULL AUTO_INCREMENT,
|
||||
`skey` VARCHAR(60) NOT NULL,
|
||||
`aid` INT NOT NULL,
|
||||
`acqid` INT NOT NULL,
|
||||
`expired` TINYINT(1) NOT NULL DEFAULT 0,
|
||||
`timestamp` DATETIME NOT NULL,
|
||||
`ipaddr` VARCHAR(45) NULL,
|
||||
PRIMARY KEY (`sid`),
|
||||
UNIQUE INDEX `sid_UNIQUE` (`sid` ASC),
|
||||
INDEX `fk_sessions_answers1_idx` (`aid` ASC),
|
||||
INDEX `fk_sessions_access_qa1_idx` (`acqid` ASC),
|
||||
CONSTRAINT `fk_sessions_answers1`
|
||||
FOREIGN KEY (`aid`)
|
||||
REFERENCES `captcheck`.`answers` (`aid`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION,
|
||||
CONSTRAINT `fk_sessions_access_qa1`
|
||||
FOREIGN KEY (`acqid`)
|
||||
REFERENCES `captcheck`.`access_questions` (`acqid`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION)
|
||||
ENGINE = InnoDB;
|
||||
|
||||
@ -72,6 +85,25 @@ CREATE TABLE IF NOT EXISTS `captcheck`.`scrambled_answers` (
|
||||
ENGINE = InnoDB;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `captcheck`.`access_answers`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `captcheck`.`access_answers` (
|
||||
`acaid` INT NOT NULL AUTO_INCREMENT,
|
||||
`acqid` INT NOT NULL,
|
||||
`acatext` VARCHAR(45) NULL,
|
||||
`acahash` VARCHAR(32) NULL,
|
||||
PRIMARY KEY (`acaid`, `acqid`),
|
||||
UNIQUE INDEX `acaid_UNIQUE` (`acaid` ASC),
|
||||
INDEX `fk_access_answers_access_questions1_idx` (`acqid` ASC),
|
||||
CONSTRAINT `fk_access_answers_access_questions1`
|
||||
FOREIGN KEY (`acqid`)
|
||||
REFERENCES `captcheck`.`access_questions` (`acqid`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION)
|
||||
ENGINE = InnoDB;
|
||||
|
||||
|
||||
SET SQL_MODE=@OLD_SQL_MODE;
|
||||
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
|
||||
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
|
||||
@ -114,3 +146,125 @@ INSERT INTO `captcheck`.`answers` (`aid`, `aname`, `aimg`) VALUES (30, 'gear', '
|
||||
|
||||
COMMIT;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Data for table `captcheck`.`access_questions`
|
||||
-- -----------------------------------------------------
|
||||
START TRANSACTION;
|
||||
USE `captcheck`;
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (1, 'The list pink, yellow, library and purple contains how many colours?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (2, 'If the sock is black, what colour is it?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (3, 'Rice, bee and green: how many colours in the list?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (4, 'Enter the lowest number of seventy four, six or 73:');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (5, '67, twelve, fifty, 34, thirty or thirteen: which of these is the largest?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (6, '48, sixty six, eighty seven, sixty nine, twenty seven or 69: the largest is?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (7, '39, twenty two, thirteen and 19: the 3rd number is?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (8, 'What number is 1st in the series fourteen, 34, 1, 24 and thirty six?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (9, 'Enter the number eighty three thousand six hundred and thirty one in digits:');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (10, 'Enter the number seventy seven thousand and fifty in digits:');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (11, 'What is the 7th digit in 5044750?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (12, 'Which digit is 7th in the number 6172149?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (13, 'What is the 2nd colour in the list black, rice, sock, tongue and green?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (14, 'What is sixty seven thousand one hundred and eighty six as digits?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (15, 'Which of ten, fifty nine or fifty four is the highest?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (16, 'The list rainjacket, hand, brown and tracksuit contains how many colours?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (17, 'The list thumb, bread, arm, church, glove and shark contains how many body parts?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (18, 'The 1st number from 32, 5 and twenty three is?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (19, 'What is seventy four thousand and three as digits?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (20, 'Fifteen - four equals ?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (21, 'Enter the biggest number of eleven, ninety, 58 or 84:');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (22, 'If the trousers is green, what colour is it?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (23, 'The 1st number from six, twenty four and twenty two is?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (24, 'Enter the number twenty thousand six hundred and five in digits:');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (25, 'If a person is called Elizabeth, what is their name?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (26, 'If tomorrow is Tuesday, what day is today?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (27, 'Six plus 10 is what?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (28, '83, seventy seven or forty one: the smallest is?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (29, 'In the number 2244803, what is the 1st digit?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (30, 'Steven\'s name is?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (31, 'The list house, finger, eye and stomach contains how many body parts?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (32, 'What is the 2nd digit in 3658990?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (33, 'If the rainjacket is red, what colour is it?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (34, 'Of the numbers fifty nine, 21, 51, fourteen or 6, which is the biggest?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (35, 'The name of Elizabeth is?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (36, 'The purple cake is what colour?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (37, 'The 2nd colour in white, ear, pink, red, fruit and brown is?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (38, 'What is the 1st colour in the list butter, red, purple and snake?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (39, 'What is the 3rd digit in 8705374?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (40, 'What is fifty nine thousand five hundred and seven as a number?');
|
||||
|
||||
COMMIT;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Data for table `captcheck`.`access_answers`
|
||||
-- -----------------------------------------------------
|
||||
START TRANSACTION;
|
||||
USE `captcheck`;
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (1, 1, 'NULL', 'eccbc87e4b5ce2fe28308fd9f2a7baf3');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (2, 1, 'NULL', '35d6d33467aae9a2e3dccb4b6b027878');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (3, 2, 'NULL', '1ffd9e753c8054cc61456ac7fac1ac89');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (4, 3, 'NULL', 'c4ca4238a0b923820dcc509a6f75849b');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (5, 3, 'NULL', 'f97c5d29941bfb1b2fdab0874906ab82');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (6, 4, 'NULL', '1679091c5a880faf6fb5e6087eb1b2dc');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (7, 4, 'NULL', 'f52b5e449a2303c031a0c3a1109360bf');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (8, 5, 'NULL', '735b90b4568125ed6c3f678819b6e058');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (9, 5, 'NULL', 'bd8c596e0540a2e53362ffd8e83c0af1');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (10, 6, 'NULL', 'c7e1249ffc03eb9ded908c236bd1996d');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (11, 6, 'NULL', 'a3862f91f724b3ba93c0d29d596091aa');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (12, 7, 'NULL', 'c51ce410c124a10e0db5e4b97fc2af39');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (13, 7, 'NULL', '422ecc084f2458defc620ecebf2a6448');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (14, 8, 'NULL', 'aab3238922bcc25a6f606eb525ffdc56');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (15, 8, 'NULL', '279e962ea623aa2a3a86739622772e1f');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (16, 9, 'NULL', '99e8619d83ef705cde096f1413284f9d');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (17, 10, 'NULL', '2c078e4b2c48fa83a11b825008177059');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (18, 11, 'NULL', 'cfcd208495d565ef66e7dff9f98764da');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (19, 11, 'NULL', 'd02c4c4cde7ae76252540d116a40f23a');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (20, 12, 'NULL', '45c48cce2e2d7fbdea1afc51c7c6ad26');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (21, 12, 'NULL', 'c785e1ed2950e3e36b1e2ca01f299a54');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (22, 13, 'NULL', '9f27410725ab8cc8854a2769c7a516b8');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (23, 14, 'NULL', '2a21883121a4da3cb0c12e42bf1ab4f9');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (24, 15, 'NULL', '093f65e080a295f8076b1c5722a46aa2');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (25, 15, 'NULL', '674573a74de9d057c6c5a70819b12f5f');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (26, 16, 'NULL', 'c4ca4238a0b923820dcc509a6f75849b');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (27, 16, 'NULL', 'f97c5d29941bfb1b2fdab0874906ab82');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (28, 17, 'NULL', 'c81e728d9d4c2f636f067f89cc14862c');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (29, 17, 'NULL', 'b8a9f715dbb64fd5c56e7783c6820a61');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (30, 18, 'NULL', '6364d3f0f495b6ab9dcf8d3b5c6e0b01');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (31, 18, 'NULL', '8cb16a6da2f0587a3a2b614040dbd2cf');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (32, 19, 'NULL', '1180362fa4d3626eec0aacebeafbe5fc');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (33, 20, 'NULL', '6512bd43d9caa6e02c990b0a82652dca');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (34, 20, 'NULL', '9c8454ddf7aa50116496bac348d7550d');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (35, 21, 'NULL', '8613985ec49eb8f757ae6439e879bb2a');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (36, 21, 'NULL', '2a08e96cadfba8bfb49c392bd4ec27a7');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (37, 22, 'NULL', '9f27410725ab8cc8854a2769c7a516b8');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (38, 23, 'NULL', '1679091c5a880faf6fb5e6087eb1b2dc');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (39, 23, 'NULL', 'f52b5e449a2303c031a0c3a1109360bf');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (40, 24, 'NULL', '1b4f877baadb44b36ff73a44e05ebd4c');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (41, 25, 'NULL', '4af09080574089cbece43db636e2025f');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (42, 26, 'NULL', '944ba223a5c1b5f4b495708e7cd5ee37');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (43, 26, 'NULL', '197639b278057c519189add5413712e3');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (44, 27, 'NULL', 'c74d97b01eae257e44aa9d5bade97baf');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (45, 27, 'NULL', 'bd2c775d9eaf5f71da52b55ade9989a4');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (46, 28, 'NULL', '3416a75f4cea9109507cacd8e2f2aefc');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (47, 28, 'NULL', '7b6cd20827f5a8a4576ef68f45a4ef32');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (48, 29, 'NULL', 'c81e728d9d4c2f636f067f89cc14862c');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (49, 29, 'NULL', 'b8a9f715dbb64fd5c56e7783c6820a61');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (50, 30, 'NULL', '6ed61d4b80bb0f81937b32418e98adca');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (51, 31, 'NULL', 'eccbc87e4b5ce2fe28308fd9f2a7baf3');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (52, 31, 'NULL', '35d6d33467aae9a2e3dccb4b6b027878');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (53, 32, 'NULL', '1679091c5a880faf6fb5e6087eb1b2dc');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (54, 32, 'NULL', 'f52b5e449a2303c031a0c3a1109360bf');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (55, 33, 'NULL', 'bda9643ac6601722a28f238714274da4');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (56, 34, 'NULL', '093f65e080a295f8076b1c5722a46aa2');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (57, 34, 'NULL', '674573a74de9d057c6c5a70819b12f5f');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (58, 35, 'NULL', '4af09080574089cbece43db636e2025f');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (59, 36, 'NULL', 'bb7aedfa61007447dd6efaf9f37641e3');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (60, 37, 'NULL', '4a0b0dcedd48f780778d1cd1bb8f9877');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (61, 38, 'NULL', 'bda9643ac6601722a28f238714274da4');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (62, 39, 'NULL', 'cfcd208495d565ef66e7dff9f98764da');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (63, 39, 'NULL', 'd02c4c4cde7ae76252540d116a40f23a');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (64, 40, 'NULL', '454cba7bd267c3f60d982416d06516f6');
|
||||
|
||||
COMMIT;
|
||||
|
||||
|
164
db_upgrade/0.3_to_0.4.sql
Normal file
164
db_upgrade/0.3_to_0.4.sql
Normal file
@ -0,0 +1,164 @@
|
||||
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
|
||||
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
|
||||
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';
|
||||
|
||||
ALTER TABLE `captcheck`.`sessions`
|
||||
ADD COLUMN `acqid` INT(11) NOT NULL AFTER `aid`,
|
||||
ADD INDEX `fk_sessions_access_qa1_idx` (`acqid` ASC);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `captcheck`.`access_questions` (
|
||||
`acqid` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`acqtext` VARCHAR(255) NOT NULL,
|
||||
PRIMARY KEY (`acqid`),
|
||||
UNIQUE INDEX `qaid_UNIQUE` (`acqid` ASC))
|
||||
ENGINE = InnoDB
|
||||
DEFAULT CHARACTER SET = utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `captcheck`.`access_answers` (
|
||||
`acaid` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`acqid` INT(11) NOT NULL,
|
||||
`acatext` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`acahash` VARCHAR(32) NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`acaid`, `acqid`),
|
||||
UNIQUE INDEX `acaid_UNIQUE` (`acaid` ASC),
|
||||
INDEX `fk_access_answers_access_questions1_idx` (`acqid` ASC),
|
||||
CONSTRAINT `fk_access_answers_access_questions1`
|
||||
FOREIGN KEY (`acqid`)
|
||||
REFERENCES `captcheck`.`access_questions` (`acqid`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION)
|
||||
ENGINE = InnoDB
|
||||
DEFAULT CHARACTER SET = utf8;
|
||||
|
||||
ALTER TABLE `captcheck`.`sessions`
|
||||
ADD CONSTRAINT `fk_sessions_access_qa1`
|
||||
FOREIGN KEY (`acqid`)
|
||||
REFERENCES `captcheck`.`access_questions` (`acqid`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION;
|
||||
|
||||
|
||||
SET SQL_MODE=@OLD_SQL_MODE;
|
||||
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
|
||||
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Data for table `captcheck`.`access_questions`
|
||||
-- -----------------------------------------------------
|
||||
START TRANSACTION;
|
||||
USE `captcheck`;
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (1, 'The list pink, yellow, library and purple contains how many colours?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (2, 'If the sock is black, what colour is it?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (3, 'Rice, bee and green: how many colours in the list?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (4, 'Enter the lowest number of seventy four, six or 73:');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (5, '67, twelve, fifty, 34, thirty or thirteen: which of these is the largest?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (6, '48, sixty six, eighty seven, sixty nine, twenty seven or 69: the largest is?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (7, '39, twenty two, thirteen and 19: the 3rd number is?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (8, 'What number is 1st in the series fourteen, 34, 1, 24 and thirty six?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (9, 'Enter the number eighty three thousand six hundred and thirty one in digits:');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (10, 'Enter the number seventy seven thousand and fifty in digits:');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (11, 'What is the 7th digit in 5044750?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (12, 'Which digit is 7th in the number 6172149?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (13, 'What is the 2nd colour in the list black, rice, sock, tongue and green?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (14, 'What is sixty seven thousand one hundred and eighty six as digits?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (15, 'Which of ten, fifty nine or fifty four is the highest?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (16, 'The list rainjacket, hand, brown and tracksuit contains how many colours?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (17, 'The list thumb, bread, arm, church, glove and shark contains how many body parts?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (18, 'The 1st number from 32, 5 and twenty three is?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (19, 'What is seventy four thousand and three as digits?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (20, 'Fifteen - four equals ?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (21, 'Enter the biggest number of eleven, ninety, 58 or 84:');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (22, 'If the trousers is green, what colour is it?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (23, 'The 1st number from six, twenty four and twenty two is?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (24, 'Enter the number twenty thousand six hundred and five in digits:');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (25, 'If a person is called Elizabeth, what is their name?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (26, 'If tomorrow is Tuesday, what day is today?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (27, 'Six plus 10 is what?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (28, '83, seventy seven or forty one: the smallest is?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (29, 'In the number 2244803, what is the 1st digit?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (30, 'Steven\'s name is?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (31, 'The list house, finger, eye and stomach contains how many body parts?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (32, 'What is the 2nd digit in 3658990?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (33, 'If the rainjacket is red, what colour is it?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (34, 'Of the numbers fifty nine, 21, 51, fourteen or 6, which is the biggest?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (35, 'The name of Elizabeth is?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (36, 'The purple cake is what colour?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (37, 'The 2nd colour in white, ear, pink, red, fruit and brown is?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (38, 'What is the 1st colour in the list butter, red, purple and snake?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (39, 'What is the 3rd digit in 8705374?');
|
||||
INSERT INTO `captcheck`.`access_questions` (`acqid`, `acqtext`) VALUES (40, 'What is fifty nine thousand five hundred and seven as a number?');
|
||||
|
||||
COMMIT;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Data for table `captcheck`.`access_answers`
|
||||
-- -----------------------------------------------------
|
||||
START TRANSACTION;
|
||||
USE `captcheck`;
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (1, 1, 'NULL', 'eccbc87e4b5ce2fe28308fd9f2a7baf3');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (2, 1, 'NULL', '35d6d33467aae9a2e3dccb4b6b027878');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (3, 2, 'NULL', '1ffd9e753c8054cc61456ac7fac1ac89');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (4, 3, 'NULL', 'c4ca4238a0b923820dcc509a6f75849b');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (5, 3, 'NULL', 'f97c5d29941bfb1b2fdab0874906ab82');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (6, 4, 'NULL', '1679091c5a880faf6fb5e6087eb1b2dc');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (7, 4, 'NULL', 'f52b5e449a2303c031a0c3a1109360bf');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (8, 5, 'NULL', '735b90b4568125ed6c3f678819b6e058');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (9, 5, 'NULL', 'bd8c596e0540a2e53362ffd8e83c0af1');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (10, 6, 'NULL', 'c7e1249ffc03eb9ded908c236bd1996d');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (11, 6, 'NULL', 'a3862f91f724b3ba93c0d29d596091aa');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (12, 7, 'NULL', 'c51ce410c124a10e0db5e4b97fc2af39');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (13, 7, 'NULL', '422ecc084f2458defc620ecebf2a6448');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (14, 8, 'NULL', 'aab3238922bcc25a6f606eb525ffdc56');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (15, 8, 'NULL', '279e962ea623aa2a3a86739622772e1f');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (16, 9, 'NULL', '99e8619d83ef705cde096f1413284f9d');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (17, 10, 'NULL', '2c078e4b2c48fa83a11b825008177059');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (18, 11, 'NULL', 'cfcd208495d565ef66e7dff9f98764da');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (19, 11, 'NULL', 'd02c4c4cde7ae76252540d116a40f23a');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (20, 12, 'NULL', '45c48cce2e2d7fbdea1afc51c7c6ad26');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (21, 12, 'NULL', 'c785e1ed2950e3e36b1e2ca01f299a54');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (22, 13, 'NULL', '9f27410725ab8cc8854a2769c7a516b8');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (23, 14, 'NULL', '2a21883121a4da3cb0c12e42bf1ab4f9');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (24, 15, 'NULL', '093f65e080a295f8076b1c5722a46aa2');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (25, 15, 'NULL', '674573a74de9d057c6c5a70819b12f5f');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (26, 16, 'NULL', 'c4ca4238a0b923820dcc509a6f75849b');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (27, 16, 'NULL', 'f97c5d29941bfb1b2fdab0874906ab82');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (28, 17, 'NULL', 'c81e728d9d4c2f636f067f89cc14862c');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (29, 17, 'NULL', 'b8a9f715dbb64fd5c56e7783c6820a61');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (30, 18, 'NULL', '6364d3f0f495b6ab9dcf8d3b5c6e0b01');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (31, 18, 'NULL', '8cb16a6da2f0587a3a2b614040dbd2cf');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (32, 19, 'NULL', '1180362fa4d3626eec0aacebeafbe5fc');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (33, 20, 'NULL', '6512bd43d9caa6e02c990b0a82652dca');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (34, 20, 'NULL', '9c8454ddf7aa50116496bac348d7550d');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (35, 21, 'NULL', '8613985ec49eb8f757ae6439e879bb2a');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (36, 21, 'NULL', '2a08e96cadfba8bfb49c392bd4ec27a7');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (37, 22, 'NULL', '9f27410725ab8cc8854a2769c7a516b8');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (38, 23, 'NULL', '1679091c5a880faf6fb5e6087eb1b2dc');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (39, 23, 'NULL', 'f52b5e449a2303c031a0c3a1109360bf');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (40, 24, 'NULL', '1b4f877baadb44b36ff73a44e05ebd4c');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (41, 25, 'NULL', '4af09080574089cbece43db636e2025f');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (42, 26, 'NULL', '944ba223a5c1b5f4b495708e7cd5ee37');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (43, 26, 'NULL', '197639b278057c519189add5413712e3');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (44, 27, 'NULL', 'c74d97b01eae257e44aa9d5bade97baf');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (45, 27, 'NULL', 'bd2c775d9eaf5f71da52b55ade9989a4');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (46, 28, 'NULL', '3416a75f4cea9109507cacd8e2f2aefc');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (47, 28, 'NULL', '7b6cd20827f5a8a4576ef68f45a4ef32');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (48, 29, 'NULL', 'c81e728d9d4c2f636f067f89cc14862c');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (49, 29, 'NULL', 'b8a9f715dbb64fd5c56e7783c6820a61');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (50, 30, 'NULL', '6ed61d4b80bb0f81937b32418e98adca');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (51, 31, 'NULL', 'eccbc87e4b5ce2fe28308fd9f2a7baf3');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (52, 31, 'NULL', '35d6d33467aae9a2e3dccb4b6b027878');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (53, 32, 'NULL', '1679091c5a880faf6fb5e6087eb1b2dc');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (54, 32, 'NULL', 'f52b5e449a2303c031a0c3a1109360bf');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (55, 33, 'NULL', 'bda9643ac6601722a28f238714274da4');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (56, 34, 'NULL', '093f65e080a295f8076b1c5722a46aa2');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (57, 34, 'NULL', '674573a74de9d057c6c5a70819b12f5f');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (58, 35, 'NULL', '4af09080574089cbece43db636e2025f');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (59, 36, 'NULL', 'bb7aedfa61007447dd6efaf9f37641e3');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (60, 37, 'NULL', '4a0b0dcedd48f780778d1cd1bb8f9877');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (61, 38, 'NULL', 'bda9643ac6601722a28f238714274da4');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (62, 39, 'NULL', 'cfcd208495d565ef66e7dff9f98764da');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (63, 39, 'NULL', 'd02c4c4cde7ae76252540d116a40f23a');
|
||||
INSERT INTO `captcheck`.`access_answers` (`acaid`, `acqid`, `acatext`, `acahash`) VALUES (64, 40, 'NULL', '454cba7bd267c3f60d982416d06516f6');
|
||||
|
||||
COMMIT;
|
26
docker-compose.yml
Executable file
26
docker-compose.yml
Executable file
@ -0,0 +1,26 @@
|
||||
version: "3.6"
|
||||
|
||||
services:
|
||||
web:
|
||||
build: ./docker-web
|
||||
restart: always
|
||||
ports:
|
||||
- ${EXPOSE_APACHE_WEB_SERVER_ONLY_ON_IP_ADDRESS_COLON}${EXPOSE_APACHE_WEB_SERVER_ON_PORT}:80
|
||||
volumes:
|
||||
- .:/var/www/html
|
||||
environment:
|
||||
MARIADB_USERNAME: ${MARIADB_USERNAME}
|
||||
MARIADB_PASSWORD: ${MARIADB_PASSWORD}
|
||||
MARIADB_HOSTNAME: ${MARIADB_HOSTNAME}
|
||||
MARIADB_PORT: ${MARIADB_PORT}
|
||||
MARIADB_DATABASE_NAME: ${MARIADB_DATABASE_NAME}
|
||||
|
||||
mariadb:
|
||||
image: mariadb:10.4
|
||||
restart: always
|
||||
volumes:
|
||||
- ./data:/var/lib/mysql
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: ${MARIADB_ROOT_PASSWORD}
|
||||
ports:
|
||||
- 127.0.0.1:${EXPOSE_MARIADB_ON_PORT}:${MARIADB_PORT}
|
13
docker-web/Dockerfile
Executable file
13
docker-web/Dockerfile
Executable file
@ -0,0 +1,13 @@
|
||||
FROM php:7.2-apache
|
||||
|
||||
RUN docker-php-ext-install mysqli pdo pdo_mysql
|
||||
RUN docker-php-ext-enable mysqli
|
||||
|
||||
RUN a2enmod rewrite
|
||||
|
||||
RUN apt-get update && apt-get install -y zlib1g-dev libpng-dev libfreetype6-dev
|
||||
|
||||
RUN docker-php-ext-configure gd --with-gd --with-zlib-dir --with-png-dir --with-freetype-dir
|
||||
|
||||
RUN docker-php-ext-install gd
|
||||
|
143
index.html
Normal file
143
index.html
Normal file
@ -0,0 +1,143 @@
|
||||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<meta content="width=device-width,initial-scale=1" name=viewport>
|
||||
<title>Captcheck</title>
|
||||
<link rel="stylesheet" href="https://static.netsyms.net/bootstrap/4/bootstrap.materia.min.css" />
|
||||
<link rel="stylesheet" href="https://static.netsyms.net/prism/prism.css" />
|
||||
<script async src="https://static.netsyms.net/fontawesome/5.2/js/all.min.js"></script>
|
||||
<script defer async src="https://static.netsyms.net/prism/prism.js"></script>
|
||||
<style>
|
||||
h2, h3, p {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
pre {
|
||||
padding-left: 5px;
|
||||
|
||||
}
|
||||
.bg-minty {
|
||||
background-color: #7dffd2;
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 768px) and (max-width: 991px) {
|
||||
h2, h3 {
|
||||
text-align: left;
|
||||
}
|
||||
.site-icon {
|
||||
margin-top: 18px;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 992px) and (max-width: 1199px) {
|
||||
h2, h3 {
|
||||
text-align: left;
|
||||
}
|
||||
.site-icon {
|
||||
margin-top: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 1200px) {
|
||||
h2, h3 {
|
||||
text-align: left;
|
||||
}
|
||||
.site-icon {
|
||||
margin-top: 0px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="container">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-12" style="text-align: center;" >
|
||||
<img src="logo.png" class="site-icon" style="width: 400px; max-width: 100%;" />
|
||||
</div>
|
||||
</div>
|
||||
<p style="font-size: 15px; line-height: 20px;">Open source reCAPTCHA alternative</p>
|
||||
<div class="d-flex">
|
||||
<ul class="nav nav-pills mx-auto">
|
||||
<li class="nav-item">
|
||||
<span class="nav-link">
|
||||
<i class="fab fa-php"></i> PHP 7
|
||||
</span>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<span class="nav-link">
|
||||
<i class="fas fa-database"></i> MySQL
|
||||
</span>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="https://source.netsyms.com/Netsyms/Captcheck/src/branch/master/LICENSE" style="color: #444;">
|
||||
<i class="fas fa-file-contract"></i> MIT
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="https://source.netsyms.com/Netsyms/Captcheck" style="color: #444;">
|
||||
<i class="fas fa-code-branch"></i> Git
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row my-4">
|
||||
<div class="col-12 col-md-6">
|
||||
<div class="card">
|
||||
<div class="card-header bg-minty">
|
||||
<h4 class="card-heading d-flex mb-0"><span class="mr-auto">Demo</span> <a onclick="document.getElementById('demoframe').src = document.getElementById('demoframe').src" title="Reset demo"><i class="fas fa-sync-alt"></i></a></h4>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<iframe style="border: 0px solid white; width: 100%; height: 100%; height: 350px;" src="test.html" id="demoframe"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-md-6">
|
||||
<div class="card">
|
||||
<div class="card-header bg-minty">
|
||||
<h4 class="card-heading mb-0">Use</h4>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<b>Put this in your page somewhere:</b>
|
||||
<pre><code class="language-html"><script src="https://captcheck.netsyms.com/captcheck.min.js"></script></code></pre>
|
||||
<b>Put this in your form where you want the CAPTCHA:</b>
|
||||
<pre><code class="language-html"><div class="captcheck_container"></div></code></pre>
|
||||
<b>Put this in your server-side form validation (PHP example):</b>
|
||||
<pre><code class="language-php">
|
||||
$url = 'https://captcheck.netsyms.com/api.php';
|
||||
$data = [
|
||||
'session_id' => $_POST['captcheck_session_code'],
|
||||
'answer_id' => $_POST['captcheck_selected_answer'],
|
||||
'action' => "verify"
|
||||
];
|
||||
$options = [
|
||||
'http' => [
|
||||
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
|
||||
'method' => 'POST',
|
||||
'content' => http_build_query($data)
|
||||
]
|
||||
];
|
||||
$context = stream_context_create($options);
|
||||
$result = file_get_contents($url, false, $context);
|
||||
$resp = json_decode($result, TRUE);
|
||||
if (!$resp['result']) {
|
||||
// Replace with error-handling code
|
||||
exit("CAPTCHA did not verify:" . $resp['msg']);
|
||||
} else {
|
||||
// The CAPTCHA is valid.
|
||||
exit("CAPTCHA verified!");
|
||||
}
|
||||
</code></pre>
|
||||
|
||||
<b>If you have a strict Content Security Policy, change your div to this:</b>
|
||||
<pre><code class="language-html"><div class="captcheck_container" data-stylenonce="your nonce here"></div></code></pre>
|
||||
|
||||
Note: by using this hosted service, you agree to <a href="https://netsyms.com/legal">these terms</a>. If you don't like them, feel free to host Captcheck on your own server.
|
||||
Popular sites should self-host as well just to be nice.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer"><p>Copyright © 2018 <a href="https://netsyms.com">Netsyms Technologies</a>. MIT License.<br /><a href="https://source.netsyms.com/Netsyms/Captcheck">Get the source</a> and run your own CAPTCHA service.</p></div>
|
||||
</div>
|
18
readme.md
18
readme.md
@ -1,15 +1,17 @@
|
||||
Captcheck
|
||||
=========
|
||||
<img src="https://source.netsyms.com/Netsyms/Captcheck/raw/master/logo.png" alt="Captcheck" style="max-width: 50%;" />
|
||||
|
||||
Easy, light, self-hostable CAPTCHA service. Works on all modern browsers and
|
||||
IE9+. Uses icons from Font-Awesome.
|
||||
|
||||
Easy, light, self-hostable CAPTCHA service. Works on modern browsers (and
|
||||
IE9+). Uses a selection of icons from Font-Awesome. Text-only accessibility
|
||||
mode and support for keyboard-only operation.
|
||||
|
||||
Thanks to textcaptcha.com for supplying the data for the text CAPTCHA.
|
||||
|
||||
How to use
|
||||
----------
|
||||
|
||||
In your form, put an empty div with the class "captcheck_container".
|
||||
Add `captcheck.js` (or `captcheck.dist.js`) into your page.
|
||||
Add `captcheck.js` (or `captcheck.min.js`) into your page.
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
@ -45,6 +47,12 @@ Example responses:
|
||||
`{"session":"some_session_id","result":true}`
|
||||
`{"session":"some_session_id","result":false,"msg":"Answer incorrect."}`
|
||||
|
||||
###Content-Security-Policy and Nonces
|
||||
|
||||
Add `data-stylenonce="nonce_here"` to the `.captcheck_container` div.
|
||||
If you have multiple CAPTCHAs on one page, only one of them needs the nonce
|
||||
specified.
|
||||
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
33
scrapetexts.php
Normal file
33
scrapetexts.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* A simple script to scrape text CAPTCHAs from an online service.
|
||||
*
|
||||
* Set your email address and the number of CAPTCHAs to download.
|
||||
*
|
||||
* For security, this script will by default terminate itself, so comment out
|
||||
* the die() command if you want to use it.
|
||||
*/
|
||||
die("Access denied.");
|
||||
|
||||
|
||||
require __DIR__ . '/required.php';
|
||||
header('Content-Type: text/plain');
|
||||
|
||||
|
||||
$email = "changeme@example.com";
|
||||
$rows = 20;
|
||||
$url = "http://api.textcaptcha.com/$email.json";
|
||||
|
||||
for ($i = 0; $i < $rows; $i++) {
|
||||
$data = json_decode(file_get_contents($url), TRUE);
|
||||
$database->insert('access_questions', ["acqtext" => $data['q']]);
|
||||
$id = $database->id();
|
||||
foreach ($data['a'] as $a) {
|
||||
$database->insert('access_answers', ["acqid" => $id, "acahash" => $a]);
|
||||
}
|
||||
echo ".";
|
||||
ob_flush();
|
||||
sleep(1);
|
||||
}
|
||||
echo "\ndone\n";
|
@ -1,17 +1,12 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Captcheck Sample Form</title>
|
||||
<meta charset="UTF-8">
|
||||
<title>Captcheck Sample Form</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<script src="captcheck.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<form action="test.php" method="POST">
|
||||
<input type="text" name="form_field" placeholder="Some random form field" />
|
||||
<div class="captcheck_container">
|
||||
</div>
|
||||
<button type="submit">Submit Form</button>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
|
12
test.php
12
test.php
@ -2,10 +2,6 @@
|
||||
|
||||
header("Content-Type: text/plain");
|
||||
|
||||
var_dump($_POST);
|
||||
|
||||
|
||||
|
||||
$url = 'https://captcheck.netsyms.com/api.php';
|
||||
$data = [
|
||||
'session_id' => $_POST['captcheck_session_code'],
|
||||
@ -22,6 +18,14 @@ $options = [
|
||||
$context = stream_context_create($options);
|
||||
$result = file_get_contents($url, false, $context);
|
||||
$resp = json_decode($result, TRUE);
|
||||
|
||||
echo "Form fields:\n";
|
||||
var_export($_POST);
|
||||
echo "\n\nAPI request fields:\n";
|
||||
var_export($data);
|
||||
echo "\n\nAPI response (JSON):\n";
|
||||
echo json_encode(json_decode($result, TRUE), JSON_PRETTY_PRINT);
|
||||
|
||||
if (!$resp['result']) {
|
||||
exit("\n\nCAPTCHA did not verify: " . $resp['msg']);
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user