Esempio n. 1
0
function faucet_valid_captcha($SETTINGS, $remote_address, $captcha_data = array())
{
    $isGood = false;
    if ($SETTINGS->config["use_captcha"]) {
        if ($SETTINGS->config["captcha"] == "recaptcha") {
            //Load re-captcha library
            require_once './libraries/recaptchalib.php';
            $resp = @recaptcha_check_answer($SETTINGS->config["captcha_config"]["recpatcha_private_key"], $remote_address, $captcha_data['recaptcha_challenge_field'], $captcha_data['recaptcha_response_field']);
            $isGood = $resp->is_valid;
            // $resp->error;
        } elseif ($SETTINGS->config["captcha"] == "solvemedia") {
            //Load solvemedia library
            require_once './libraries/solvemedialib.php';
            $resp = @solvemedia_check_answer($SETTINGS->config["captcha_config"]["solvemedia_private_key"], $remote_address, $captcha_data['adcopy_challenge'], $captcha_data['adcopy_response'], $SETTINGS->config["captcha_config"]["solvemedia_hash_key"]);
            $isGood = $resp->is_valid;
            // $resp->error;
        } else {
            //Load simple captcha library
            @session_name($SETTINGS->config["captcha_config"]["simple_captcha_session_name"]);
            @session_start();
            $isGood = $captcha_data['captcha_code'] == @$_SESSION['captcha']['code'];
            //Prevent re-submissions
            unset($_SESSION['captcha']['code']);
        }
    } else {
        //If no CAPTCHA is in use, then return true
        $isGood = true;
    }
    return $isGood;
}
 /**
  * Reject form submission (and repopulate the form) if the captcha fails.
  * ...
  * @return array Message to return upon failure
  **/
 public function validate_captcha($unused, $control, $form)
 {
     $solvemedia_response = solvemedia_check_answer(Options::get('solvemedia__vkey'), $_SERVER["REMOTE_ADDR"], $_POST["adcopy_challenge"], $_POST["adcopy_response"], Options::get('solvemedia__hkey'));
     if ($solvemedia_response->is_valid) {
         EventLog::log(_t('Comment by %s approved by SolveMedia captcha.', array($comment->name), 'solvemedia'), 'info', 'comment', 'SolveMedia');
     } else {
         return array(_t('Your CAPTCHA attempt did not succeed: %s', array($solvemedia_response->error), 'solvemedia'));
     }
 }
