本文整理汇总了PHP中User::deleteUser方法的典型用法代码示例。如果您正苦于以下问题:PHP User::deleteUser方法的具体用法?PHP User::deleteUser怎么用?PHP User::deleteUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类User
的用法示例。
在下文中一共展示了User::deleteUser方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteUser
function deleteUser()
{
$user = new User();
$user->deleteUser($_POST['usr_id']);
if (isset($_SESSION['id']) && $_SESSION['id'] == $_POST['usr_id']) {
logout();
}
}
示例2: deleteAction
/**
* Enter description here ...
*/
public function deleteAction()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$request = $this->getRequest();
$ids = $request->getParam('cid');
$user = new User();
$user->deleteUser($ids);
$this->_redirect('admin/user/show');
}
示例3: deleteUser
function deleteUser($id)
{
global $bdd, $_TABLES;
if (!is_null($bdd) && !is_null($_TABLES)) {
$objUser = new User($bdd, $_TABLES);
$objUser->deleteUser($id);
} else {
error_log("BDD ERROR : " . json_encode($bdd));
error_log("TABLES ERROR : " . json_encode($_TABLES));
}
}
示例4: logged_in
function logged_in()
{
session_start();
if (isset($_SESSION['password']) == FALSE) {
return FALSE;
}
//echo 'girmedi';
if (isset($_SESSION['creation'])) {
if (time() - $_SESSION['creation'] > 180) {
User::deleteUser($_SESSION['password']);
return FALSE;
}
} else {
return FALSE;
}
return TRUE;
}
示例5: go
public function go()
{
if (isset($_GET['id'])) {
$id = $_GET['id'];
}
if (isset($_POST['submit'])) {
if ($_POST['username'] == '') {
$this->addErrorMessage("Name of the user should not be empty");
} elseif ($_POST['email'] == '') {
$this->addErrorMessage("Email should not be empty");
} elseif ($_POST['full_name'] == '') {
$this->addErrorMessage("Please enter your full name");
} elseif ($_POST['is_activated'] == '') {
$this->addErrorMessage("Is the user activated or not");
} elseif ($_POST['type'] == '') {
$this->addErrorMessage("Please select the type of the user");
} else {
$this->username = $_POST['username'];
$this->email = $_POST['email'];
$this->password = $_POST['password'];
$this->full_name = $_POST['full_name'];
$this->is_activated = $_POST['is_activated'];
$this->type = $_POST['type'];
User::updateUser($id, $this->username, $this->full_name, $this->email, $this->password, $this->is_activated, $this->type);
$this->addSuccessMessage("User details have been updated succesfully");
}
}
$users = User::getUser($id);
$this->setViewTemplate('edituser.tpl');
$this->addToView('user', $users[0]);
$this->generateView();
if (isset($_POST['deletesubmit'])) {
User::deleteUser($id);
$this->addSuccessMessage("User has been deleted succesfully");
header('Location:' . SOURCE_ROOT_PATH . "admin/pages/usermanager.php?source=del");
}
}
示例6:
$usr = $db->select($us->getUserById($id))->fetch_assoc();
// if submit button is pressed
if (isset($_POST['submit'])) {
// simple validation
if ($name == '' && !isset($_POST['name']) || $setadmin == '' && !isset($_POST['isAdmin'])) {
// set error
$error = 'Please fill out all required fields.';
} else {
//assign variables
$name = mysqli_real_escape_string($db->link, $_POST['name']);
$isadmin = mysqli_real_escape_string($db->link, $_POST['isAdmin']);
$update_row = $db->update($us->updateUser($name, $isadmin, $id));
}
}
if (isset($_POST['delete'])) {
$delete_row = $db->delete($us->deleteUser($id));
}
// password change section
if (isset($_POST['submit2'])) {
if (isset($_POST['password']) && isset($_POST['newPassword']) && isset($_POST['confirmPassword']) && $_POST['password'] != '' && $_POST['newPassword'] != '' && $_POST['confirmPassword'] != '') {
$newPassword = $_POST['newPassword'];
$confirm = $_POST['confirmPassword'];
if ($newPassword == $confirm) {
$newPassword = password_hash($newPassword, PASSWORD_DEFAULT);
$password = $_POST['password'];
$password = password_hash($password, PASSWORD_DEFAULT);
// get password
$row = $db->select($us->getPasswordById($id))->fetch_assoc();
if ($row) {
$hash = $row['Password'];
if (password_verify($_POST['password'], $hash)) {
示例7: User
<?php
// Include common functions and declarations
require_once "../../include/common.php";
// Create user object
$user = new User(getGetValue("userId"));
// Check if user is webmaster
if (!$user->hasEditPermission()) {
$login->printLoginForm();
exit;
}
// Delete user
$deleteUser = getValue("deleteUser");
if (!empty($deleteUser)) {
// Delete user
$user->deleteUser();
// Redirect to user index
redirect(scriptUrl . "/" . folderUsers);
} else {
if (!empty($_GET["save"])) {
// Save user data
$errors = $user->saveUser();
// Redirect to user index
if (!$errors->hasErrors()) {
redirect(scriptUrl . "/" . folderUsers);
}
}
}
// Add navigation links
$site->addNavigationLink(scriptUrl . "/" . folderAdmin, $lAdminIndex["Header"]);
$site->addNavigationLink(scriptUrl . "/" . folderUsers, $lUserIndex["Header"]);
示例8: dirname
<?php
require_once dirname(__FILE__) . "/../conf/config.php";
require_once dirname(__FILE__) . "/../conf/functions.php";
if ($_SERVER['REQUEST_METHOD'] != "POST") {
// nothing
} else {
$user = new User();
$user->deleteUser($_POST['id']);
}
header('Location: index.php');
exit;
示例9: deleteUser
/**
* @brief Detete user
*
* DELETE https://server/pathname/version/username
*
* Deletes the user account.
* NOTE: Requires simple authentication with the username and password associated with the account.
*
* Return value:
* 0 on success
*
* Possible errors:
* 503: there was an error removing the user
* 404: the user does not exist in the database
* 401: authentication failed
*
* @param string $userName
*/
private function deleteUser($syncUserHash)
{
if (User::syncUserExists($syncUserHash) == false) {
Utils::changeHttpStatus(Utils::STATUS_NOT_FOUND);
return true;
}
if (User::authenticateUser($syncUserHash) == false) {
Utils::changeHttpStatus(Utils::STATUS_INVALID_USER);
return true;
}
$userId = User::userHashToId($syncUserHash);
if ($userId == false) {
Utils::changeHttpStatus(Utils::STATUS_INVALID_USER);
return true;
}
if (Storage::deleteStorage($userId) == false) {
Utils::changeHttpStatus(Utils::STATUS_MAINTENANCE);
return true;
}
if (User::deleteUser($userId) == false) {
Utils::changeHttpStatus(Utils::STATUS_MAINTENANCE);
return true;
}
OutputData::write('0');
return true;
}
示例10: head
<?php
// making Sql connection
require_once 'settings\\db_settings.php';
require_once 'db.php';
require_once 'elements/user.php';
$db = DB::start();
User::$db = $db;
head();
switch (true) {
case isset($_GET['edit']):
break;
case isset($_GET['delete']):
User::deleteUser($_GET['delete']);
break;
case isset($_GET['delete_confirm']):
User::confirmDeleteUser($_GET['delete_confirm']);
case true:
User::listUsers();
break;
}
footer();
function head()
{
?>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<?php
示例11: User
$user2 = new User(Input::get('uid'));
if (!$user2->exist()) {
session::flash('error', 'The user does not exists!');
Redirect::to(path . 'index.php');
}
} else {
session::flash('error', 'The user does not exists!');
Redirect::to(path . 'index.php');
}
if (Input::exists()) {
if (Token::check(Input::get('token'))) {
$val = new Validation();
$val->check($_POST, array('id' => array('required' => true)));
if ($val->passed()) {
try {
$user2->deleteUser(Input::get('id'));
session::flash('complete', 'You deleted ' . $user2->data()->name);
Redirect::to(path . 'index.php');
} catch (Exception $e) {
session::flash('error', $e->getMessage());
Redirect::to(path . 'index.php');
}
}
}
}
?>
<html>
<head>
<?php
include path . 'assets/php/css.php';
?>
示例12: User
*/
header('content-type: text/html; charset=utf-8');
session_start();
include "./classElement.php";
include "./classUser.php";
if (isset($_POST['Registruotis']) && $_POST['Registruotis'] == 'Registruotis') {
$_SESSION["user"] = $_POST['user'];
$_SESSION["pass"] = $_POST['pass'];
}
if ($_SESSION["user"] == "trinti" && $_SESSION["pass"] == "leidziama") {
$user = new User();
/**
* Vartotojo trinimas
*/
if ($_GET['action'] == "delete") {
$user->deleteUser($_GET['id']);
echo $user->createUsersList($_GET['sort']);
/**
* Vartotojo duomenu keitimas
*/
} elseif ($_GET['action'] == "edit") {
$user->getUserData($_GET['id']);
if (isset($_GET['name'])) {
$userName = $_GET['name'];
$email = $_GET['email'];
} else {
$userName = $user->getUserName();
$email = $user->getUserEmail();
}
$id = $_GET['id'];
if (isset($_GET['Ivesti']) && $_GET['Ivesti'] == 'Įvesti') {
示例13: welcome
});
$app->get('/users/:id', function ($id) use($app) {
$user = new User();
$user->getUser($app, $id);
});
$app->post('/users', function () use($app) {
$user = new User();
$user->createUser($app);
});
$app->put('/users/:id', function ($id) use($app) {
$user = new User();
$user->modifyUser($app, $id);
});
$app->delete('/users/:id', function ($id) use($app) {
$user = new User();
$user->deleteUser($app, $id);
});
// **
//Connexion
// **
$app->post('/connexion', function () use($app) {
$co = new theConnexion();
$co->connexion($app);
});
$app->post('/inscription', function () use($app) {
$co = new theConnexion();
$co->inscription($app);
});
// Welcome in routing
function welcome()
{
示例14: elseif
} elseif ($user['user_group'] == "user") {
$smarty->assign("selectedadmin", "");
$smarty->assign("selectedmanager", "");
$smarty->assign("selecteduser", "selected");
}
$smarty->assign("menu", $_SESSION['user']->getGroup());
$smarty->assign("content", $menu);
break;
case 'userSaveUpdate':
$smarty->assign("title", "Modification enregistrée ");
$smarty->assign("pseudo", $_SESSION['pseudo']);
$smarty->assign("email", $_SESSION['email']);
$smarty->assign("group", $_SESSION['group']);
$smarty->assign("menu", $_SESSION['user']->getGroup());
$smarty->assign("content", "userSave");
break;
case 'userDelete':
$userId = $_GET["id"];
User::deleteUser($userId);
$_SESSION['userList'] = User::getAllUser();
$smarty->assign("title", "Gestion des utilisateurs");
$smarty->assign("menu", $_SESSION['user']->getGroup());
$smarty->assign("content", "userList");
$smarty->assign("userList", $_SESSION['userList']);
$smarty->assign("size", $_SESSION['size']);
break;
}
$smarty->display('homePage.tpl');
} else {
Url::relocate('home.php');
}
示例15: elseif
<?php
require_once 'includes/header.php';
if ($request['action'] == 'users') {
$title = "Account Management";
if (isset($_POST['action'])) {
if ($_POST['action'] == 'delete') {
// Deleting the User's account
User::deleteUser($_POST['uid']);
} elseif ($_POST['action'] == "change_permission") {
// Granting a new permission
switch ($_POST['permission_level']) {
case 'No Access':
case 'New Applicant':
case 'Member':
$required_permission = $user->getDirectorAccess();
break;
case 'Director':
case 'CEO':
$required_permission = $user->getCEOAccess();
break;
case 'Admin':
$required_permission = $user->getAdminAccess();
break;
}
if ($required_permission) {
if ($user->getAdminAccess()) {
// Admins can change permissions for anyone in the auth
$stmt = $db->prepare('UPDATE user_accounts SET access = ? WHERE uid = ?');
$stmt->execute(array($_POST['permission_level'], $_POST['uid']));
} else {