public function delete() { if (!$this->loggedIn()) { header('Location: index.php?c=login&m=login'); } if (!isset($_GET['id'])) { header('Location: index.php?c=client&m=index'); } $clientCollection = new ClientsCollection(); $client = $clientCollection->getOne($_GET['id']); if (is_null($client)) { header('Location: index.php?c=client&m=index'); } $clientCollection->delete($client->getId()); header('Location: index.php?c=client&m=index'); }
public function index() { if (!$this->loggedIn()) { header('Location: index.php?c=login&m=login'); } $data = array(); //users $userCollection = new UserCollection(); $users = count($userCollection->getAll()); //customers $clientCollection = new ClientsCollection(); $client = count($clientCollection->getAll()); //tours $toursCollection = new ToursCollection(); $tours = count($toursCollection->getAll()); //blog posts $blogpostCollection = new BlogCollection(); $blogs = count($blogpostCollection->getAll()); $data['users'] = $users; $data['client'] = $client; $data['tours'] = $tours; $data['blogs'] = $blogs; $this->loadView('dashboard', $data); }
<?php require_once 'header.php'; ?> <?php require_once 'nav.php'; ?> <!-- Header Carousel --> <?php $errors = array(); if (isset($_POST['username']) && isset($_POST['password']) && strlen($_POST['username']) > 3 && strlen($_POST['password']) > 3) { $password = sha1($_POST['password']); $clientsCollection = new ClientsCollection(); $username = htmlspecialchars(trim($_POST['username'])); $where = array('username' => $username); $result = $clientsCollection->getAll($where); if ($result != null && $result[0]->getPassword() == $password) { $_SESSION['client'] = $result[0]; header('Location: index.php'); } else { $errors['login'] = '******'; } } ?> <!-- Page Content --> <div class="container">
<?php require_once 'common/header.php'; if (!loggedIn()) { header('Location: login.php'); } if (!isset($_GET['id'])) { header('Location: clients.php'); } $clientCollection = new ClientsCollection(); $client = $clientCollection->getOne($_GET['id']); if (is_null($client)) { header('Location: clients.php'); } $clientCollection->delete($client->getId()); header('Location: clients.php');
<?php require_once 'common/header.php'; if (!loggedIn()) { header('Location: login.php'); } if (!isset($_GET['id'])) { header('Location: clients.php'); } $clientCollection = new ClientsCollection(); $client = $clientCollection->getOne($_GET['id']); if (is_null($client)) { header('Location: clients.php'); } $insertInfo = array('username' => $client->getUsername(), 'password' => '', 'email' => $client->getEmail()); $errors = array(); if (isset($_POST['editUser'])) { $insertInfo = array('username' => isset($_POST['username']) ? $_POST['username'] : '', 'password' => isset($_POST['password']) ? $_POST['password'] : '', 'email' => isset($_POST['email']) ? $_POST['email'] : ''); $errors = validateUserInput($insertInfo); if (empty($errors)) { $clientEntity = new ClientsEntity(); $clientEntity->setId($_GET['id']); $obj = $clientEntity->init($insertInfo); $clientCollection->save($obj); $_SESSION['flashMessage'] = 'You have 1 affected row'; header('Location: clients.php'); } } ?>
<?php require_once 'common/header.php'; if (!loggedIn()) { header('Location: login.php'); } $clientCollection = new ClientsCollection(); ?> <?php $insertInfo = array('username' => '', 'password' => '', 'email' => ''); $errors = array(); if (isset($_POST['createUser'])) { $insertInfo = array('username' => isset($_POST['username']) ? $_POST['username'] : '', 'password' => isset($_POST['password']) ? $_POST['password'] : '', 'email' => isset($_POST['email']) ? $_POST['email'] : ''); $errors = validateUserInput($insertInfo); if (empty($errors)) { $clientEntity = new ClientsEntity(); $obj = $clientEntity->init($insertInfo); $clientCollection->save($obj); $_SESSION['flashMessage'] = 'You have 1 new user'; header('Location: clients.php'); } } ?> <?php require_once 'common/sidebar.php'; ?> <!-- start: Content --> <div id="content" class="span10" xmlns="http://www.w3.org/1999/html">