<?php

session_start();
require_once './ajax/libotp.php';
$objOTP = new OTP();
$pubKey = '$2y$10$WE7sWnlZuEx0hqXIYHvXVOFmFf1dEyR1TiXtDQ/7o15TREACxIEQ.';
$response = json_decode($objOTP->verifySesion($pubKey, $_SESSION['token']), 1);
if (!$response['access']) {
    header("Location: error_acceso.php");
}
?>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>Login con OTP</title>
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
    </head>
    <body>
        <nav class="navbar navbar-default">
            <div class="container-fluid">
                <div class="navbar-header">
                    <a class="navbar-brand" href="#">Login - OTP</a>
                </div>
            </div>
        </nav>        
        <div class="container">
            <div class="row">
                <div class="col-md-4 col-md-offset-4">
                    <div class="alert alert-success">
                        <strong>Acceso Permitido:</strong> Credenciales válidas 
                 } else {
                     // Not valid login
                     Session::destroy();
                     $validate->addError('Wrong Username or Password');
                 }
             }
         } else {
             $validate->addError('Wrong Captcha');
         }
     }
 }
 if (Input::get('otpsubmit') != '') {
     $otp_validate = new Validate();
     $otp_validation = $otp_validate->check($_POST, array('OTP' => array('required' => true, 'min' => 8, 'max' => 8)));
     if ($otp_validate->passed() && Token::check(Input::get('token'))) {
         $otp = new OTP();
         if ($otp->verifyOTP(Input::get('OTP'))) {
             //$otp->verifyOTP(Input::get('OTP'))
             Session::deleteloginAttempt('OTP');
             Session::put('loggedIn', 1);
             $log = new Log();
             $log->loginLog('success');
             if (Input::get('nootp') == 1) {
                 $cookiename = 'sisnootp' . Session::get('mobile');
                 Cookie::put($cookiename, true, 15);
                 unset($cookiename);
             }
             Redirect::to('home.php');
         } else {
             $log = new Log();
             $log->loginLog('wrong OTP');
Exemple #3
0
<?php

require_once './libotp.php';
$pubKey = '$2y$10$cj4qVmUIaKFU7mfl0XeTruwQLKF05iJSrrnMqQhNRj8/0kAKNajs6';
$priKey = '$2y$10$YffYFR6g4FCTnRRiwfQs0.dG7xIBb8ds6IqQn3BWRnQoU3C2Oo2Fi';
$objOTP = new OTP();
if ($_POST['crypt'] == $objOTP->cryptOTP($_POST['otp'], $priKey)) {
    $response = json_decode($objOTP->verifyOTP($pubKey, $_POST['otp']), 1);
    if ($response['response']) {
        session_start();
        $_SESSION['token'] = $_POST['otp'];
        header("Location: ../pagina_restringida.php");
    } else {
        header("Location: ../error_acceso.php");
    }
} else {
    header("Location: ../error_acceso.php");
}
Exemple #4
0
 public function __construct()
 {
     parent::__construct();
     $this->setInterval(30);
 }
Exemple #5
0
 public function __construct($s, $opt = array())
 {
     $this->interval = isset($opt['interval']) ? $opt['interval'] : 30;
     parent::__construct($s, $opt);
 }
Exemple #6
0
<?php

require_once './libotp.php';
$pubKey = '$2y$10$WE7sWnlZuEx0hqXIYHvXVOFmFf1dEyR1TiXtDQ/7o15TREACxIEQ.';
$objOTP = new OTP();
$response = $objOTP->getOTP($pubKey, $_POST['email']);
echo $response;
     $mobile = Input::get('mobile');
     $parents_mobile = Input::get('parents_mobile');
     $courses = Input::get('courses');
     $courses = explode(' ,', $courses);
     $courses = $courses[1];
     $courses_load = strtoupper(Input::get('loadcode1') . ',' . Input::get('loadcode2'));
     $courses_load = rtrim($courses_load, ',');
     $course_credits = Input::get('course_credits');
     $home_address = Input::get('home_address');
     $hostel_address = Input::get('hostel_address');
     $add = $stud->register($email, $name, $gender, $scholar_no, $category, $programme, $semester, $session, $department, $mobile, $parents_mobile, $courses, $courses_load, $home_address, $hostel_address);
     if ($add == 1) {
         $log = new Log();
         $log->actionLog('Student Registered');
         echo 1;
         $otp = new OTP();
         $otp->send($mobile);
         //Redirect::to('registration.php?step=2');
     } else {
         echo 'Something went wrong... Please try again after clicking cancel.';
     }
 } else {
     echo "Please fill the required fields : ";
     foreach ($validate->errors() as $errors) {
         switch ($errors) {
             case 'programme is required':
                 echo 'Programme, ';
                 break;
             case 'mobile is required':
             case 'mobile must be minimum of 10 characters.':
             case 'mobile must be maximum of 10 characters.':
<?php

session_start();
require_once './ajax/libotp.php';
$objOTP = new OTP();
$pubKey = '$2y$10$wZIE0gfigESV5XcnLnrmeO3cB27y5eY0ZIaOnL6.xnmz3tc8YrQi6 ';
$response = json_encode($objOTP->closeOTP($pubKey, $_SESSION['token']), 1);
session_unset();
session_destroy();
?>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>Login con OTP</title>
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
    </head>
    <body>
        <nav class="navbar navbar-default">
            <div class="container-fluid">
                <div class="navbar-header">
                    <a class="navbar-brand" href="#">Login - OTP</a>
                </div>
            </div>
        </nav>        
        <div class="container">
            <div class="row">
                <div class="col-md-4 col-md-offset-4">
                    <div class="alert alert-info">
                        <strong>Salida del Sistema:</strong> Sessión Finalizada
                    </div>
Exemple #9
0
 public function __construct()
 {
     parent::__construct();
     $this->setCounter(0);
 }