2015-07-09 11:50:41 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Plugin Name: CB Captcha
|
|
|
|
* Description: Stop spam signups like a boss with latest Captcha
|
2016-04-01 14:26:41 +05:00
|
|
|
* ClipBucket: version: 2.7.x
|
|
|
|
* Plugin: Version: 1.0
|
|
|
|
* Author: Saqib Razzaq
|
2015-07-09 11:50:41 +00:00
|
|
|
* @since 9th July, 2015 (ClipBucket 2.7.4)
|
2016-04-01 14:26:41 +05:00
|
|
|
* @modified: 1st April, 2016 ClipBucket 2.8.1
|
2015-07-09 11:50:41 +00:00
|
|
|
*/
|
|
|
|
define('CB_CAPTCHA',basename(dirname(__FILE__)));
|
|
|
|
|
|
|
|
// checks user's input
|
2016-04-01 14:26:41 +05:00
|
|
|
function validate_user_ans() {
|
|
|
|
if (isset($_POST['signup'])) {
|
2015-07-09 11:50:41 +00:00
|
|
|
$result = $_POST['g-recaptcha-response'];
|
2016-04-01 14:26:41 +05:00
|
|
|
if ($result == '') {
|
2016-04-01 12:13:12 +05:00
|
|
|
header("Location: ".BASEURL."/signup.php?valid=fail");
|
2015-07-09 11:50:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-04-01 14:26:41 +05:00
|
|
|
if (isset($_POST['signup'])) {
|
2015-07-09 11:50:41 +00:00
|
|
|
validate_user_ans();
|
|
|
|
}
|
|
|
|
|
|
|
|
// displaying the form
|
2016-04-01 14:26:41 +05:00
|
|
|
function the_form() {
|
2015-07-09 11:50:41 +00:00
|
|
|
global $db;
|
|
|
|
$key_check = $db->_select('SELECT the_key FROM '.tbl("the_captcha"));
|
|
|
|
$the_key = $key_check[0]['the_key'];
|
|
|
|
$site_key = $the_key;
|
|
|
|
echo '<div class="g-recaptcha" data-sitekey='.$site_key.'></div>';
|
|
|
|
}
|
|
|
|
|
|
|
|
register_anchor_function("the_form", "the_form");
|
|
|
|
add_admin_menu("CB Captcha" , "reCaptcha Key" , "cb_captcha_admin.php" , CB_CAPTCHA);
|
|
|
|
// used for displaying message on failure of captcha
|
|
|
|
template_files(PLUG_DIR."/cb_captcha/captcha.html");
|
|
|
|
?>
|