Example #1
0
/**
 * Function to process api request.
 * @param string $data	Base64 encoded json string with api request data.
 */
function api($data)
{
    // decode json data from get
    $data = base64_decode($data);
    $data = json_decode($data);
    // convert to login, logout or data request
    $response = null;
    $request = null;
    if (Login::isInstance($data)) {
        $request = new Login($data->data->warehouseId, $data->data->pw);
        $response = $request->login();
    } elseif (Logout::isInstance($data)) {
        $request = new Logout($data->sessionId);
        $response = $request->logout();
    } elseif (DataRequest::isInstance($data)) {
        if (isset($data->sessionId) && isset($data->data)) {
            $request = new DataRequest($data->sessionId, $data->f, $data->data);
        } elseif (isset($data->sessionId)) {
            $request = new DataRequest($data->sessionId, $data->f);
        } else {
            if (isset($data->data)) {
                $request = new DataRequest(0, $data->f, $data->data);
            } else {
                $request = new DataRequest(0, $data->f);
            }
        }
        $response = $request->process();
    }
    return json_encode(array('request' => $request, 'response' => $response));
}
 public function login()
 {
     $loginClass = new Login();
     $stats = $loginClass->login($_POST['login'], $_POST['pass']);
     if ($stats) {
         $this->redirect('');
     } else {
         $this->redirect('home/home/mismatch');
     }
 }
 function testLoginFail()
 {
     $expected = 'false';
     $workNumber = '11111';
     $password = '******';
     $tableName = 'user_teacher';
     $lg = new Login();
     $actual = $lg->login($workNumber, $password, $tableName);
     $this->assertEquals($expected, $actual);
 }
Example #4
0
function login()
{
    global $connector;
    if (isset($_SESSION['admin'])) {
        header("Location: admin/");
    } else {
        if (isset($_SESSION['login'])) {
            header("Location: index.php");
        } else {
            $login = new Login($connector);
            $result['errorMessage'] = $login->login();
            if (!$result['errorMessage']) {
                return login();
            }
            $page = "login.php";
            include_once BASE_PATH . "/template.php";
        }
    }
}
Example #5
0
 /**
  * Displays the login page
  */
 public function actionLogin()
 {
     // if it is ajax validation request
     if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') {
         $model = new Login();
         //echo CActiveForm::validate($model);
         $model->attributes = $_POST['Login'];
         //echo "ajax login:"******"/";
             if (Yii::app()->user->role == $this->roles['hy']) {
                 $rUrl = "/main/confirm.do";
             }
             echo '{"targetUrl":"' . $rUrl . '","success":true}';
             //Yii::app()->user->returnUrl
         } else {
             echo '{"msg":"';
             //implode(",",$model->getErrors());
             foreach ($model->getErrors() as $errors) {
                 echo '<br />' . implode(",", $errors);
             }
             echo '","success":false}';
         }
         Yii::app()->end();
     }
     // collect user input data
     if (isset($_POST['Login'])) {
         $model = new Login();
         $model->attributes = $_POST['Login'];
         //var_dump($_POST['Login']);
         //$model->getError();
         // validate user input and redirect to the previous page if valid
         if ($model->validate() && $model->login()) {
             $this->redirect("/");
             //Yii::app()->user->returnUrl
         }
     }
     // display the login form
     $this->render('login');
 }
 /**
  * This action validates user login and redirects to dashboard or return url.
  */
 public function actionIndex()
 {
     $model = new Login('login');
     // collect user input data
     if (isset($_POST['Login'])) {
         $model->attributes = $_POST['Login'];
         // validate user input and redirect to the correct user landing page
         if ($model->validate() && $model->login()) {
             $redirurl = Yii::app()->user->dashboardurl;
             $returnurl = Yii::app()->user->returnUrl;
             if (strpos($returnurl, 'sharewall.co.uk') !== false) {
                 $this->redirect($redirurl);
             } else {
                 $this->redirect($returnurl);
             }
         } else {
             // display the login form
             $this->render('index', array('model' => $model));
         }
     } else {
         // display the login form
         $this->render('index', array('model' => $model));
     }
 }
<?php

