public function delete()
 {
     if (!$this->loggedIn()) {
         header('Location: index.php?c=login&m=login');
     }
     if (!isset($_GET['id'])) {
         header('Location: index.php?c=user&m=index');
     }
     $userCollection = new UserCollection();
     $user = $userCollection->getOne($_GET['id']);
     if (is_null($user)) {
         header('Location: index.php?c=user&m=index');
     }
     $userCollection->delete($user->getId());
     header('Location: index.php?c=user&m=index');
 }
Example #2
0
<?php

require_once 'common/header.php';
if (!loggedIn()) {
    header('Location: login.php');
}
if (!isset($_GET['id'])) {
    header('Location: users.php');
}
$userCollection = new UserCollection();
$user = $userCollection->getOne($_GET['id']);
if (is_null($user)) {
    header('Location: users.php');
}
$userCollection->delete($user->getId());
header('Location: users.php');
?>