<?php $id = Url::getParam('id'); if (!empty($id)) { $objUser = new User(); $user = $objUser->getUser($id); if (!empty($user)) { $objOrder = new Order(); $orders = $objOrder->getClientOrders($id); if (empty($orders)) { $yes = '/admin' . Url::getCurrentUrl() . '&remove=1'; $no = 'javascript:history.go(-1)'; $remove = Url::getParam('remove'); if (!empty($remove)) { $objUser->removeUser($id); Helper::redirect('/admin' . Url::getCurrentUrl(array('action', 'id', 'remove', 'srch', Paging::$_key))); } require_once 'template/_header.php'; ?> <h1>Clients :: Remove</h1> <p>Are you sure you want to remove this client (<?php echo $user['first_name'] . " " . $user['last_name']; ?> )?<br /> There is no undo!<br /> <a href="<?php echo $yes; ?> ">Yes</a> | <a href="<?php echo $no; ?>
//check if some parrams are missing if (empty($_POST['username']) || empty($_POST['password'])) { returnError('Missing or empty post parameters.'); } $username = $_POST['username']; $password = $_POST['password']; if (!ctype_alpha($username)) { returnError('All username chars must be english letters.'); } if (preg_match('/\\s/', $password)) { returnError('Password can`t contain any whitespaces.'); } if (strlen($password) < 6) { returnError('Password must be longer then five characters.'); } $u = new User(); $u->loginUser($username, $password); }); //POST ROUTE REMOVE $app->post('/remove', function () { //check if some parrams are missing if (empty($_POST['username']) || empty($_POST['password'] || empty($_POST['token']))) { returnError('Missing or empty post parameters.'); } $username = $_POST['username']; $password = $_POST['password']; $token = $_POST['token']; $u = new User(); $test = $u->removeUser($username, $password, $token); }); $app->run();