Beispiel #1
0
 * To change this license header, choose License Headers in Project Properties.
 * To change this templates file, choose Tools | Templates
 * and open the templates in the editor.
 */
//this file will receive and respond to general requests from the browser
include_once 'classes/baseDAO.php';
include 'classes/json.php';
//create daoObject
$dao = new baseDAO();
//get action or command to execute
$action = $_REQUEST["action"];
if ($action == "login") {
    $username = trim($_POST["username"]);
    $password = trim($_POST["password"]);
    //call login dao
    $user = $dao->login($username, $password);
    //check user type and take user to correct page
    $role = $user->role;
    $url = "";
    if ($role == "su" || $role == "mu") {
        //header('location:entities/index.php');
        $url = "./entities/index.php";
    } else {
        if ($role == "zsu" || $role == "re" || $role == "ad") {
            $url = "./secretariat/";
        }
    }
    $_SESSION['name'] = $user->name;
    $_SESSION['entityname'] = $user->entityObject->name;
    $_SESSION['user'] = $user;
    //var_dump($_SESSION['user']);