clipbucket/upload/plugins/cb_captcha/cb_captcha.php

40 lines
1.1 KiB
PHP
Raw Normal View History

<?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
* @since 9th July, 2015 (ClipBucket 2.7.4)
2016-04-01 14:26:41 +05:00
* @modified: 1st April, 2016 ClipBucket 2.8.1
*/
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'])) {
$result = $_POST['g-recaptcha-response'];
2016-04-01 14:26:41 +05:00
if ($result == '') {
header("Location: ".BASEURL."/signup.php?valid=fail");
}
}
}
2016-04-01 14:26:41 +05:00
if (isset($_POST['signup'])) {
validate_user_ans();
}
// displaying the form
2016-04-01 14:26:41 +05:00
function the_form() {
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");
?>