Beispiel #1
0
/**
 * login for both nurse and admin
 */
function login()
{
    $user_type = $_REQUEST['user_type'];
    $username = $_REQUEST['username'];
    $password = $_REQUEST['password'];
    if ($user_type == 'admin') {
        include '../models/model_admin.php';
        $admin = new admin();
        $row = $admin->login($username, $password);
        if (!$row) {
            echo '{"result":0,"message": "Your details as an admin are wrong."}';
            return;
        }
        set_admin_session($row);
        echo '{"result":1,"message": "' . $_SESSION['admin_fn'] . ' is logged in"}';
        return;
    } elseif ($user_type == 'nurse') {
        include '../models/model_nurse.php';
        $nurse = new nurse();
        $row = $nurse->login($username, $password);
        if (!$row) {
            echo '{"result":0,"message": "Your details as a nurse are wrong."}';
            return;
        }
        set_nurse_session($row);
        echo '{"result":1,"message": "' . $_SESSION['nurse_name'] . ' is logged in"}';
        return;
    }
}
Beispiel #2
0
     $includeFile = "manageusers";
     break;
 case "editprofile":
     $includeFile = "editprofile";
     break;
 case "edituser":
     if (!$ps->is_admin() && $_REQUEST["username"] != $_SESSION["photostack_user"]->username) {
         $adminMessage = "You do not have permission to perform this operation.";
         $ps->select_gallery();
         $includeFile = "view";
     } else {
         $includeFile = "edituser";
     }
     break;
 case "login":
     if ($ps->login()) {
         if ($_POST['forward_url']) {
             header("Location: " . $_POST['forward_url']);
         }
         $ps->select_gallery($_POST['gallery']);
         $adminMessage = "Welcome to Organize";
         $includeFile = "view";
     } else {
         $adminMessage = $ps->last_error();
         $includeFile = "login";
     }
     break;
 case "logout":
     $ps->logout();
     $adminMessage = "Thank you and goodbye!";
     $includeFile = "login";
Beispiel #3
0
    }
    public function get_report($stmt)
    {
        if ($stmt == 'work or study report') {
            $sql = 'select * from research where do_present = "working";';
            $res = parent::query($sql, $rows, $num_rows);
            if ($res) {
                print 'Rows: ' . $num_rows;
            } else {
                print $res;
            }
        } else {
        }
    }
}
$admin = new admin();
if (isset($_POST['dowhat']) && $_POST['dowhat'] == 'login') {
    if (!isset($_POST['username']) || !isset($_POST['pwd'])) {
        print 'access without username or password';
        exit;
    }
    if (empty($_POST['username']) || empty($_POST['pwd'])) {
        print 'username or password is empty';
        exit;
    }
    $admin->username = trim($_POST['username']);
    $admin->pwd = trim($_POST['pwd']);
    $admin->login();
} elseif (isset($_POST['dowhat']) && $_POST['dowhat'] == 'report') {
    $admin->get_report();
}
Beispiel #4
0
<?php

include $_SERVER['DOCUMENT_ROOT'] . "/common/class/admin/admin.class.php";
include "ImgVerification.php";
$vImage = new vImage();
$vImage->loadCodes();
//include "common/function.php";
if (!$vImage->checkCode()) {
    ?>
 <script>
 alert('Please enter the exact value from image');
 window.location="login.php";</script><?php 
    exit;
}
$login = new admin();
$login_status = $login->login($_POST['user'], $_POST['pass']);
//login($_POST['user'],$_POST['pass']);
$check_login = $login->checklogin();
if ($login->checklogin() == true) {
    echo "<script> window.location='index.php'; </script>";
} else {
    echo "<script> alert('Invalid Username and Password'); window.location='index.php'; </script>";
}
Beispiel #5
0
<?php

// Includng configuration file
include 'config/config.php';
$admin = new admin();
if (!empty($_POST) && isset($_POST['username']) && isset($_POST['password'])) {
    $data = $_POST;
    if ($admin->login($data)) {
        $_SESSION['message'] = 'You have login successfully!';
        header('Location: ' . FRONTEND . 'dashboard.php');
        exit;
    } else {
        $_SESSION['message'] = 'Wrong password entered!';
        header('Location: ' . FRONTEND . 'index.php');
        exit;
    }
}
Beispiel #6
0
<?php

include 'config.inc.php';
require ABSPATH . '/include/mydb.class.php';
include ABSPATH . '/include/mydir.class.php';
require ABSPATH . '/include/class.category.php';
require ABSPATH . '/include/prompt.class.php';
require ABSPATH . '/include/user.class.php';
require ABSPATH . '/include/function.php';
$db = new db('localhost', 'root', '', 'mycms');
admin::login($db);