function captchaRes($CaptchaRes)
{
    //Define the keys for the api, you can get them from https://www.google.com/recaptcha/
    $keys = array('site_key' => RECAPTCHA_GOOGLE_API_KEY, 'secret_key' => RECAPTCHA_GOOGLE_API_SECRET);
    //Instantiate the Recaptcha class as $recaptcha
    $recaptcha = new Recaptcha($keys);
    //If the form is submitted, then check if the response was correct
    return $recaptcha->verify($CaptchaRes);
}
 /**
  * Creates a custom Form macro
  * @return void
  */
 public function createMacroForm()
 {
     app('form')->macro('recaptcha', function ($options = []) {
         $o = new Recaptcha();
         return $o->get($options);
     });
     app('form')->macro('mailhideHtml', function ($email) {
         $o = new Recaptcha();
         return $o->getMailhideHtml($email);
     });
     app('form')->macro('mailhideUrl', function ($email) {
         $o = new Recaptcha();
         return $o->getMailhideUrl($email);
     });
 }
Example #3
0
 public function check()
 {
     $this->setView('reclaim/index');
     if (Session::isLoggedIn()) {
         return Error::set('You\'re logged in!');
     }
     $this->view['valid'] = true;
     $this->view['publicKey'] = Config::get('recaptcha:publicKey');
     if (empty($_POST['recaptcha_challenge_field']) || empty($_POST['recaptcha_response_field'])) {
         return Error::set('We could not find the captcha validation fields!');
     }
     $recaptcha = Recaptcha::check($_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field']);
     if (is_string($recaptcha)) {
         return Error::set(Recaptcha::$errors[$recaptcha]);
     }
     if (empty($_POST['username']) || empty($_POST['password'])) {
         return Error::set('All forms are required.');
     }
     $reclaims = new reclaims(ConnectionFactory::get('mongo'));
     $good = $reclaims->authenticate($_POST['username'], $_POST['password']);
     if (!$good) {
         return Error::set('Invalid username/password.');
     }
     $reclaims->import($_POST['username'], $_POST['password']);
     $users = new users(ConnectionFactory::get('mongo'));
     $users->authenticate($_POST['username'], $_POST['password']);
     header('Location: ' . Url::format('/'));
 }
Example #4
0
 public static function instance($instance = 'default')
 {
     if (!isset(Recaptcha::$_instance)) {
         $config = Kohana::config('recaptcha.' . $instance);
         require_once MODPATH . 'recaptcha/lib/recaptchalib.php';
         Recaptcha::$_instance = new Kohana_recaptcha($config);
     }
     return self::$_instance;
 }
Example #5
0
 public function verify($inQuery = false)
 {
     $controller = $this->_registry->getController();
     if ($inQuery) {
         $r = $controller->request->query["g-recaptcha-response"];
     } else {
         $r = $controller->request->data["g-recaptcha-response"];
     }
     $controller = $this->_registry->getController();
     if (isset($r)) {
         $gRecaptchaResponse = $r;
         $resp = $this->pcaptcha->verifyResponse(new Client(), $gRecaptchaResponse);
         // if verification is correct,
         if ($resp) {
             return true;
         }
     }
     return false;
 }
 public function checkRecaptcha(Model $model, $field)
 {
     App::uses('Recaptcha', 'Recaptcha.Lib');
     if (!class_exists('Recaptcha')) {
         throw new InternalErrorException(__('Recaptcha library not found'));
     }
     try {
         return Recaptcha::check($model->data[$model->alias]['recaptcha_challenge_field'], $model->data[$model->alias]['recaptcha_response_field']);
     } catch (Exception $e) {
         return false;
     }
 }
Example #7
0
 public function __toString()
 {
     // $attr = $this->_html_attr;
     // $attr['class'] = $this->css_class();
     // $attr['type'] = $this->field_type();
     // return Form::checkbox($this->name(), null, (bool)$this->value(), $attr);
     if (array_key_exists('recaptcha', Kohana::modules())) {
         $recap = Recaptcha::instance();
         return $recap->get_html();
     } else {
         return "";
     }
 }
Example #8
0
 public function signup()
 {
     $validation = Validator::make(Input::all(), static::$rules);
     if ($validation->fails()) {
         return Redirect::to('signup')->with(array('note' => Lang::get('lang.signup_error'), 'note_type' => 'error'));
     }
     $settings = Setting::first();
     if ($settings->captcha) {
         $privatekey = $settings->captcha_private_key;
         $resp = Recaptcha::recaptcha_check_answer($privatekey, $_SERVER["REMOTE_ADDR"], Input::get('recaptcha_challenge_field'), Input::get('recaptcha_response_field'));
         if (!$resp->is_valid) {
             // Incorrect Captcha
             return Redirect::to('signup')->with(array('note' => Lang::get('lang.incorrect_captcha'), 'note_type' => 'error'));
         } else {
         }
     }
     $username = htmlspecialchars(stripslashes(Input::get('username')));
     $user = User::where('username', '=', $username)->first();
     if (!$user) {
         if ($settings->user_registration) {
             if (count(explode(' ', $username)) == 1) {
                 if (Input::get('password') != '') {
                     $user = $this->new_user($username, Input::get('email'), Hash::make(Input::get('password')));
                     if ($user) {
                         Auth::attempt(array('email' => Input::get('email'), 'password' => Input::get('password')));
                         $this->new_user_points($user->id);
                     }
                     $redirect = Input::get('redirect');
                     if ($redirect == '') {
                         $redirect = '/';
                     }
                     return Redirect::to($redirect)->with(array('note' => Lang::get('lang.signup_success'), 'note_type' => 'success'));
                 } else {
                     return Redirect::to('signup')->with(array('note' => Lang::get('lang.signup_invalidpass'), 'note_type' => 'error'));
                 }
             } else {
                 return Redirect::to('/signup')->with(array('note' => Lang::get('lang.username_no_spaces'), 'note_type' => 'error'));
             }
         } else {
             return Redirect::to('/')->with(array('note' => Lang::get('lang.signup_reg_closed'), 'note_type' => 'error'));
         }
     } else {
         return Redirect::to('signup')->with(array('note' => Lang::get('lang.username_in_use'), 'note_type' => 'error'));
     }
 }
Example #9
0
 public function isValid()
 {
     if (!isset($this->controller->request->data[$this->model])) {
         return false;
     }
     $data = $this->controller->request->data[$this->model];
     if (!isset($data['recaptcha_challenge_field']) || !isset($data['recaptcha_response_field'])) {
         return false;
     }
     App::uses('Recaptcha', 'Recaptcha.Lib');
     if (!class_exists('Recaptcha')) {
         throw new InternalErrorException(__('Recaptcha library not found'));
     }
     try {
         return Recaptcha::check($data['recaptcha_challenge_field'], $data['recaptcha_response_field']);
     } catch (Exception $e) {
         return false;
     }
 }
Example #10
0
<p>You don't appear to be a registered user yet. If you'd like to create a new account, we just need a few more details:</p>
<?php 
echo form::open('member/register');
?>

	<p>
		<label for="name">Display name:</label>
		<input type="text" name="name" id="name" value="<?php 
echo html::chars($data['name']);
?>
" /><br />
		<small>This is your name as it will be displayed throughout the site.</small>
	</p>
	<p>
		<label for="email">Email address:</label>
		<input type="email" name="email" id="email" value="<?php 
echo html::chars($data['email']);
?>
"<br />
		<small>Just in case we need to contact you.</small>
		
	</p>
	<p>
		<label for="recaptcha_response_field">Security code:</label>
		<?php 
echo Recaptcha::get_html();
?>
	</p>
	<p><input name="submit" type="submit" value="Register" /></p>
	<p><em>If you already have a registered account and just want to link this identity to it, please log in to your existing account, and then link this new identity via the account management section.</em></p>
</form>
Example #11
0
	<?php 
require_once 'classes/recaptcha.php';
require_once 'classes/jsonRPCClient.php';
require_once 'config.php';
$link = mysqli_connect($hostDB, $userDB, $passwordDB, $database);
function GetRandomValue($min, $max)
{
    $range = $max - $min;
    $num = $min + $range * mt_rand(0, 32767) / 32767;
    $num = round($num, 8);
    return (double) $num;
}
//Instantiate the Recaptcha class as $recaptcha
$recaptcha = new Recaptcha($keys);
if ($recaptcha->set()) {
    if ($recaptcha->verify($_POST['g-recaptcha-response'])) {
        //Checking address and payment ID characters
        $wallet = $str = trim(preg_replace('/[^a-zA-Z0-9]/', '', $_POST['wallet']));
        $paymentidPost = $str = trim(preg_replace('/[^a-zA-Z0-9]/', '', $_POST['paymentid']));
        //Getting user IP
        $direccionIP = $_SERVER["REMOTE_ADDR"];
        if (empty($wallet) or strlen($wallet) < 95) {
            header("Location: ./?msg=wallet");
            exit;
        }
        if (empty($paymentidPost)) {
            $paymentID = "";
        } else {
            if (strlen($paymentidPost) > 64 or strlen($paymentidPost) < 64) {
                header("Location: ./?msg=paymentID");
                exit;
Example #12
0
<?php

/**
 * @param $email
 * @param $first
 * @param $last
 * @param $optin
 * @param $group
 */
require_once $_SERVER['DOCUMENT_ROOT'] . '/../inc/config.inc.php';
// Response object
$responseObj = new AjaxResponse_Json();
// recaptcha?
$recaptchaObj = new Recaptcha();
$recaptchaResult = $recaptchaObj->validateRecaptcha($_REQUEST['g-recaptcha-response'], $_SERVER['REMOTE_ADDR']);
if ($recaptchaResult === false) {
    $responseObj->setSuccess(false);
    $responseObj->setError(array('RECAPTCHA_ERROR' => 'reCAPTCHA did not validate.'));
} else {
    // entry object
    $entryObj = new App_Entry(array('email' => $_REQUEST['email'], 'first' => $_REQUEST['first'], 'last' => $_REQUEST['last'], 'optin' => $_REQUEST['optin']));
    $entryResult = $entryObj->insertElseUpdate();
    // error?
    if ($entryResult === false) {
        $responseObj->setSuccess(false);
        $responseObj->setError($entryObj->getErrorObj()->getThrownErrorsWithDescriptions());
    } else {
        // save vote
        // vote object
        $voteObj = new App_Vote(array('fkEntryId' => $entryObj->getId(), 'fkGroupId' => $_REQUEST['group']));
        $voteResult = $voteObj->insert();
Example #13
0
 /**
  * Calls an HTTP POST function to verify if the user's guess was correct
  *
  * @param string $privateKey
  * @param string $remoteip
  * @param string $challenge
  * @param string $response
  * @param array $extra_params An array of extra variables to post to the server
  * @return boolean $this->is_valid property
  */
 public static function check($privateKey, $remoteIP, $challenge, $response, $extra_params = array())
 {
     $privateKey = $privateKey or die(self::RECAPTCHA_ERROR_KEY);
     $remoteIP = $remoteIP or die(self::RECAPTCHA_ERROR_REMOTE_IP);
     // Discard spam submissions
     if (!$challenge or !$response) {
         return self::$is_valid;
     }
     $response = self::httpPost(self::RECAPTCHA_VERIFY_SERVER, "/recaptcha/api/verify", array('privatekey' => $privateKey, 'remoteip' => $remoteIP, 'challenge' => $challenge, 'response' => $response) + $extra_params);
     $answers = explode("\n", $response[1]);
     if (trim($answers[0]) == 'true') {
         self::$is_valid = true;
     } else {
         self::$error = $answers[1];
     }
     return self::$is_valid;
 }
Example #14
0
 public function login()
 {
     $this->view['captcha'] = false;
     $key = 'invalidLogin_' . $_SERVER['REMOTE_ADDR'];
     if (apc_exists($key)) {
         $value = apc_fetch($key);
         if ($value > 3) {
             $this->view['publicKey'] = Config::get('recaptcha:publicKey');
             $this->view['captcha'] = true;
         }
         if ($value > 15) {
             return Error::set('No.  Bad boy.');
         }
     }
     if (!isset($_POST['username']) || !isset($_POST['password'])) {
         return;
     }
     $username = empty($_POST['username']) ? null : $_POST['username'];
     $password = empty($_POST['password']) ? null : $_POST['password'];
     if ($this->view['captcha'] && $value != 4) {
         if (empty($_POST['recaptcha_challenge_field']) || empty($_POST['recaptcha_response_field'])) {
             return Error::set('We could not find the captcha validation fields!');
         }
         $recaptcha = Recaptcha::check($_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field']);
         if (is_string($recaptcha)) {
             return Error::set(Recaptcha::$errors[$recaptcha]);
         }
     }
     $users = new users(ConnectionFactory::get('mongo'));
     $good = $users->authenticate($username, $password);
     if (is_string($good)) {
         if (!apc_exists($key)) {
             apc_store($key, 2, 300);
         } else {
             apc_inc($key, 1);
         }
         return Error::set($good);
     }
     Log::login($good['_id']);
     header('Location: ' . Url::format('/'));
 }
 function it_fails_on_recaptcha_fail(Request $request, Recaptcha $recaptcha, Response $response)
 {
     $recaptcha->verify(Argument::any(), Argument::any())->willReturn($response);
     $response->isSuccess()->willReturn(false);
     $this->validate($request)->shouldReturn(false);
 }
Example #16
0
<?php

require_once 'recaptcha.class.php';
$site_key = 'YOUR_SITE_KEY';
$secret_key = 'YOUR_SECRET_KEY';
$recaptcha = new Recaptcha($site_key, $secret_key);
?>
<!doctype html>
<html>

<head>
<title>reCaptcha 2.0 API Class</title>
<?php 
echo $recaptcha->script();
?>
</head>

<body>

<?php 
ob_start();
?>
<form method="post">
<input type="text" name="example" value="" placeholder="Example Field" />
<?php 
echo $recaptcha->captcha();
?>
<input type="submit" value="Submit" />
</form>
<?php 
$form = ob_get_clean();
 /**
  * Returns true if and only if $value meets the validation requirements
  *
  * If $value fails validation, then this method returns false, and
  * getMessages() will return an array of messages that explain why the
  * validation failed.
  *
  * @param  mixed $value
  * @return bool
  * @throws Exception\RuntimeException If validation of $value is impossible
  */
 public function isValid($value)
 {
     $resp = $this->recaptcha->verify($value);
     return $resp->isSuccess();
 }
 public function signup()
 {
     global $config;
     global $site;
     $user = new User();
     $user->requiresContactData = true;
     $arid = '';
     if (isset($_SESSION['affiliate_referral'])) {
         $arid = $_SESSION['affiliate_referral'];
     }
     $user->referral_type = "none";
     if ($this->post) {
         $user->nickname = $this->PostData('nickname');
         $user->email = $this->PostData('email');
         $user->password = $this->PostData('password');
         $user->password_confirmation = $this->PostData('password_confirmation');
         $user->firstname = $this->PostData('firstname');
         $user->surname = $this->PostData('surname');
         $user->clan = $this->PostData('clan');
         $user->address1 = $this->PostData('address1');
         $user->address2 = $this->PostData('address2');
         $user->towncity = $this->PostData('towncity');
         $user->county = $this->PostData('county');
         $user->country_id = $this->PostData('country_id');
         $user->postcode = $this->PostData('postcode');
         $user->phone = $this->PostData('phone');
         $user->set_dateofbirth($this->PostData('dateofbirth'));
         $user->terms = $this->PostData('terms');
         $user->allow_emails = $this->PostData('allow_emails');
         $user->referral_type = $this->PostData('referral_type');
         $arid = $this->PostData('arid');
         $valid = $user->validate();
         $validCaptcha = Recaptcha::validate($this->PostData('g-recaptcha-response'), Site::RemoteIP());
         if (!$validCaptcha) {
             $this->assign("failedcaptcha", true);
         } elseif ($valid) {
             $user->save();
             // This was a referral, make a note.
             if ($arid) {
                 AffiliateReferral::create_from_arid($user, $arid);
             }
             Email::send_user_signup($user);
             Redirect("signup/complete");
         }
     }
     $this->assign("affiliate_referral_id", $arid);
     $referral_types = array_merge(array("none" => "Please choose..."), $user->referral_types);
     $this->assign("referral_types", $referral_types);
     $terms = Content::find_by_permalink("signup-terms");
     $countries = Utils::FormOptions(Country::find_all("", "countries.name ASC"));
     $this->assign('countries', $countries);
     $this->assign("user", $user);
     $this->assign("site", $site);
     $this->assign("terms", $terms);
     $this->assign('arid', $arid);
     global $config;
     $this->assign('recaptcha', $config['recaptcha']['public']);
     $this->title = "Signup";
     $this->render("user/signup.tpl");
 }
Example #19
0
 public function action_index()
 {
     if (Auth::instance()->get_user()) {
         $this->template->current_user_id = Auth::instance()->get_user();
         $this->template->current_user = ORM::factory('user', Auth::instance()->get_user());
         $this->request->redirect('home/');
     }
     $this->layout->page_title = 'Register an account';
     $this->layout->scripts = array('sourcemap-core', 'sourcemap-template');
     $f = Sourcemap_Form::load('/register');
     $f->action('register')->method('post');
     $this->template->form = $f;
     if (strtolower(Request::$method) === 'post') {
         $validate = $f->validate($_POST);
         if (array_key_exists('recaptcha', Kohana::modules())) {
             $recap = Recaptcha::instance();
             $revalid = (bool) $recap->is_valid($_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
             $validate = $validate && $revalid;
         }
         if ($validate) {
             $p = $f->values();
             // check for username in use
             $exists = ORM::factory('user')->where('username', '=', $p['username'])->find()->loaded();
             if ($exists) {
                 Message::instance()->set('That username is taken.');
                 return;
             }
             // check for email in use
             $exists = ORM::factory('user')->where('email', '=', $p['email'])->find()->loaded();
             if ($exists) {
                 Message::instance()->set('An account exists for that email address.');
                 return;
             }
             $new_user = ORM::factory('user');
             $new_user->username = $p['username'];
             $new_user->email = $p['email'];
             $new_user->password = $p['password'];
             $new_user->save();
             if (!$new_user->id) {
                 Message::instance()->set('Could not complete registration. Please contact support.');
                 return $this->request->redirect('register');
             }
             //send a notification
             $subj = 'Re: Your New Account on Open Supply Chains';
             $h = md5(sprintf('%s-%s', $new_user->username, $new_user->email));
             $lid = strrev(base64_encode($new_user->username));
             $url = URL::site("register/confirm?t={$lid}-{$h}", true);
             $msgbody = "Dear {$new_user->username},\n\n";
             $msgbody .= 'Welcome to Open Supply Chains! ';
             $msgbody .= "Go to the url below to activate your account.\n\n";
             $msgbody .= $url . "\n\n";
             $msgbody .= "If you have any questions, please contact us.\n";
             $addlheaders = "From: Open Supply Chains\r\n";
             try {
                 $sent = mail($new_user->email, $subj, $msgbody, $addlheaders);
                 Message::instance()->set('Please check your email for further instructions.', Message::INFO);
             } catch (Exception $e) {
                 Message::instance()->set('Sorry, could not complete registration. Please contact support.');
             }
             return $this->request->redirect('register');
         } else {
             Message::instance()->set('Check the information below and try again.');
         }
     } else {
         /* pass */
     }
 }
Example #20
0
 /**
  * Calls an HTTP POST function to verify if the user's guess was correct
  * @param string $privkey
  * @param string $remoteip
  * @param string $challenge
  * @param string $response
  * @param array $extra_params an array of extra variables to post to the server
  * @return ReCaptchaResponse
  */
 public static function recaptcha_check_answer($privkey, $remoteip, $challenge, $response, $extra_params = array())
 {
     if ($privkey == null || $privkey == '') {
         die("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
     }
     if ($remoteip == null || $remoteip == '') {
         die("For security reasons, you must pass the remote ip to reCAPTCHA");
     }
     //discard spam submissions
     if ($challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0) {
         $recaptcha_response = new ReCaptchaResponse();
         $recaptcha_response->is_valid = false;
         $recaptcha_response->error = 'incorrect-captcha-sol';
         return $recaptcha_response;
     }
     $response = Recaptcha::_recaptcha_http_post(RECAPTCHA_VERIFY_SERVER, "/recaptcha/api/verify", array('privatekey' => $privkey, 'remoteip' => $remoteip, 'challenge' => $challenge, 'response' => $response) + $extra_params);
     $answers = explode("\n", $response[1]);
     $recaptcha_response = new ReCaptchaResponse();
     if (trim($answers[0]) == 'true') {
         $recaptcha_response->is_valid = true;
     } else {
         $recaptcha_response->is_valid = false;
         $recaptcha_response->error = $answers[1];
     }
     return $recaptcha_response;
 }
 function validate($text, $control, $form)
 {
     // note, $text will be null
     $chall = isset($_POST['recaptcha_challenge_field']) ? $_POST['recaptcha_challenge_field'] : false;
     $resp = isset($_POST['recaptcha_response_field']) ? $_POST['recaptcha_response_field'] : false;
     if (!$chall || !$resp) {
         $result = array('false', 'incorrect-captcha-sol');
     } else {
         $result = Recaptcha::recaptcha_post(array('privatekey' => $this->options['private_key'], 'remoteip' => $_SERVER['REMOTE_ADDR'], 'challenge' => $chall, 'response' => $resp));
     }
     // if the first part isn't true then return the second part
     return trim($result[0]) == 'true' ? array() : array('You did not complete the reCAPTCHA correctly (' . $result[1] . ')');
 }
Example #22
0
if (!isset($_SESSION)) {
    session_start();
}
require './includes/common/recaptcha.php';
include_once './includes/common/verif_security.php';
include_once './includes/common/mailing.php';
include_once './includes/public/functions.php';
try {
    verif_origin_user();
} catch (Exception $e) {
    header('Location: http://hiddenj.jimdo.com/design-formulaire-1/error1');
    die;
}
/* vérification du captcha*/
$captcha = new Recaptcha('6LdidxgTAAAAAHGefCS0_l2eyEeXVWh4lRFVHyzj', '6LdidxgTAAAAAA-7SGtTTaso_qETEZ6-fg_XUYOz');
if (!empty($_POST)) {
    if ($captcha->isValid($_POST['g-recaptcha-response']) == false) {
        header('Location: http://hiddenj.jimdo.com/design-formulaire-1/error2');
        die;
    }
    if (isset($_POST['firstname']) && isset($_POST['lastname']) && isset($_POST['email']) && isset($_POST['city']) && isset($_POST['cp']) && isset($_POST['country']) && isset($_POST['newsletter']) && isset($_POST['marque']) && isset($_POST['model']) && isset($_POST['type']) && isset($_POST['motorisation']) && isset($_POST['immat']) && isset($_POST['date_circu']) && isset($_POST['infos'])) {
        /* sécurisation faille XSS*/
        if (isset($_POST['concours1'])) {
            $concours1 = true;
        } else {
            $concours1 = false;
        }
        if (isset($_POST['concours2'])) {
            $concours2 = true;
        } else {
Example #23
0
?>
">
        <input type="password" class="form-control" id="password_confirmation" name="password_confirmation" placeholder="<?php 
echo Lang::get('lang.confirm_password');
?>
">
        <input type="hidden" class="form-control" id="redirect" name="redirect" value="<?php 
echo Input::get('redirect');
?>
" />
        
        <?php 
if ($settings->captcha) {
    ?>
            <?php 
    echo Recaptcha::recaptcha_get_html($settings->captcha_public_key);
    ?>
        <?php 
}
?>


        <button class="btn btn-lg btn-block btn-color" type="submit"><?php 
echo Lang::get('lang.sign_up');
?>
</button>
        

    </form>

</div>
" maxlength="100">
                            </div>
                        </div>

                        <!-- Submit Button -->
                        <div class="form-group">
                            <div class="col-sm-offset-3 col-sm-6">
                                <button type="submit" class="btn btn-default">
                                    Submit
                                </button>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-offset-3 col-sm-6">
                                <?php 
echo Recaptcha::render();
?>

                            </div>
                        </div>
                    </form>
                </div>

            </div>


        </div>
    </div>
<?php 
$__env->stopSection();
?>
Example #25
0
                            <li><strong>Message :</strong></li>
                            <li>
                                <textarea class="input-lg" type="text" name="txtMessage" id="txtMessage" style="width: 100%;" rows="8"><?php 
echo isset($_POST['txtMessage']) ? $_POST['txtMessage'] : '';
?>
</textarea>
                            </li>


                        </ul>
                        <div class="divMessageError"> 
                            <?php 
require 'recaptcha.php';
require 'messageNousJoindre.php';
if (!empty($_POST)) {
    $captcha = new Recaptcha('6Lfa0P8SAAAAAKCRr5T0HJdkRSWPyVpNAFthNDZF');
    if (messageValidationIsGood($_POST['txtName'], $_POST['txtEmail'], $_POST['txtMessage']) && $captcha->checkCode($_POST['g-recaptcha-response'])) {
        //header("Location: messageSent.php");
        echo "Message sent!";
        exit;
    } else {
        echo messageValidation($_POST['txtName'], $_POST['txtEmail'], $_POST['txtMessage']);
    }
}
?>
                        </div>

                        <ul class="ulJoindre">
                            <li>

                                <div class="recaptchaContainer">
 /**
  * Guarda el comentario del artículo
  * @param $tag
  * @return unknown_type
  */
 public function nuevo_comentario($articulo_slug = null)
 {
     $articulo = new Articulo();
     $recaptcha = new Recaptcha();
     $articulo = $articulo->getEntryBySlug($articulo_slug);
     $this->articulo_id = $articulo->id;
     $this->articulo_slug = $articulo_slug;
     $this->comentarios = Load::model('comentario')->getCommentByPost($this->articulo_id);
     $this->countComment = count($this->comentarios);
     $this->captcha = $recaptcha->generar();
     if (Input::hasPost('comentario')) {
         try {
             //Comprueba el reCAPTCHA
             if ($recaptcha->comprobar($_SERVER["REMOTE_ADDR"], $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field'])) {
                 if (Load::model('comentario')->save(Input::post('comentario'))) {
                     Flash::success('Comentario enviado');
                     Router::redirect("articulo/{$articulo_slug}/");
                 } else {
                     Flash::error('Ha ocurrido un error');
                     $this->comentario = Input::post('comentario');
                 }
             }
         } catch (KumbiaException $kex) {
             Flash::error('Ingresa correctamente las palabras del captcha');
             $this->captcha = $recaptcha->generar($kex->getMessage());
             $this->comentario = Input::post('comentario');
         }
     }
 }
<?php

require_once '../core/init.php';
if (loggedIn()) {
    Redirect::to('home.php');
    exit;
}
if (Input::exists()) {
    if (Input::get('login') != '') {
        $validate = new Validate();
        $validation = $validate->check($_POST, array('a' => array('required' => true), 'b' => array('required' => true), 'g-recaptcha-response' => array('required' => true)));
        if ($validate->passed()) {
            $captcha_check = new Recaptcha();
            $ver = $captcha_check->verifyResponse();
            if ($ver->success) {
                //verify captcha
                if (validateEmail(Input::get('a'))) {
                    $email = Input::get('a');
                    $ldap = new LDAP();
                    if ($ldap->Auth(Input::get('a'), Input::get('b')) && Token::check(Input::get('token'))) {
                        // verify using LDAP and check token!!
                        if (Session::get('type') === 'faculty') {
                            //check who logged in, differentiating between student and faculty members' login!
                            //case for teacher's or other staff's login
                            $validate->addError("Please <a href='http://mis.nits.ac.in'>CLICK HERE</a> for faculty login area.");
                            Session::destroy();
                        } else {
                            if (Session::get('type') === 'student') {
                                // case for students' login!!
                                $student = new Student();
                                $v = $student->validateLogin();
Example #28
0
 public function testOk_several()
 {
     Recaptcha::shouldReceive('verify')->once()->andReturn(true);
     Mail::shouldReceive('raw')->once()->with('#test mail toto => tata#', Mockery::on(function ($closure) {
         $message = Mockery::mock('Illuminate\\Mailer\\Message');
         $message->shouldReceive('to')->with('*****@*****.**', 'toto')->andReturn(Mockery::self());
         $message->shouldReceive('subject')->with('test mail title')->andReturn(Mockery::self());
         $closure($message);
         return true;
     }))->andReturn(true);
     Mail::shouldReceive('raw')->once()->with('#test mail tutu => toto#', Mockery::on(function ($closure) {
         $message = Mockery::mock('Illuminate\\Mailer\\Message');
         $message->shouldReceive('to')->with('*****@*****.**', 'tutu')->andReturn(Mockery::self());
         $message->shouldReceive('subject')->with('test mail title')->andReturn(Mockery::self());
         $closure($message);
         return true;
     }))->andReturn(true);
     Sms::shouldReceive('message')->once()->with('0612345678', '#test sms "tata\' => &tutu#')->andReturn(true);
     Sms::shouldReceive('message')->once()->with('0712345678', '#test sms "tutu\' => &toto#')->andReturn(true);
     $content = $this->ajaxPost('/', ['g-recaptcha-response' => 'mocked', 'name' => ['toto', 'tata', 'tutu'], 'email' => ['*****@*****.**', '', '*****@*****.**'], 'phone' => ['', '0612345678', '0712345678'], 'exclusions' => [['2'], ['0'], ['1']], 'title' => 'test mail title', 'contentMail' => 'test mail {SANTA} => {TARGET}', 'contentSMS' => 'test sms "{SANTA}\' => &{TARGET}'], 200);
     $this->assertEquals(['Envoyé avec succès !'], $content);
 }
Example #29
0
        <!-- ADS ADS ADS ADS ADS ADS ADS ADS ADS -->
        <a href="https://hashflare.io/r/69295B0A-ads"><img src="https://hashflare.io/banners/468x60-eng-2.jpg" alt="HashFlare"></a>
        <!-- ADS ADS ADS ADS ADS ADS ADS ADS ADS -->

        <br>


          <?php 
$bitcoin = new jsonRPCClient('http://127.0.0.1:8070/json_rpc');
$balance = $bitcoin->getbalance();
$balanceDisponible = $balance['available_balance'];
$lockedBalance = $balance['locked_amount'];
$dividirEntre = 100000000;
$totalBCN = ($balanceDisponible + $lockedBalance) / $dividirEntre;
$recaptcha = new Recaptcha($keys);
//Available Balance
$balanceDisponibleFaucet = number_format(round($balanceDisponible / $dividirEntre, 8), 8, '.', '');
?>

        <form action="request.php" method="POST">

          <?php 
if (isset($_GET['msg'])) {
    $mensaje = $_GET['msg'];
    if ($mensaje == "captcha") {
        ?>
            <div  id="alert" class="alert alert-error radius">
              Incorrect Captcha, please answer correctly.
            </div>
            <?php 
Example #30
0
 /**
  * Processes the form submit. Is called automatically from render() if not called before
  * @return true if handled
  */
 public function handle()
 {
     $p = array();
     // fetch GET parameters before processing POST
     foreach ($_GET as $key => $val) {
         foreach ($this->elems as $e) {
             if (!is_object($e['obj'])) {
                 throw new \Exception('XXX not an obj!');
             }
             if (!isset($e['obj']->name)) {
                 continue;
             }
             if ($e['obj']->name == $key) {
                 $p[$key] = htmlspecialchars_decode($val);
             }
         }
     }
     foreach ($_POST as $key => $val) {
         foreach ($this->elems as $e) {
             if (!is_object($e['obj'])) {
                 throw new \Exception('XXX not an obj!');
             }
             if (!isset($e['obj']->name)) {
                 continue;
             }
             if ($e['obj']->name == $key) {
                 if (is_array($val)) {
                     foreach ($val as $idx => $v) {
                         $val[$idx] = htmlspecialchars_decode($v);
                     }
                     $p[$key] = $val;
                 } else {
                     $p[$key] = htmlspecialchars_decode($val);
                 }
             } else {
                 if ($e['obj'] instanceof YuiDateInterval) {
                     if ($e['obj']->name . '_from' == $key) {
                         $e['obj']->selectFrom($val);
                         $p[$key] = htmlspecialchars_decode($val);
                     }
                     if ($e['obj']->name . '_to' == $key) {
                         $e['obj']->selectTo($val);
                         $p[$key] = htmlspecialchars_decode($val);
                     }
                 } else {
                     if ($e['obj']->name == $key . '[]') {
                         // handle input arrays
                         if (is_array($val)) {
                             foreach ($val as $idx => $v) {
                                 $val[$idx] = htmlspecialchars_decode($v);
                             }
                             $p[$key] = $val;
                         } else {
                             $p[$key] = htmlspecialchars_decode($val);
                         }
                     }
                 }
             }
         }
     }
     // include FILES uploads
     foreach ($this->elems as $e) {
         if (isset($e['obj']) && is_object($e['obj']) && $e['obj'] instanceof XhtmlComponentFile && !empty($_FILES[$e['obj']->name])) {
             $key = $_FILES[$e['obj']->name];
             $p[$e['obj']->name] = $key;
             // to avoid further processing of this file upload elsewhere
             unset($_FILES[$e['obj']->name]);
         }
     }
     if ($this->using_captcha && !empty($_POST)) {
         $captcha = new Recaptcha();
         if (!$captcha->verify()) {
             return false;
         }
     }
     if (!$p) {
         return false;
     }
     $this->form_data = $p;
     $error = ErrorHandler::getInstance();
     if (!$error->getErrorCount() && $this->post_handler) {
         if (call_user_func($this->post_handler, $this->form_data, $this)) {
             $this->handled = true;
         }
     }
     if ($error->getErrorCount()) {
         return false;
     }
     return $this->handled;
 }