Esempio n. 3
0
function captcha_check($registration_details)
{
    global $main_smarty, $the_template;
    require_once captcha_captchas_path . '/solvemedia/lib/solvemedialib.php';
    $privatekey = get_misc_data('adcopy_privkey');
    $hashkey = get_misc_data('adcopy_hashkey');
    $resp = solvemedia_check_answer($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["adcopy_challenge"], $_POST["adcopy_response"], $hashkey);
    if (!$resp->is_valid) {
        $main_smarty->assign('register_captcha_error', "The Solve Media puzzle answer provided is not correct. Please try again.");
        return false;
    } else {
        return true;
    }
}
Esempio n. 4
0
function spb_recaptcha_dosolvemedia()
{
    require_once "solvemedialib.php";
    $privkey = yourls_get_option('spb_recaptcha_solvemediaVKey', "");
    $hashkey = yourls_get_option('spb_recaptcha_solvemediaHKey', "");
    $solvemedia_response = solvemedia_check_answer($privkey, $_SERVER["REMOTE_ADDR"], $_POST["adcopy_challenge"], $_POST["adcopy_response"], $hashkey);
    if (!$solvemedia_response->is_valid) {
        //handle incorrect answer
        $response['message'] = "Error: " . $solvemedia_response->error;
        return $response;
    } else {
        return false;
    }
}
Esempio n. 5
0
     }
     if (in_array($data['default_captcha'], $captcha['available'])) {
         $captcha['selected'] = $data['default_captcha'];
     } else {
         if ($captcha['available']) {
             $captcha['selected'] = $captcha['available'][0];
         }
     }
 }
 #MuliCaptcha: And finally handle chosen captcha system
 switch ($captcha['selected']) {
     case 'SolveMedia':
         require_once "libs/solvemedialib.php";
         $data["captcha"] = solvemedia_get_html($data["solvemedia_challenge_key"], null, is_ssl());
         if (array_key_exists('address', $_POST)) {
             $resp = solvemedia_check_answer($data['solvemedia_verification_key'], getIP(), array_key_exists('adcopy_challenge', $_POST) ? $_POST['adcopy_challenge'] : '', array_key_exists('adcopy_response', $_POST) ? $_POST['adcopy_response'] : '', $data["solvemedia_auth_key"]);
             $data["captcha_valid"] = $resp->is_valid;
         }
         break;
     case 'reCaptcha':
         $data["captcha"] = str_replace('<:: your_site_key ::>', $data["recaptcha_public_key"], $recaptcha_template);
         if (array_key_exists('address', $_POST)) {
             $url = 'https://www.google.com/recaptcha/api/siteverify?secret=' . $data["recaptcha_private_key"] . '&response=' . (array_key_exists('g-recaptcha-response', $_POST) ? $_POST["g-recaptcha-response"] : '') . '&remoteip=' . getIP();
             $resp = json_decode(file_get_contents($url), true);
             $data['captcha_valid'] = $resp['success'];
         }
         break;
     case 'AreYouAHuman':
         require_once "libs/ayahlib.php";
         $ayah = new AYAH(array('publisher_key' => $data['ayah_publisher_key'], 'scoring_key' => $data['ayah_scoring_key'], 'web_service_host' => 'ws.areyouahuman.com', 'debug_mode' => false, 'use_curl' => !$connection_options['disable_curl']));
         $data['captcha'] = $ayah->getPublisherHTML();
Esempio n. 6
0
                <li><a href="http://eclectika.org/index1.php" style="text-decoration:none; color:white;">Accomodation</a></li>

                <li><a href="http://eclectika.org/index1.php" style="text-decoration:none; color:white;">Events</a></li>

                <li><a href="http://eclectika.org/index1.php" style="text-decoration:none; color:white;">Contact Us</a></li>
            </ul>
        </div>

        <div id="content" class="content">
            <h2 style="text-decoration: underline">Signup for Eclectika</h2><small><em><font color="#E1E1E1">Note : All fields with * are compulsory</font></em></small> <?php 
if ($_POST) {
    require 'serverinfo.php';
    $privkey = "arSuUTJHqxu1uarsXvuO6UyluliVw9Dq";
    $hashkey = "6CKg17T7.VmCnXxRZ3ARYmCEBP0Oit6-";
    $solvemedia_response = solvemedia_check_answer($privkey, $_SERVER["REMOTE_ADDR"], $_POST["adcopy_challenge"], $_POST["adcopy_response"], $hashkey);
    if (!$solvemedia_response->is_valid) {
        //handle incorrect answer
        print "<br/>Error: " . $solvemedia_response->error;
    } else {
        //process form here
        if (isset($_POST['name']) && isset($_POST['email']) && isset($_POST['username']) && isset($_POST['password']) && isset($_POST['cpassword']) && isset($_POST['gender']) && isset($_POST['college']) && isset($_POST['branch']) && isset($_POST['year']) && isset($_POST['mobile'])) {
            $name = mysqli_real_escape_string($con, $_POST['name']);
            $email = mysqli_real_escape_string($con, $_POST['email']);
            $username = mysqli_real_escape_string($con, $_POST['username']);
            $password = mysqli_real_escape_string($con, $_POST['password']);
            $cpassword = mysqli_real_escape_string($con, $_POST['cpassword']);
            $mobile = mysqli_real_escape_string($con, $_POST['mobile']);
            $gender = mysqli_real_escape_string($con, $_POST['gender']);
            $college = mysqli_real_escape_string($con, $_POST['college']);
            $branch = mysqli_real_escape_string($con, $_POST['branch']);
Esempio n. 7
0
 function check_entry($type = '')
 {
     global $GB_PG;
     $the_max_img_size = $this->db->VARS['max_img_size'] * 1024;
     $the_time = time();
     if (get_magic_quotes_gpc()) {
         $this->strip_all_slashes();
     }
     $this->name = htmlspecialchars($this->db->FormatString($this->name));
     $this->email = htmlspecialchars($this->db->FormatString($this->email));
     $this->location = htmlspecialchars($this->db->FormatString($this->location));
     $this->comment = htmlspecialchars($this->db->FormatString($this->comment));
     $this->icq = intval($this->db->FormatString($this->icq));
     $this->aim = htmlspecialchars($this->db->FormatString($this->aim));
     $this->msn = htmlspecialchars($this->db->FormatString($this->msn));
     $this->yahoo = htmlspecialchars($this->db->FormatString($this->yahoo));
     $this->skype = htmlspecialchars($this->db->FormatString($this->skype));
     // Are we checking for the honeypot?
     if ($this->db->VARS['honeypot'] == 1) {
         if ($this->honeypot == 1) {
             //sleep(20);
             return $this->form_addguest($this->db->gb_error($this->db->LANG['ErrorPost10'], 1), 0, 1);
         }
     }
     // Check if a timehash has been sent otherwise submitted data has been manipulated
     if ($this->timehash == '') {
         return $this->form_addguest($this->db->gb_error($this->db->LANG['ErrorPost4'] . ' (4)', 5), 0, 1);
     }
     // Are we running a bot test and if so is the answer empty?
     if (($this->db->VARS['antibottest'] == 1 || $this->db->VARS['antibottest'] == 2) && empty($this->bottest)) {
         return $this->form_addguest($this->db->gb_error($this->db->LANG['ErrorPost13'], 3), 0, 1);
     }
     // Just usual adding of slashes for protection
     if (!get_magic_quotes_gpc()) {
         $this->bottest = addslashes($this->bottest);
         $this->db->VARS['bottestanswer'] = addslashes($this->db->VARS['bottestanswer']);
         $this->timehash = addslashes($this->timehash);
     }
     /* 
      * We are using a bot test so lets check their answer
      * 1 - built in captcha or question and answer
      * 2 - Using third party captcha of Solve Media     
      */
     if ($this->db->VARS['antibottest'] == 1 && strtolower($this->bottest) != strtolower($this->db->VARS['bottestanswer'])) {
         return $this->form_addguest($this->db->gb_error($this->db->LANG['ErrorPost14'], 4), 0, 1);
     } elseif ($this->db->VARS['antibottest'] == 2) {
         if ($this->db->VARS['solve_media'] == 0 && !$this->db->captcha_test($this->bottest, $this->timehash)) {
             return $this->form_addguest($this->db->gb_error($this->db->LANG['ErrorPost14'], 4), 0, 1);
         } elseif ($this->db->VARS['solve_media'] == 1) {
             require_once LAZ_INCLUDE_PATH . '/solvemedialib.php';
             $privkey = 'IgTCJw84R-0k.RO.6NVgCAiaaDp5qzNW';
             $hashkey = 'YBb1ktjDEKcxkdb6fmgnjo.ODYvf0nbj';
             $adcopy_challenge = !get_magic_quotes_gpc() ? addslashes($_POST['adcopy_challenge']) : $_POST['adcopy_challenge'];
             $solvemedia_response = solvemedia_check_answer($privkey, $this->ip, $adcopy_challenge, $this->bottest, $hashkey);
             if (!$solvemedia_response->is_valid) {
                 return $this->form_addguest($this->db->gb_error($this->db->LANG['ErrorPost14'], 4), 0, 1);
             }
         }
     }
     // Make the timehash in to something we can use
     $decodedhash = $this->db->generate_timehash($this->timehash);
     // Now check if they have posted to fast
     if ($the_time < $decodedhash + $this->db->VARS['post_time_min'] && $this->db->VARS['post_time_min'] != 0) {
         return $this->form_addguest($this->db->gb_error($this->db->LANG['ErrorPost15']), 0, 1);
     }
     // Or possibly they took to long to post
     if ($the_time > $decodedhash + $this->db->VARS['post_time_max'] && $this->db->VARS['post_time_max'] != 0) {
         return $this->form_addguest($this->db->gb_error($this->db->LANG['ErrorPost16']), 1, 1);
     }
     /*
      * Do we want to check the headers? If so then do it
      * If they fail the check the error message will end with the number 5 followed by a .
      * with the next number indicating which header they failed on
      */
     if ($this->db->VARS['check_headers'] == 1) {
         if (($failedHeader = $this->db->check_headers(1, $this->ip)) != 0) {
             return $this->form_addguest($this->db->gb_error($this->db->LANG['ErrorPost4'] . ' (5.' . $failedHeader . ')', 6), 0, 1);
         }
     }
     // I have set a limit of 50 characters for the email address. Probably should increase that
     if (strlen($this->email) > 50) {
         return $this->form_addguest($this->db->gb_error($this->db->LANG['ErrorPost4']));
     }
     // Lets check that the email is valid by RFC specs
     if (!$this->db->check_emailaddress($this->email)) {
         $this->email = '';
     }
     // if their ICQ number is to low or to high then make it 0
     if ($this->icq < 1000 || $this->icq > 999999999) {
         $this->icq = 0;
     }
     /*
      * This section is just some bog standard checks such as
      * Check they gave us their name,
      * that the message isn't to short or to long.
      * do we require an email address and if so have they provided one,
      * any submitted URL is valid otherwise remove it.
      * For example (5.6) means that their hostname indicates they are on a banned host
      */
     if ($this->name == '') {
         return $this->form_addguest($this->db->gb_error($this->db->LANG['ErrorPost1']));
     } elseif (strlen($this->comment) < $this->db->VARS['min_text']) {
         return $this->form_addguest($this->db->gb_error($this->db->LANG['ErrorPost3']));
     } elseif (strlen($this->comment) > $this->db->VARS['max_text']) {
         return $this->form_addguest($this->db->gb_error($this->db->LANG['ErrorPost17']));
     } elseif (($this->db->VARS['require_email'] == 1 || $this->db->VARS['require_email'] == 4) && $this->email == '') {
         return $this->form_addguest($this->db->gb_error($this->db->LANG['ErrorPost12']));
     } else {
         $this->url = trim($this->url);
         //if (($this->url, 0, 7) !== 'http://')
         if (!preg_match('/^http(s)?\\:\\/\\//i', $this->url)) {
             $this->url = 'http://' . $this->url;
         }
         //if (!preg_match('/^http(s)?\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&%\$#_=]*)?$/i', $this->url))
         if (!preg_match('/^https?:\\/\\/[\\w\\#$%&~\\/.\\-;:=,?@\\[\\]+]+$/uis', $this->url)) {
             $this->url = '';
         }
         if (htmlspecialchars($this->url) != $this->url) {
             $this->url = '';
         }
     }
     // Check if their IP is banned
     if ($this->db->VARS['banned_ip'] == 1 || $this->db->VARS['sfs_confidence'] > 0) {
         $banned = $this->db->isBannedIp($this->ip, $this->db->VARS['banned_ip'], $this->db->VARS['sfs_confidence']);
         if ($banned == 1) {
             return $this->form_addguest($this->db->gb_error($this->db->LANG['ErrorPost9'], 2), 0, 1);
         } elseif ($banned == 2) {
             return $this->form_addguest($this->db->gb_error($this->db->LANG['ErrorPost9'], 9), 0, 1);
         }
     }
     // Check if enough time has passed since their last post
     if ($this->db->VARS['flood_check'] == 1) {
         if ($this->db->FloodCheck($this->ip)) {
             return $this->form_addguest($this->db->gb_error($this->db->LANG['ErrorPost8']), 0, 1);
         }
     }
     // Check no part of the post contains any banned words
     if ($this->db->BlockBadWords($this->name) || $this->db->BlockBadWords($this->email) || $this->db->BlockBadWords($this->location) || $this->db->BlockBadWords($this->comment) || $this->db->BlockBadWords($this->url)) {
         return $this->form_addguest($this->db->gb_error($this->db->LANG['ErrorPost10'], 7));
     }
     // Check that neither name nor location are to long
     if (!$this->db->CheckWordLength($this->name) || !$this->db->CheckWordLength($this->location)) {
         return $this->form_addguest($this->db->gb_error($this->db->LANG['ErrorPost4'] . ' (3)'));
     }
     // Check their entry is not longer than allowed
     if (!$this->db->CheckWordLength($this->comment)) {
         return $this->form_addguest($this->db->gb_error($this->db->LANG['ErrorPost10']));
     }
     // Have they posted to many URLs?
     if ($this->db->VARS['max_url'] < 99) {
         if ($this->db->urlCounter($this->comment) > $this->db->VARS['max_url']) {
             return $this->form_addguest($this->db->gb_error($this->db->LANG['ErrorPost10'], 8));
         }
     }
     // If we want to check them againt the SFS database then lets do so
     if ($this->db->VARS['sfs_confidence'] > 0) {
         $sfsCheck = $this->db->SFSCheck($this->ip, $this->email);
         if ($sfsCheck != 0) {
             if ($sfsCheck == 3) {
                 $this->accepted = 0;
             } else {
                 $errorMessage = $sfsCheck == 1 ? $this->db->LANG['ErrorPost9'] : $this->db->LANG['ErrorPost4'];
                 return $this->form_addguest($this->db->gb_error($errorMessage . ' (sfs)', 9), 0, 1);
             }
         }
     }
     // Have they submitted an image, if so deal with it
     if (is_array($this->userfile) && $this->db->VARS['allow_img'] == 1 && $this->userfile['userfile']['tmp_name'] != 'none' && strpos($this->userfile['userfile']['type'], 'image') === 0) {
         $extension = array('1' => 'gif', '2' => 'jpg', '3' => 'png', '6' => 'bmp');
         if ($this->userfile['userfile']['size'] > $the_max_img_size) {
             return $this->form_addguest($this->db->gb_error($this->db->LANG['ErrorPost6']));
         } else {
             move_uploaded_file($this->userfile['userfile']['tmp_name'], $this->include_path . '/tmp/img-' . $the_time . '.tmp');
             $size = GetImageSize($this->include_path . '/tmp/img-' . $the_time . '.tmp');
             if ($size !== false && ($size[2] > 0 && $size[2] < 4 || $size[2] == 6)) {
                 $this->image_file = 'img-' . $the_time . '.' . $extension[$size[2]];
                 $img = new gb_image();
                 $img->set_destdir($this->include_path . '/public');
                 $img->set_border_size($this->db->VARS['img_width'], $this->db->VARS['img_height']);
                 if ($type == 'preview') {
                     rename($this->include_path . '/tmp/img-' . $the_time . '.tmp', $this->include_path . '/tmp/' . $this->image_file);
                     chmod($this->include_path . '/tmp/' . $this->image_file, 0755);
                     $new_img_size = $img->get_img_size_format($size[0], $size[1]);
                     $GB_UPLOAD = 'tmp';
                     $row['p_filename'] = $this->image_file;
                     $row['p_filename2'] = $this->image_file;
                     $row['width'] = $size[0];
                     $row['height'] = $size[1];
                     $id = '1';
                     eval("\$this->tmp_image = \"" . $this->template->get_template('user_pic') . "\";");
                 } else {
                     rename($this->include_path . '/tmp/img-' . $the_time . '.tmp', $this->include_path . '/public/' . $this->image_file);
                     chmod($this->include_path . '/public/' . $this->image_file, 0755);
                     if ($this->db->VARS['thumbnail'] == 1) {
                         $min_size = 1024 * $this->db->VARS['thumb_min_fsize'];
                         $img->set_min_filesize($min_size);
                         $img->set_prefix('t_');
                         $img->create_thumbnail($this->include_path . '/public/' . $this->image_file, "{$this->image_file}");
                     }
                 }
             } else {
                 @unlink($this->include_path . '/tmp/img-' . $the_time . '.tmp');
                 return $this->form_addguest($this->db->gb_error($this->db->LANG['ErrorPost7']));
             }
         }
     }
     if (!empty($this->user_img)) {
         $illegalChars = array('?' => '', "\\" => '', ':' => '', '*' => '', '"' => '', '<' => '', '>' => '', '|' => '', '../' => '', './' => '', "\n" => '', "\r" => '', "\t" => '');
         $this->image_file = trim(strtr($this->user_img, $illegalChars));
         $this->image_file = file_exists($this->include_path . '/tmp/' . $this->image_file) ? $this->image_file : '';
         if (!empty($this->image_file)) {
             $img = new gb_image();
             $img->set_destdir($this->include_path . '/public');
             $img->set_border_size($this->db->VARS['img_width'], $this->db->VARS['img_height']);
             if ($type == 'preview') {
                 $size = getimagesize($this->include_path . '/tmp/' . $this->image_file);
                 $new_img_size = $img->get_img_size_format($size[0], $size[1]);
                 $GB_UPLOAD = 'tmp';
                 $row['p_filename'] = $this->image_file;
                 $row['p_filename2'] = $this->image_file;
                 $row['width'] = $size[0];
                 $row['height'] = $size[1];
                 $id = '1';
                 eval("\$this->tmp_image = \"" . $this->template->get_template('user_pic') . "\";");
             } else {
                 rename($this->include_path . '/tmp/' . $this->image_file, $this->include_path . '/public/' . $this->image_file);
                 chmod($this->include_path . '/public/' . $this->image_file, 0755);
                 if ($this->db->VARS['thumbnail'] == 1) {
                     $min_size = 1024 * $this->db->VARS['thumb_min_fsize'];
                     $img->set_min_filesize($min_size);
                     $img->set_prefix('t_');
                     $img->create_thumbnail($this->include_path . '/public/' . $this->image_file, "{$this->image_file}");
                 }
             }
         }
     }
     return 1;
 }
Esempio n. 8
0
require_once "maincore.php";
if (isset($_POST['with'])) {
    if ($_POST['wallet'] == '') {
        unset($_SESSION['wallet']);
        $_SESSION['error']['nowallet'] = true;
        header('Location:index.php');
        die;
    } else {
        $_SESSION['user']['wallet'] = trim($_POST['wallet']);
        $user = User_id($_SESSION['user']['wallet']);
        $_SESSION['user']['uid'] = $user['uid'];
        $_SESSION['user']['refid'] = $user['refid'];
        $_SESSION['user']['plnum'] = $user['plnum'];
    }
    $solvemedia_response = solvemedia_check_answer($verkey, $_SERVER["REMOTE_ADDR"], $_POST['adcopy_challenge'], $_POST['adcopy_response'], $hashkey);
    if ($solvemedia_response->is_valid) {
        global $apiurl, $apicode;
        $client = new SoapClient($apiurl);
        $prize = chance_creator($rewards);
        $response = $client->send($apicode, $_SESSION['user']['wallet'], $prize, 1);
        if ($response['status'] > 0) {
            $wait = $now + $setinterval * 60;
            $db->query("update tbl_user set `reset`='{$wait}',playnum=playnum+1,earn=earn+'{$prize}',ip='{$ip}' where user_id='" . $_SESSION['user']['uid'] . "'");
            $_SESSION['user']['succ'] = $prize;
            if ($_SESSION['user']['refid']) {
                $refearn = floor($prize * $ref_percent / 100);
                $db2->queryres("select wallet from tbl_user where user_id='" . $_SESSION['user']['refid'] . "'");
                $response = $client->send($apicode, $db2->res['wallet'], $refearn, 2, 'Referral earnings.');
            }
            unset($_SESSION['error']);
Esempio n. 9
0
 protected function _solvemedia($get_api = false)
 {
     require_once $this->fw->get('ROOT') . '/captcha_lib/solvemedialib.php';
     if (!$get_api) {
         $captcha = solvemedia_get_html($this->site_settings['faucet_solvemedia_challenge_key'], null, $ssl = $this->is_ssl());
         return $captcha;
         //bail early
     }
     $this->resp = solvemedia_check_answer($this->site_settings['faucet_solvemedia_verification_key'], $this->fw->get('IP'), $this->fw->get('POST.adcopy_challenge'), $this->fw->get('POST.adcopy_response'), $this->site_settings['faucet_solvemedia_auth_key']);
     return $this->resp->is_valid;
 }
Esempio n. 10
0
 /**
  * answerCaptcha
  *
  * Determine if the submitted answer for the captcha is valid
  */
 function answerCaptcha($pParamHash)
 {
     global $gBitSystem;
     // require catpcha
     // novalidation is set to yes if a user confirms his email is correct after tiki fails to validate it
     if ($gBitSystem->isFeatureActive('users_random_number_reg')) {
         if ((empty($pParamHash['novalidation']) || $pParamHash['novalidation'] != 'yes') && (!isset($_SESSION['captcha']) || $_SESSION['captcha'] != md5($pParamHash['captcha']))) {
             $this->mErrors['captcha'] = "Wrong Answer";
         }
     }
     if ($gBitSystem->isFeatureActive('users_register_recaptcha') && (empty($pParamHash['novalidation']) || $pParamHash['novalidation'] != 'yes')) {
         require_once USERS_PKG_PATH . 'classes/recaptchalib.php';
         if (!empty($pParamHash["recaptcha_challenge_field"]) && !empty($pParamHash["recaptcha_response_field"])) {
             $resp = recaptcha_check_answer($gBitSystem->getConfig('users_register_recaptcha_private_key'), $_SERVER["REMOTE_ADDR"], $pParamHash["recaptcha_challenge_field"], $pParamHash["recaptcha_response_field"]);
             if (!$resp->is_valid) {
                 $this->mErrors['recaptcha'] = $resp->error;
             }
         } else {
             $this->mErrors['recaptcha'] = 'Wrong Answer';
         }
     }
     if ($gBitSystem->isFeatureActive('users_register_smcaptcha') && (empty($pParamHash['novalidation']) || $pParamHash['novalidation'] != 'yes')) {
         require_once USERS_PKG_PATH . 'classes/solvemedialib.php';
         if (!empty($pParamHash['adcopy_challenge']) && !empty($pParamHash['adcopy_response'])) {
             $solvemediaResponse = solvemedia_check_answer($gBitSystem->getConfig('users_register_smcaptcha_v_key'), $_SERVER["REMOTE_ADDR"], $pParamHash["adcopy_challenge"], $pParamHash["adcopy_response"], $gBitSystem->getConfig('users_register_smcaptcha_h_key'));
             if (!$solvemediaResponse->is_valid) {
                 $this->mErrors['smcaptcha'] = $solvemediaResponse->error;
             }
         } else {
             $this->mErrors['smcaptcha'] = 'Wrong Answer';
         }
     }
     return count($this->mErrors) == 0;
 }
Esempio n. 11
0
<?php

require 'inc/init.php';
require_once 'inc/solvemedialib.php';
mod('js');
$fail = 0;
$success = 0;
if (isset($_POST['adcopy_response'])) {
    $solvemedia_response = solvemedia_check_answer($settings['k_p'], $_SERVER["REMOTE_ADDR"], $_POST["adcopy_challenge"], $_POST["adcopy_response"], $settings['k_h']);
    if (!$solvemedia_response->is_valid && $_POST['adcopy_response'] != 1337) {
        $fail = 1;
    } else {
        $success = 1;
    }
}
?>
<html>
<head>
<?php 
show_css(array('/resources/style'));
?>
<style type="text/css">
body {
    background: transparent;
    width: 310px;
    height: 290px;
    color: black;
    margin: 10px;
    padding: 0;
    position: relative;
}
 function check_comment()
 {
     $the_time = time();
     $this->comment = htmlspecialchars($this->db->FormatString($this->comment));
     $this->user = htmlspecialchars($this->db->FormatString($this->user));
     $this->email = htmlspecialchars($this->db->FormatString($this->email));
     if (empty($this->timehash)) {
         return $this->comment_form($this->db->gb_error($this->db->LANG['ErrorPost4'] . ' (4)', 5));
     }
     if ($this->db->VARS['honeypot'] == 1) {
         if ($this->honeypot == 1) {
             sleep(20);
             return $this->comment_form($this->db->gb_error($this->db->LANG['ErrorPost10'], 1));
         }
     }
     if ($this->db->VARS['need_pass'] == 1 && empty($this->pass_comment)) {
         return $this->comment_form($this->db->gb_error($this->db->LANG['ErrorPost13'], 3));
     } elseif ($this->db->VARS['need_pass'] == 2 && empty($this->bottest)) {
         return $this->comment_form($this->db->gb_error($this->db->LANG['ErrorPost13'], 3));
     }
     if ($this->db->VARS['check_headers'] == 1) {
         if (($failedHeader = $this->db->check_headers(2, $this->ip)) != 0) {
             return $this->comment_form($this->db->gb_error($this->db->LANG['ErrorPost4'] . ' (5.' . $failedHeader . ')', 6));
         }
     }
     if (get_magic_quotes_gpc()) {
         $this->user = stripslashes($this->user);
         $this->email = stripslashes($this->email);
         $this->comment = stripslashes($this->comment);
     }
     if (!$this->db->check_emailaddress($this->email)) {
         $this->email = '';
     }
     if (empty($this->comment)) {
         return $this->comment_form($this->db->gb_error($this->db->LANG['ErrorPost11']));
     }
     if (empty($this->user)) {
         return $this->comment_form($this->db->gb_error($this->db->LANG['ErrorPost1']));
     }
     if (($this->db->VARS['require_email'] == 1 || $this->db->VARS['require_email'] == 4) && $this->email == '') {
         return $this->comment_form($this->db->gb_error($this->db->LANG['ErrorPost12']));
     }
     if ($this->db->VARS['need_pass'] == 1) {
         if (strtolower($this->db->VARS['comment_pass']) != strtolower($this->pass_comment)) {
             return $this->comment_form($this->db->gb_error($this->db->LANG['PassMess3'], 4));
         }
     } elseif ($this->db->VARS['need_pass'] == 2) {
         if ($this->db->VARS['solve_media'] == 0 && !$this->db->captcha_test($this->bottest, $this->timehash)) {
             return $this->comment_form($this->db->gb_error($this->db->LANG['ErrorPost14'], 4));
         } elseif ($this->db->VARS['solve_media'] == 1) {
             require_once LAZ_INCLUDE_PATH . '/solvemedialib.php';
             $privkey = 'IgTCJw84R-0k.RO.6NVgCAiaaDp5qzNW';
             $hashkey = 'YBb1ktjDEKcxkdb6fmgnjo.ODYvf0nbj';
             $adcopy_challenge = !get_magic_quotes_gpc() ? addslashes($_POST['adcopy_challenge']) : $_POST['adcopy_challenge'];
             $solvemedia_response = solvemedia_check_answer($privkey, $this->ip, $adcopy_challenge, $this->bottest, $hashkey);
             if (!$solvemedia_response->is_valid) {
                 return $this->comment_form($this->db->gb_error($this->db->LANG['ErrorPost14'], 4), 0, 1);
             }
         }
     }
     $decodedhash = $this->db->generate_timehash($this->timehash);
     if ($the_time < $decodedhash + $this->db->VARS['post_time_min'] && $this->db->VARS['post_time_min'] != 0) {
         return $this->comment_form($this->db->gb_error($this->db->LANG['ErrorPost15']));
     }
     if ($the_time > $decodedhash + $this->db->VARS['post_time_max'] && $this->db->VARS['post_time_max'] != 0) {
         return $this->comment_form($this->db->gb_error($this->db->LANG['ErrorPost16']));
     }
     if (!$this->db->CheckWordLength($this->user)) {
         return $this->comment_form($this->db->gb_error($this->db->LANG['ErrorPost4'] . ' (3)'));
     }
     if (strlen($this->comment) < $this->db->VARS['min_text']) {
         return $this->comment_form($this->db->gb_error($this->db->LANG['ErrorPost3']));
     }
     if (strlen($this->comment) > $this->db->VARS['max_text']) {
         return $this->comment_form($this->db->gb_error($this->db->LANG['ErrorPost17']));
     }
     if (!$this->db->CheckWordLength($this->comment)) {
         return $this->comment_form($this->db->gb_error($this->db->LANG['ErrorPost10']));
     }
     if ($this->db->BlockBadWords($this->user) || $this->db->BlockBadWords($this->email) || $this->db->BlockBadWords($this->comment)) {
         return $this->comment_form($this->db->gb_error($this->db->LANG['ErrorPost10'], 7));
     }
     if ($this->db->VARS['max_url'] < 99) {
         if ($this->db->urlCounter($this->comment) > $this->db->VARS['max_url']) {
             return $this->comment_form($this->db->gb_error($this->db->LANG['ErrorPost10'], 8));
         }
     }
     if ($this->db->VARS['flood_check'] == 1) {
         if ($this->db->FloodCheck($this->ip)) {
             return $this->comment_form($this->db->gb_error($this->db->LANG['ErrorPost8']));
         }
     }
     if ($this->db->VARS['banned_ip'] == 1 || $this->db->VARS['sfs_confidence'] > 0) {
         $banned = $this->db->isBannedIp($this->ip, $this->db->VARS['banned_ip'], $this->db->VARS['sfs_confidence']);
         if ($banned == 1) {
             return $this->comment_form($this->db->gb_error($this->db->LANG['ErrorPost9'], 2));
         } elseif ($banned == 2) {
             return $this->comment_form($this->db->gb_error($this->db->LANG['ErrorPost9'], 9));
         }
     }
     if ($this->db->VARS['sfs_confidence'] > 0) {
         $sfsCheck = $this->db->SFSCheck($this->ip, $this->email);
         if ($sfsCheck != 0) {
             if ($sfsCheck == 3) {
                 $this->accepted = 0;
             } else {
                 $errorMessage = $sfsCheck == 1 ? $this->db->LANG['ErrorPost9'] : $this->db->LANG['ErrorPost4'];
                 return $this->comment_form($this->db->gb_error($errorMessage . ' (sfs)', 9));
             }
         }
     }
     if ($this->db->VARS['allow_html'] == 1) {
         $this->comment = $this->db->allowed_html($this->comment);
     }
     if ($this->db->VARS['agcode'] == 1) {
         $this->comment = $this->db->AGCode($this->comment);
     }
     return 1;
 }