Пример #1
0
<?php

require_once "src/connection.php";
session_start();
if (isset($_SESSION['user']) == false) {
    header("loacation: login.php");
}
$y = USER::getAllUsers();
echo '<pre>';
var_dump($y);
echo '</pre>';
foreach ($y as $user) {
    echo "{$user->getid()} <br> {$user->getEmail()}<br>";
}
Пример #2
0
<?php

require_once dirname(dirname(__FILE__)) . '/config.php';
require SITE_ROOT . '/PHP/User.php';
require SITE_ROOT . '/PHP/check_logged_in.php';
$t = $_SESSION['user']->getIsAdmin();
if ($t != true) {
    $_SESSION['user']->logout();
    header('Location: ' . SITE_LOGIN_PAGE);
}
$users = USER::getAllUsers();
$message = '';
$message_class = 'hidden';
/*
	Determines what is input into the form and creates
	a new user, upon success, the user will be created
	and success will be written on the screen

	The second part of the case is if a user is deleted
	upon success, the user will be removed from the database
	and success will be written on the screen
*/
if (isset($_POST['form'])) {
    switch ($_POST['form']) {
        case 'AddUser':
            try {
                if (isset($_POST['admin'])) {
                    $admin = true;
                } else {
                    $admin = false;
                }