$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'))) {
             $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
                     $teacher = new Teacher();
                     $v = $teacher->validateLogin(Input::get('a'));
                     if ($v == 1) {
                         $cookiename = 'misnootp' . $teacher->getMobile();
                         if (1) {
                             Session::put('loggedIn', 1);
                             $log = new Log();
                             $log->loginLog('success');
                             Redirect::to('home.php');
                         } else {
                             $otp = new OTP();
                             if ($otp->send($teacher->getMobile())) {
                                 //$otp->send($teacher->getMobile()) //Send OTP
                                 Session::put('OTP Sending', 'OTP Sent, Verify Here');
                             }
                         }
                         unset($cookiename);