示例#1
0
文件: login.php 项目: brajovela/hrm
<?php

include "include.common.php";
include "server.includes.inc.php";
if (empty($user)) {
    if (!empty($_REQUEST['username']) && !empty($_REQUEST['password'])) {
        $suser = null;
        $ssoUserLoaded = false;
        include 'login.com.inc.php';
        if (empty($suser)) {
            $suser = new User();
            $suser->Load("(username = ? or email = ?) and password = ?", array($_REQUEST['username'], $_REQUEST['username'], md5($_REQUEST['password'])));
        }
        if ($suser->password == md5($_REQUEST['password']) || $ssoUserLoaded) {
            $user = $suser;
            saveSessionObject('user', $user);
            $suser->last_login = date("Y-m-d H:i:s");
            $suser->Save();
            if (!$ssoUserLoaded && !empty($baseService->auditManager)) {
                $baseService->auditManager->user = $user;
                $baseService->audit(IceConstants::AUDIT_AUTHENTICATION, "User Login");
            }
            if ($user->user_level == "Admin") {
                header("Location:" . CLIENT_BASE_URL . "?g=admin&n=dashboard&m=admin_Admin");
            } else {
                header("Location:" . CLIENT_BASE_URL . "?g=modules&n=dashboard&m=module_Personal_Information");
            }
        } else {
            header("Location:" . CLIENT_BASE_URL . "login.php?f=1");
        }
    }
示例#2
0
<?php

include "include.common.php";
if (defined('MODULE_PATH')) {
    saveSessionObject("modulePath", MODULE_PATH);
}
define('CLIENT_PATH', dirname(__FILE__));
include CLIENT_PATH . "/include.common.php";
include CLIENT_PATH . "/server.includes.inc.php";
$user = getSessionObject('user');
$employeeCurrent = null;
$employeeSwitched = null;
if (!empty($user->employee)) {
    $employeeCurrent = $baseService->getElement('Employee', $user->employee, null, true);
    if (!empty($employeeCurrent)) {
        $employeeCurrent = $fileService->updateEmployeeImage($employeeCurrent);
    }
}
if ($user->user_level == 'Admin' || $user->user_level == 'Manager') {
    $switchedEmpId = $baseService->getCurrentEmployeeId();
    if ($switchedEmpId != $user->employee && !empty($switchedEmpId)) {
        $employeeSwitched = $baseService->getElement('Employee', $switchedEmpId, null, true);
        if (!empty($employeeSwitched)) {
            $employeeSwitched = $fileService->updateEmployeeImage($employeeSwitched);
        }
    }
}
$activeEmployee = null;
if (!empty($employeeSwitched)) {
    $activeEmployee = $employeeSwitched;
} else {
示例#3
0
 public function setCurrentAdminEmployee($employeeId)
 {
     if (!function_exists('saveSessionObject')) {
         include APP_BASE_PATH . "include.common.php";
     }
     if ($employeeId == "-1") {
         saveSessionObject('admin_current_employee', null);
         return;
     }
     if ($this->currentUser->user_level == 'Admin') {
         saveSessionObject('admin_current_employee', $employeeId);
     } else {
         if ($this->currentUser->user_level == 'Manager') {
             $subordinate = new Employee();
             $subordinates = $subordinate->Find("supervisor = ?", array($this->currentUser->employee));
             $subFound = false;
             foreach ($subordinates as $sub) {
                 if ($sub->id == $employeeId) {
                     $subFound = true;
                     break;
                 }
             }
             if (!$subFound) {
                 return;
             }
             saveSessionObject('admin_current_employee', $employeeId);
         }
     }
 }
 public function setCurrentAdminEmployee($employeeId)
 {
     include APP_BASE_PATH . "include.common.php";
     if ($this->currentUser->user_level == 'Admin') {
         if ($employeeId == "-1") {
             saveSessionObject('admin_current_employee', null);
         } else {
             saveSessionObject('admin_current_employee', $employeeId);
         }
     }
 }