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; }
<?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();