include "../models/Views.php"; include "../helpers/db.php"; //must be above the Post.php - order of operation include "../models/Users.php"; $myview = new Views(); $users = new Users(); ?> <!--<link href="/day4/css/site.css" rel="stylesheet" />--> <!--dirrect path - can use this due to the ../ paths--> <?php if (!empty($_GET["action"])) { if ($_GET["action"] == "updateUser") { $data = $users->readUser($_GET["userId"]); $myview->getView("../views/formUpdate.php", $data); } elseif ($_GET["action"] == "changeUser") { $users->updateUser($_POST["userName"], $_POST["password"], $_POST["email"], $_POST["userId"]); $data = $users->readUsers(); $myview->getView("../views/body.php", $data); } elseif ($_GET["action"] == "deleteUser") { $users->deleteUser($_GET["userId"]); $data = $users->readUsers(); $myview->getView("../views/body.php", $data); } elseif ($_GET["action"] == "createUser") { $users->createUser($_POST["userName"], $_POST["password"], $_POST["email"]); $data = $users->readUsers(); $myview->getView("../views/body.php", $data); } } elseif (empty($_GET["userId"])) { $data = $users->readUsers(); $myview->getView("../views/body.php", $data); }
<?php require_once "../config.inc.php"; $db = Database::obtain(DB_SERVER, DB_USER, DB_PASS, DB_DATABASE); $db->connect(); if (!empty($_REQUEST['uid'])) { $uid = $_REQUEST['uid']; } $mode = $_REQUEST['mode']; print_r($_REQUEST); if ($mode === "reports") { $r = new Reports('member', BASE_DOMAIN); $delete = $r->delete($uid); } elseif ($mode === "users") { $u = new Users('member', BASE_DOMAIN); $delete = $u->deleteUser($uid); } elseif ($mode === "projects") { $uid = $_REQUEST['proj_delete_uid']; $p = new Projects('member', BASE_DOMAIN); $delete = $p->deleteProject($uid); } elseif ($mode === "categories") { $uid = $_REQUEST['cat_delete_uid']; $p = new Projects('member', BASE_DOMAIN); $delete = $p->deleteCategory($uid); } else { //nothing }
<?php require_once "Users.php"; $user = new Users(); $users = $user->userInfo(); $smarty->assign("users", $users); foreach ($_POST as $uid) { $rs = $user->deleteUser($uid); } if (isset($rs)) { header('Location: deletecust.php'); }
$cn->insertUsers($user[0]); }); $app->get('/api/users/:id', function ($id) { $cn = new Users(); $cn->getUsersById($id); }); $app->put('/api/users/:id', function ($id) use($app) { $req = $app->request(); $bdy = $req->getBody(); $user = json_decode($bdy); $cn = new Contacts(); $cn->updateUser($id, $user[0]); }); $app->delete('/api/users/:id', function ($id) { $cn = new Users(); $cn->deleteUser($id); }); $app->get('/api/users/:id/suggestions', function ($id) { $cn = new Suggestions(); $cn->getSuggestionsByUser($id); }); $app->get('/api/suggestions/', function () { $cn = new Suggestions(); $cn->getSuggestions(); }); $app->get('/api/suggestions/:id', function ($id) { $cn = new Suggestions(); $cn->getSuggestionsByID($id); }); $app->post('/api/suggestions/', function () use($app) { $req = $app->request();
if ($_POST['newpw'] == $_POST['newpw2']) { $change = $auth->changePassword($_SESSION['auth']['user'], $_POST['oldpw'], $_POST['newpw']); if ($change == false) { $smarty->assign('error', 'Unable to change password. Please try again'); } else { $smarty->assign('error', 'Your password has been changed'); } } else { $smarty->assign('error', 'New passwords do not match'); } } if (!empty($_POST['user']) && !empty($_POST['pass'])) { $add = $users->createUser($_POST['user'], $_POST['pass']); if ($add != false) { header('Location: users.php'); } $smarty->assign('error', 'Unable to create user. Please try again'); } } if (!empty($_GET['delete'])) { $delete = $users->deleteUser($_GET['delete']); if ($delete != false) { header('Location: users.php'); } $smarty->assign('error', 'Unable to delete the user. Please try again'); } $allusers = $users->getUsers(); $smarty->assign('users', $allusers); $smarty->display('_header.tpl'); $smarty->display('users.tpl'); $smarty->display('_footer.tpl');
$files = $fdb->getFiles(); if ($files && count($files) > 0) { foreach ($files as $file) { $fdb->deleteFile($file->key); } } // Delete all stories $stdb = new Stories(); $stories = $stdb->getStories(); if ($stories && count($stories) > 0) { foreach ($stories as $story) { $stdb->deleteStory($story['id']); } } // Delete all widgets $wdb = new Widgets(); $widgets = $wdb->getWidgets(); if ($widgets && count($widgets) > 0) { foreach ($widgets as $widget) { $wdb->deleteWidget($widget['id']); } } // Delete all properties $up = new Properties(array(Properties::KEY => $user->id)); $up->deleteAllProperties(); $wp = new WidgetsProperties(array(Properties::KEY => $user->id)); $wp->deleteAllProperties(); // Delete the user $udb->deleteUser($user->id); // Exit with proper message die("User {$user->username} has been deleted.\r\n");
public function userAction($reception = null, $item_id = null) { $this->view->setVar("TopMenuSelected", 'work'); $this->view->setVar("MenuSelected", 'user'); $this->view->setVar("MenuItemActive", $reception); if (!empty($reception)) { $view = $reception; switch ($reception) { case 'add': $this->view->setVar("StationsAll", Stations::getStations()); $this->view->setVar("RolesAll", Roles::getRoles()); $this->view->setVar("LanguagesAll", References::getLanguages()); $this->view->setVar("CurrencyAll", References::getCurrency()); $this->view->setVar("Units1", References::getUnits(NULL, array(1))['units']); $this->view->setVar("Units2", References::getUnits(NULL, array(3))['units']); $this->view->setVar("Units3", References::getUnits(NULL, array(4))['units']); break; case 'preview': if ($this->request->isPost()) { if ((bool) $this->request->getPost('add')) { View::addMessages($this, [Users::addUser($this->request->getPost())]); } if ((bool) $this->request->getPost('delete')) { View::addMessages($this, [Users::deleteUser($this->request->getPost('id'))]); } } $this->view->setVar("UsersAll", Users::getUsers()); break; case 'edit': if (empty($item_id)) { if ($this->request->isPost()) { $this->response->redirect('/administration/user/edit/' . $this->request->getPost('user_id'), '/'); } View::addMessages($this, [array('class' => 'alert-info', 'text' => "<p><b>Выберите</b> из выпадающего списка <b>профиль пользователя</b>, который нужно изменить.</p>")]); $this->view->setVar("UsersAll", Users::getUsers()); } else { if ($this->request->isPost()) { View::addMessages($this, [Users::setUser($this->request->getPost())]); } $this->view->setVar("User", Users::getUsers($item_id)); $this->view->setVar("StationsAll", Stations::getStations()); $this->view->setVar("RolesAll", Roles::getRoles()); $this->view->setVar("LanguagesAll", References::getLanguages()); $this->view->setVar("CurrencyAll", References::getCurrency()); $this->view->setVar("Units1", References::getUnits(NULL, array(1))['units']); $this->view->setVar("Units2", References::getUnits(NULL, array(3))['units']); $this->view->setVar("Units3", References::getUnits(NULL, array(4))['units']); } break; } $this->view->pick('/administration/' . "user_" . $view); } }
<?php include_once "users.php"; if (isset($_GET['del'])) { $id = $_GET['del']; $art = new Users(); $art->deleteUser($id); } header("Location: manage_veiw.php");
} else { if (isset($_POST["login"])) { Users::editUser(new User($_POST["login"], $_POST["password"], $_POST["firstname"], $_POST["lastname"])); } } } if ($_POST["action"] == 'sendInsertForm') { if (isset($_FILES['image'])) { if (Movies::insertImage($_FILES["image"])) { Movies::insertMovie(new Movie(0, $_POST["title"], $_POST["short_description"], $_POST["long_description"], $_POST["director"], $_POST["year"], $_FILES["image"]["name"])); } } } if ($_POST["action"] == 'sendDeleteForm') { if (isset($_POST["id"])) { Movies::deleteMovie($_POST["id"]); } else { if (isset($_POST["login"])) { Users::deleteUser($_POST["login"]); } } } if ($_POST["action"] == 'sendSubscribeForm') { Users::insertUser(new User($_POST["login"], password_hash($_POST["password"], PASSWORD_DEFAULT), $_POST["firstname"], $_POST["lastname"])); } header('Location: .'); exit; } } catch (Exception $e) { header('Location: .?error=' . $e->getMessage()); }
/** * Delete a user */ public function deleteAction() { $usersModel = new Users(); $usersModel->deleteUser($this->_getParam('userId')); $this->_helper->getHelper('Redirector')->gotoRouteAndExit(array(), 'users-index'); }
<?php include_once "../includes/webservice.inc.php"; $webService = new Webservices_Writer(); $webService->init(); $usersObj = new Users(); $data = isset($_POST['data']) ? $_POST['data'] : ''; if ($result = $usersObj->deleteUser($data)) { $webService->createXMLInstance(); $webService->appendArrayToRootNode('', $result); $webService->displayXML(); } else { $xmls = $webService->errorXML(join(",", $usersObj->errorMessages)); $webService->outputXML($xmls); }