Esempio n. 1
0
    return $result[0];
}
function infoFields()
{
    $s = new Right();
    return $s->getFields();
}
/* </functions> */
$action = Functions::get('action');
Functions::checkRights(__FILE__, $action, Functions::get('token'));
switch ($action) {
    case 'fields_info':
        $data = infoFields();
        break;
    case 'new':
        $data = addRight();
        break;
    case 'update':
        $data = updateRight(Functions::get('id'));
        break;
    case 'info':
        $data = infoRight(Functions::get('id'));
        break;
    case 'delete':
        $data = deleteRight(Functions::get('id'));
        break;
    case 'search':
        $data = searchRight(Functions::get('actionId'), Functions::get('statusId'));
        break;
    case 'list':
        $data = listRights();
Esempio n. 2
0
<?php 
require_once 'header.php';
function __autoload($class_name)
{
    $path = str_replace('_', '/', $class_name);
    require_once $path . '.class.php';
}
session_start();
isset($_SESSION['STAFFID']) or die('u cannot access if you are not a staff nor a manager');
if (isset($_GET['cmd'])) {
    if ($_GET['cmd'] == 'out') {
        logout();
    }
    if ($_GET['cmd'] == 'addRight') {
        addRight($_GET['staffid']);
    }
    if ($_GET['cmd'] == 'delRight') {
        delRight($_GET['staffid']);
    }
}
function logout()
{
    $_SESSION = array();
    session_destroy();
    header("refresh:0; url=admin.php");
}
function addRight($id)
{
    $dao = new DAO();
    $dao->addRight($id);
}