Exemple #1
0
 function Start()
 {
     $App = $this->App;
     $View = $this->View;
     # Put your logic here
     $Users = new SystemUsersModel($App);
     $View->Count = $Users->UserCount();
     if (isset($_POST['sel'])) {
         foreach ($_POST['sel'] as $v) {
             $App->Session->RemoveUser($App->Session->Username($v));
         }
         echo "A total number of " . count($_POST['sel']) . " users where removed.<hr/><a href='?'>Back</a>";
     } else {
         $limit = 30;
         $offset = 0;
         if (isset($_GET['limit'])) {
             $limit = $_GET['limit'];
         }
         if (isset($_GET['offset'])) {
             $offset = $_GET['offset'];
         }
         $View->Users = $Users->AllUsers($offset, $limit);
         $View->Offset = $offset;
         $View->Limit = $limit;
     }
     $this->Present();
 }
Exemple #2
0
 function Start()
 {
     $App = $this->App;
     $Users = new SystemUsersModel($App);
     $this->View->Sessions = $Users->AllSessions();
     $this->Present();
 }
Exemple #3
0
 function Start()
 {
     $App = $this->App;
     $View = $this->View;
     # Put your logic here
     $Users = new SystemUsersModel($App);
     $View->Count = $Users->UserCount();
     if (isset($_POST['uid'])) {
         $UserID = $_POST['uid'];
         $Username = $_POST['Username'];
         $Password = $_POST['Password'];
         if ($Password == "") {
             $Password = null;
         }
         $Result = $App->Session->EditUser($App->Session->Username($UserID), $Username, $Password);
         if ($Result) {
             echo "Edit successful.";
         } elseif ($Result == false) {
             echo "The new username you specified already exists!";
         } elseif ($Result == null) {
             echo "The old username you specified does not exist!";
         }
         echo "<hr/><a href='?' >Back</a>";
     } elseif (isset($_GET['uid'])) {
         $View->User = $Users->User($_GET['uid']);
         $View->User = $View->User[0];
     } else {
         $limit = 30;
         $offset = 0;
         if (isset($_GET['limit'])) {
             $limit = $_GET['limit'];
         }
         if (isset($_GET['offset'])) {
             $offset = $_GET['offset'];
         }
         $View->Users = $Users->AllUsers($offset, $limit);
         $View->Offset = $offset;
         $View->Limit = $limit;
     }
     $this->Present();
 }
Exemple #4
0
 function Start()
 {
     $View = $this->View;
     if (isset($_POST['rid'])) {
         $Replace = $_POST['Replace'];
         if ($_POST['rid']) {
             foreach ($_POST['rid'] as $R) {
                 if ($_POST['uid']) {
                     foreach ($_POST['uid'] as $U) {
                         $this->App->RBAC->User_AssignRole($R, $U, $Replace);
                     }
                 }
             }
         }
         $View->Result = count($_POST['rid']) * count($_POST['uid']);
     }
     $Userman = new SystemUsersModel($this->App);
     $View->Users = $Userman->AllUsers();
     $View->Roles = $this->App->RBAC->Role_All();
     $this->Present();
 }
<?php

include "session.php";
?>
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<?php 
include '../model/SystemUsers.php';
$model = new SystemUsersModel();
$model->printUsers();
//if (isset($_GET['generate-pdf'])) {
//$model->printUsers();
//}
?>
<html>
    <head>
        <meta charset="UTF-8">
        <link href="../css/style.css" rel="stylesheet" type="text/css"/>
        <title>Users Page</title>
        <style type="text/css">
            p2{
                color: #ff0307;
                font-family: Cambria;
                font-size: 14px; 
                font-weight: bold;
                //text-align: center;
            }
        $middle_nameErr = "Second Name is Required !";
    }
    if (empty($appointment)) {
        $appointmentErr = "Appointment is Required !";
    }
    if (empty($email)) {
        $emailErr = "Email is Required !";
    }
    if (empty($username)) {
        $usernameErr = "User Name is Required !";
    }
    if (empty($role)) {
        $roleErr = "Role is Required !";
    }
    if (!empty($first_name) && !empty($middle_name) && !empty($appointment) && !empty($email) && !empty($username) && !empty($role)) {
        $model = new SystemUsersModel();
        if ($model->addUser($first_name, $middle_name, $last_name, $appointment, $email, $username, $password, $role) > 0) {
            header("location : users.php");
        } else {
            $error = "Addition of new User Failed !";
        }
    }
}
?>
<html>
    <head>
        <link href="../css/style.css" rel="stylesheet" type="text/css"/>
        <style type="text/css">
            p2{
                color: #ff0307;
                font-family: Cambria;
<!--[if IE 9 ]>    <html lang="en" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]-->
<?php 
// put your code here
include 'model/SystemUsers.php';
$username = $password = $usernameErr = $passwordErr = $loginErr = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $username = test_input($_POST['username']);
    if (empty($username)) {
        $usernameErr = "Email or User Name is Required!";
    }
    $password = test_input($_POST['password']);
    if (empty($password)) {
        $passwordErr = "Password is Required !";
    }
    $model = new SystemUsersModel();
    if (!empty($username) && !empty($password)) {
        if ($model->login($username, $password) == 1) {
            $_SESSION['login_user'] = $username;
            // Initializing Session
            header("location: views/dashboard.php");
        } else {
            $loginErr = "Login Failed !";
        }
    }
}
function test_input($data)
{
    $data = trim($data);
    $data = stripslashes($data);
    $data = htmlspecialchars($data);
if (isset($_POST['delete-client'])) {
    include '../model/ClientModel.php';
    $model = new ClientModel();
    $id = $_POST['id'];
    if ($model->deleteClient($id)) {
        header("location: clients.php");
    }
} else {
    if (isset($_POST['delete-system-message'])) {
        include '../model/Messages.php';
        $model = new Messages();
        $id = $_POST['id'];
        if ($model->deleteSystemMessages($id)) {
            header("location: system-messages.php");
        }
    } else {
        if (isset($_POST['delete-user'])) {
            require_once '../model/SystemUsers.php';
            $model = new SystemUsersModel();
            $id = $_POST['id'];
            if ($model->deleteUser($id)) {
                header("location: users.php");
            }
        }
    }
}
?>