//kobler til database
require '../../koble_til_database.php';
session_start();
//Error messages
$error = array('nonexistant_user' => 'Brukeren %username% finnes ikke i v&aring;re systemer.', 'nonexistant_rfid' => 'Ingen registrerte brukere med denne RFIDen.', 'no_userinfo' => 'Klarte ikke &aring; finne informasjon om brukeren.', 'failed_login' => 'Klarte ikke &aring; logge inn brukeren.', 'missing_variables' => 'Login informasjonen har ikke blitt sendt med.');
//Check if the id is sent and its session exists
if (isset($_POST["id"])) {
    //The ID is sent
    require 'login.class.php';
    $login = new Login();
    $response = $login->login($_POST['id']);
    if (is_numeric($response)) {
        $user_id = $response;
    } else {
        j_die($error['failed_login']);
    }
} else {
    j_die($error['missing_variables']);
}
$get_user = "******" . $user_id . "'";
$get_user_qry = $conn->query($get_user);
if ($get_user_qry->num_rows > 0) {
    if ($user = $get_user_qry->fetch_assoc()) {
        //User is found in DB and info is passed on to result array
        $res = array('error' => '', 'userID' => $user['userID'], 'username' => $user['username'], 'firstname' => $user['firstname'], 'lastname' => $user['lastname'], 'birth' => $user['birth'], 'sex' => $user['sex'], 'school' => $user['school'], 'address' => $user['address'], 'registered' => $user['registered'], 'approved_date' => $user['approved_date']);
        //To avoid returning null variables
        if ($res['approved_date'] == null) {
            $res['approved_date'] = "";
        }
Example #8
0
<?php

session_start();
require_once '../helpers/session.php';
home();
require_once '../models/login.php';
if (isset($_POST)) {
    $new = new Login($_POST);
    $user = $new->login();
    if ($user) {
        $_SESSION['id'] = $user['id'];
        $_SESSION['name'] = $user['name'];
        $_SESSION['on'] = true;
        header('Location: ../views/subscribers');
    } else {
        header('Location: ../views/login');
    }
}
Example #9
0
<?php

require_once 'Conexion.php';
require_once 'Login.php';
if (file_get_contents("php://input")) {
    $objDatos = json_decode(file_get_contents("php://input"));
    $mensaje = 'null';
    if (isset($_POST['login'])) {
        $model = new Login();
        $model->email = htmlspecialchars($objDatos->correo);
        $model->password = htmlspecialchars($objDatos->password);
        $model->login();
        $mensaje = $model->mensaje;
    }
    $jsondata = array();
    $jsondata['data']['correo'] = $objDatos->correo;
    $jsondata['data']['password'] = $objDatos->password;
    $jsondata['message'] = $mensaje;
    //$jsondata['data']['calle']      = $objDatos->direccion->calle;*/
    header('Content-type: application/json; charset=utf-8');
    echo json_encode($jsondata, JSON_FORCE_OBJECT);
    /*if ($_POST) {
                //die();
                //$objDatos = json_decode(file_get_contents("php://input"));
                $jsondata = array();
    
                $correo = $_POST["datos_form"];
                //$pass = $_POST['password'];
                //$jsondata['data']       = 100;
                $jsondata['status']      = 3;
                $jsondata['data']        = $correo;
Example #10
0
 * (at your option) any later version.
 *
 * This program is distributed in the hope's that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details. You should have 
 * received a copy of the GNU General Public License along with
 * this program; if not, write to the Free Software Foundation, 
 * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
## Includes
require_once '..' . DIRECTORY_SEPARATOR . 'include.php';
require_once '..' . DIRECTORY_SEPARATOR . 'include_globals.php';
## Security validation's
$authCheck = new Login(USERDB_FILE_LOCATION, $config['use_domus_security']);
if (!$authCheck->login()) {
    header("Location: ../login.php?from=events/macros");
    exit;
}
if ($authCheck->getUser()->getSecurityLevel() > 1) {
    header("Location: ../index.php");
    exit;
}
$tpl->set('sec_level', $authCheck->getUser()->getSecurityLevel());
if (!isset($heyusched)) {
    gen_error(null, $lang['noscheddefined']);
    exit;
}
$schedObjs = $heyusched->getObjects();
$macros = $heyusched->getMacroObjects();
## Set template parameters
Example #11
0
ini_set("display_errors", "On");
require_once '../sbw/lib/Login.php';

$logoutLink = '';
$message = '';

if( isset( $_GET['action'] ) || isset( $_GET['openid_mode'] ) || isset( $_GET['code'] ) || isset( $_GET['oauth_token'] ) ) {

    $params = array();
    $params['openid_identifier'] = isset( $_GET['openid_identifier'] ) ? $_GET['openid_identifier'] : null;
    $params['openid_mode'] = isset( $_GET['openid_mode'] ) ? $_GET['openid_mode'] : null;
    $params['code'] = isset( $_GET['code'] ) ? $_GET['code'] : null;
    $params['oauth_token'] = isset( $_GET['oauth_token'] ) ? $_GET['oauth_token'] : null;

    $login = new Login( $params );
    $success = $login->login();
    $message = Login::getMessenger();
    $upload_image = true;

}

// check if user is logged in
if ( Login::hasIdentity()) {
    $logoutLink = '<a href="' . $_SERVER['PHP_SELF'] . '?logout"> Logout </a>';

    // array of identity properties
    $identity = Login::getIdentity();
    $upload_image = true;
}

// logout user
Example #12
0
<?php

header('Content-Type: text/html; charset=utf-8');
define('DS', DIRECTORY_SEPARATOR);
define('ROOT', dirname(__DIR__));
include ROOT . DS . 'config/Config.php';
include ROOT . DS . 'src/Usuarios.php';
include ROOT . DS . 'src/Login.php';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $user = new Usuarios(new Config());
    $arrUser = $user->read($_POST['usuario']);
    $log = new Login(new Config());
    $log->login($_POST, $arrUser);
}
?>
<!DOCTYPE html>
<html lang="pt-br">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="Clínica Dr. Me Atende">
    <meta name="author" content="HsNunes">

    <title>CLÍNICA DR. ME ATENDE - Clínica Popular</title>

    <!-- Bootstrap Core CSS -->
    <link href="../view/css/bootstrap.css" rel="stylesheet">
    <!-- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css"> -->
    <!-- <script src="https://maps.googleapis.com/maps/api/js"></script> -->
    <!-- Custom CSS -->
Example #13
0
 public static function setLoginInstance(\Webiny\Login\Login $login)
 {
     self::$login = $login;
 }
Example #14
0
<?php

require_once 'includes/inc.php';
$error = false;
if (!empty($_SESSION['login_string'])) {
    header('Location: index.php');
    exit;
}
require_once 'includes/classes/login.php';
$loginObj = new Login();
if (!empty($_POST['username']) && !empty($_POST['password'])) {
    if ($loginObj->login(trim($_POST['username']), trim($_POST['password'])) !== FALSE) {
        $_SESSION['login_string'] = hash('sha512', $_POST['password'] . $_SERVER['HTTP_USER_AGENT']);
        session_regenerate_id();
        // This hangs sometimes and we dont know why...
        session_write_close();
        header('Location: index.php');
        exit;
    } else {
        unset($_SESSION['login_string']);
        $error = true;
    }
}
session_write_close();
include "includes/login-header.php";
?>
         
      <div id="dashboard-wrap" class="container sub-nav login-container">
      
         <div id="overview" class="panel panel-primary panel-no-grid panel-overview">
            <h1>Login</h1>
Example #15
0
 * @category LOEYAE
 * @package  LOEYAE
 * @author   Zhang Yi <*****@*****.**>
 * @license  http://www.apache.org/licenses/LICENSE-2.0 Apache License
 * @version  GIT: $Id: Zhang Yi $
 * @link     URL description
 */
require_once dirname(__FILE__) . '/../inc/Login.php';
require_once dirname(__FILE__) . '/../inc/EntriesManager.php';
require_once dirname(__FILE__) . '/../inc/MemberManager.php';
require_once dirname(__FILE__) . '/../inc/MemberByJson.php';
try {
    $act = filter_input(INPUT_GET, 'act');
    $login = new Login(new MemberByJson(MEMBER_REPO_BASE_DIR));
    if ($act == 'login') {
        $login->login(filter_input(INPUT_POST, 'name'), filter_input(INPUT_POST, 'pass'));
    } elseif ($act == 'loginpage') {
        $login->page();
    } elseif ($act == 'logout') {
        $login->logout();
    } else {
        Login::check();
        $user = $login->getInfo('name');
        $entries = new EntriesManager(md5($user));
        switch ($act) {
            case 'add':
                $member = new MemberManager();
                $member->add();
                break;
            case 'detail':
                $entries->getLang();
Example #16
0
 private function logIn()
 {
     require_once 'Login.php';
     $loginManager = new Login($this->_smarty, $this->_pdo);
     if ($loginManager->login()) {
         $this->_userManager->updateLastLoginToNow($_SESSION['uid']);
     }
 }
Example #17
0
</form>

</body>
</html>

<?php 
session_start();
require_once 'Db.php';
require_once 'Login.php';
if (!empty($_SESSION['email'])) {
    header('Location:index.php');
}
//проверка на запрос пост
if (isset($_POST['email']) && isset($_POST['password']) && !empty($_POST['email']) && !empty($_POST['password'])) {
    $enter = new Login($_POST['email'], $_POST['password']);
    $check = $enter->login();
    if (isset($_POST['auth']) && !empty($_POST['auth'])) {
        //проверка авторизации
        if ($check) {
            $_SESSION['email'] = $enter->email;
            $_SESSION['password'] = $enter->password;
            $_SESSION['id'] = $enter->id;
            header('Location:index.php');
        } else {
            //добавить сообщение
            echo "wrong";
        }
    } elseif (isset($_POST['reg']) && !empty($_POST['reg'])) {
        //регистрация
        $db = Db::getInstance();
        if (!empty($_POST['email'])) {
Example #18
0
<?php

include "inc/conn.php";
include "inc/login.php";
$loginn = new Login();
$username = $_POST['username'];
$password = $_POST['password'];
if ($loginn->login($username, $password)) {
    session_start();
    $_SESSION['yetki'] = "access";
    header("location:index.php");
} else {
    header("location:index.php?err=check");
}
Example #19
0
<?php

error_reporting(0);
include 'config/database.class.php';
include 'objects/login.class.php';
$database = new Database();
$db = $database->getConnection();
$error = '';
if (empty($_GET['code'])) {
    $error = "Please enter an access code";
} else {
    $code = $_GET['code'];
    $login = new Login($db);
    if ($login->login($code) == false) {
        $error = "Access code is invalid";
    }
}
Example #20
0
<?php

$loginP = new Login();
if (isset($_POST['login']) && isset($_POST['password']) && $_POST['login'] != '' && $_POST['password'] != '') {
    $loggedstatus = $loginP->islogged($_POST['login']);
    if ($loggedstatus === "not.found") {
        //$loginP->start("null");
        $loggedstatus = "notexist";
        $check_L = false;
    } else {
        if ($loggedstatus === "notlogged") {
            $check_L = $loginP->login($_POST['login'], $_POST['password']);
            echo $check_L;
        } else {
            $check_L = false;
        }
    }
    if ($check_L) {
        $t_login = $loginP->check();
        if ($t_login) {
            $conexion = new MySQL(0);
            $query = 'call GetHomeURL(' . $_SESSION['pais'] . ');';
            $result1 = $conexion->consulta($query);
            $row = $conexion->fetch_row($result1);
            $conexion->MySQLClose();
            switch ($_SESSION['access']) {
                case 1:
                case 2:
                case 3:
                    if (!isset($_SESSION['home'])) {
                        $_SESSION['home'] = 'http://' . URL . DS . 'dashboard' . DS . 'metricas';
Example #21
0
    $updatedOption = new Guest($db);
    $updatedOption->FirstName = $_POST['firstname'];
    $updatedOption->LastName = $_POST['lastname'];
    $updatedOption->Email = $_POST['email'];
    $updatedOption->Address = $_POST['address'];
    $updatedOption->Gender = $_POST['gender'];
    $updatedOption->Suburb_Id = $_POST['suburb'];
    if ($updatedOption->insert() == true) {
        $access = new Access($db);
        $access->generateRandom();
        $access->Staff = '';
        $access->Staff_Id = null;
        $access->Guest_Id = $updatedOption->Id;
        $access->insert();
        $login = new Login($db);
        $login->login($access->Code);
        header("location:guest.php");
    } else {
        echo "<script>alert('There was an error adding this item');window.location = '../index.php' </script>";
    }
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
<?php

include "../classes/Database.class.php";
include "../classes/Login.class.php";
include "../classes/Evento.class.php";
$database = new Database();
$db = $database->getConnection();
$login = new Login($db);
if (isset($_POST['login'])) {
    $login->setUsuario($_POST['usr']);
    $login->setSenha($_POST['pass']);
    $login->login();
}
if (isset($_GET['logout'])) {
    $login->doLogout();
}
if ($login->isLoggedIn()) {
    $evento = new Evento($db);
    $eventos = $evento->readAll();
    $titulo = "Todos os eventos";
    $content = array();
    $content[] = "tabelasEventos.php";
    include "template/dash.php";
} else {
    include "template/login.php";
}
Example #23
0
 public function redirect()
 {
     if (isset($_SERVER['PATH_INFO'])) {
         $uri = $_SERVER['PATH_INFO'];
     } else {
         $uri = "";
     }
     if (isset($_SESSION["autorised"])) {
         $controller = null;
         switch ($uri) {
             case "/home":
                 include_once "/core/index.php";
                 $controller = new Home();
                 $controller->view();
                 break;
             case "/test":
             case "/test/start":
             case "/test/testing":
             case "/test/test_end":
                 include_once "/core/test.php";
                 $controller = new Test();
                 if ($uri == "/test") {
                     $controller->view();
                 }
                 if ($uri == "/test/start") {
                     $controller->start();
                 }
                 if ($uri == "/test/testing") {
                     $controller->testing();
                 }
                 if ($uri == "/test/test_end") {
                     $controller->test_end();
                 }
                 break;
             case "/result":
                 include_once "/core/result.php";
                 $controller = new Result();
                 $controller->view();
                 break;
             case "/add_test":
             case "/add_test/test":
             case "/add_test/question":
             case "/add_test/test/add":
             case "/add_test/question/add":
                 include_once "/core/add_test.php";
                 $controller = new Add_Test();
                 if ($uri == "/add_test") {
                     $controller->view();
                 }
                 if ($uri == "/add_test/test") {
                     $controller->new_test();
                 }
                 if ($uri == "/add_test/question") {
                     $controller->new_question();
                 }
                 if ($uri == "/add_test/test/add") {
                     $controller->add_new_test();
                 }
                 if ($uri == "/add_test/question/add") {
                     $controller->add_new_question();
                 }
                 break;
             case "/logout":
                 include_once "/core/logout.php";
                 $controller = new Logout();
                 $controller->logout();
                 break;
             case "/registration":
             case "/registration/registration":
                 include_once "/core/registration.php";
                 $controller = new Registration();
                 if ($uri == "/registration") {
                     $controller->view();
                 }
                 if ($uri == "/registration/registration") {
                     $controller->registration();
                 }
                 break;
             case "/login":
             case "/login/login":
                 include_once "/core/login.php";
                 $controller = new Login();
                 if ($uri == "/login") {
                     $controller->view();
                 } else {
                     $controller->login();
                 }
                 break;
             default:
                 include_once "/core/index.php";
                 $controller = new Home();
                 $controller->view();
                 break;
         }
     } else {
         switch ($uri) {
             case "/registration":
             case "/registration/registration":
                 include_once "/core/registration.php";
                 $controller = new Registration();
                 if ($uri == "/registration") {
                     $controller->view();
                 }
                 if ($uri == "/registration/registration") {
                     $controller->registration();
                 }
                 break;
             case "/login":
             case "/login/login":
                 include_once "/core/login.php";
                 $controller = new Login();
                 if ($uri == "/login") {
                     $controller->view();
                 } else {
                     $controller->login();
                 }
                 break;
             case "/logout":
                 include_once "/core/logout.php";
                 $controller = new Logout();
                 $controller->logout();
                 break;
             default:
                 include_once "/core/index.php";
                 $controller = new Home();
                 $controller->view();
                 break;
         }
     }
 }
Example #24
0
<?php

include_once '../../include/config.php';
$config = new Config();
$db = $config->getConnection();
include_once '../../include/login.php';
if ($_POST) {
    $login = new Login($db);
    $login->userid = $_POST['username'];
    $login->passid = md5($_POST['password']);
    if ($login->login()) {
        echo "<script>location.href='../'</script>";
    } else {
        echo "<script>alert('Maaf kombinasi Username dan Password yang anda masukkan salah, silahkan coba lagi!')</script>";
    }
}
?>

<!DOCTYPE html>
<html >
  <head>
    <meta charset="UTF-8">
    <title>Calm breeze login screen</title>
    
    
    
    
        <link rel="stylesheet" href="css/style.css">

  </head>
  <body>
Example #25
0
require "Products.class.php";
$products = new Products($mysqli);
$page = isset($_REQUEST['page']) ? $_REQUEST['page'] : "";
// display message from the last operation
$msg = isset($_REQUEST['msg']) ? $_REQUEST['msg'] : "";
$smarty->assign("msg", $msg);
// reset message
$msg = "";
// login
if ($page == "login") {
    $username = isset($_REQUEST['username']) ? $_REQUEST['username'] : "";
    $password = isset($_REQUEST['password']) ? $_REQUEST['password'] : "";
    if ($username == "" || $password == "") {
        $msg = "error_login_empty";
    } else {
        if (!$login->login($username, $password)) {
            $msg = "error_login_invalid";
        } else {
            // successful login
        }
    }
    // redirect to admin page and display messages if error
    header("location: admin.php?msg=" . $msg);
}
// if logged in -- admin functionality
if ($login->isLoggedIn()) {
    $smarty->assign("logged_in", 1);
    switch ($page) {
        // logout
        case "logout":
            $login->logout();