本文整理汇总了PHP中editUser函数的典型用法代码示例。如果您正苦于以下问题:PHP editUser函数的具体用法?PHP editUser怎么用?PHP editUser使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了editUser函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: start
function start()
{
if (!empty($_POST)) {
if (!isset($_POST['id'])) {
createUser($_POST);
} else {
editUser($_POST);
}
require '../views/list.php';
return;
}
if (!isset($_GET['id']) && !isset($_GET['page'])) {
$people = getPeople();
require '../views/list.php';
return;
}
if (isset($_GET['page']) && $_GET['page'] === 'add') {
require '../views/add.php';
return;
}
if (isset($_GET['page']) && $_GET['page'] === 'edit') {
if (!isset($_GET['id'])) {
die('veuillez spécifier un id d\'utilisateur');
}
$id = $_GET['id'];
$editable = ORM::for_table('users')->find_one($id);
require '../views/edit.php';
return;
}
$user = getUser();
require '../views/show.php';
}
示例2: start
function start()
{
if (!empty($_POST)) {
if (!isset($_POST['id'])) {
addUser($_POST);
$fla = flash("Ajout reussie");
} else {
editUser($_POST);
$fla = flash("Edition reussie");
}
$people = getPeople();
require '../views/list.php';
return;
}
if (!isset($_GET['id']) && !isset($_GET['page'])) {
$people = getPeople();
return require '../views/list.php';
}
if (isset($_GET['page']) && $_GET['page'] === 'add') {
return require '../views/add.php';
}
if (isset($_GET['page']) && $_GET['page'] === 'list') {
$people = getPeople();
return require '../views/list.php';
}
if (isset($_GET['page']) && $_GET['page'] === 'edit') {
if (!isset($_GET['id'])) {
die('Nope, ou est ID ?');
}
$id = $_GET['id'];
$editable = ORM::for_table('users')->find_one($id);
return require '../views/edit.php';
}
if (isset($_GET['id'])) {
$user = getUser();
$message = getMessages($_GET['id']);
require '../views/show.php';
}
}
示例3: start
function start()
{
if (!empty($_POST)) {
if (isset($_POST['_method']) && $_POST['_method'] === 'delete') {
removeUser($_POST['id']);
$flashMessage = flash('L\'utilisateur a bien été supprimé');
} elseif (isset($_POST['content'])) {
createMessage($_POST);
$flashMessage = flash('Le message a bien été ajouté !');
return go2page('user', $_POST['user_id']);
} elseif (!isset($_POST['id'])) {
createUser($_POST);
$flashMessage = flash('L\'utilisateur a été créé avec succès');
} else {
editUser($_POST);
$flashMessage = flash('L\'utilisateur a bien été modifié !');
}
return go2page('list');
}
if (!isset($_GET['id']) && !isset($_GET['page'])) {
return go2page('list');
}
if (isset($_GET['page']) && $_GET['page'] === 'add') {
require '../views/add.php';
return;
}
if (isset($_GET['page']) && $_GET['page'] === 'edit') {
if (!isset($_GET['id'])) {
die('veuillez spécifier un id d\'utilisateur');
}
$id = $_GET['id'];
$editable = ORM::for_table('users')->find_one($id);
require '../views/edit.php';
return;
}
$id = $_GET['id'];
return go2page('user', $id);
}
示例4: elseif
} elseif (isset($_POST['u_id']) && $_POST['u_id'] != -1) {
$query = "SELECT * from users where user_id=" . $_POST['u_id'];
$result = $db->query($query);
if ($myrow = $result->fetch_assoc()) {
$activeStat = $myrow['isActive'] == "Y";
$sql2 = "Select first_name, last_name from users where user_id=" . $myrow['created_by'];
$result2 = $db->query($sql2);
$row2 = $result2->fetch_assoc();
$t = "Modify User Information";
$action = "index.php?lev=" . $_SESSION[$_CONF['sess_name'] . '_lev'] . "&cat=" . $_SESSION[$_CONF['sess_name'] . '_cat'];
$isAdmin = $_SESSION[$_CONF['sess_name'] . '_isAdmin'] == 'Y';
// && $_GET['lev'] == 'admin');
$user = $row2;
$result = get_user_info($_SESSION[$_CONF['sess_name'] . '_myUID']);
$editor = $result->fetch_assoc();
$b = "\n <center>" . editUser($action, $myrow, $isAdmin, $editor, $usr_lev) . "\n </center>\n ";
}
$main .= make_box($t, $b);
/**
Modify User
**/
$t = "Modify User Roles";
$b = "<center>";
$sql = "SELECT user2center.center_id,isStudent,isParent,isTeacher,isGuidance,isOffice,isAdmin,isActive, center_name\n\t\t\tFROM user2center, ed_centers \n\t\t\tWHERE user2center.user_id=" . $_POST['u_id'] . "\n\t\t\tAND ed_centers.center_id=user2center.center_id";
$result = $db->query($sql);
while ($row = $result->fetch_assoc()) {
$c_id = $row['center_id'];
$editStudent = $row['isStudent'] == "Y";
$editParent = $row['isParent'] == "Y";
$editTeacher = $row['isTeacher'] == "Y";
$editGuidance = $row['isGuidance'] == "Y";
示例5: switch
<body>
<div class="container">
<div class="jumbotron">
</div>
<div class="tables">
<?php
if (isset($_GET["action"])) {
switch ($_GET["action"]) {
case "createUser":
editUser($mysqli, 0);
break;
case "editUser":
editUser($mysqli, $_GET["id"]);
break;
case "updateUser":
updateUser($mysqli);
break;
case "insertUser":
insertUser($mysqli);
break;
case "deleteUser":
deleteUser($mysqli);
break;
case "unsetUsername":
unset($_SESSION['username']);
unset($_SESSION['password']);
unset($_SESSION['admin']);
header("location: index.php");
示例6: search
search($connection, "SELECT * FROM users WHERE mail LIKE '%{$textInput}%'", "users");
break;
case 14:
changePassword($connection, $textInput, $password);
break;
case 15:
setActive($connection, $textInput);
break;
case 16:
upgradeAccount($connection, $textInput);
break;
case 17:
addUser($connection, $firstname, $sirname, $username, $sex, $password, $tel, $mail, $geb, $plz, $country, $city, $street, $housenr, $picture, $isActivated, $isRetailer, $maximum);
break;
case 18:
editUser($connection, $username, $mail);
break;
case 19:
contactUser($connection, $firstname, $mail);
break;
case 20:
delete($connection, "DELETE FROM notice WHERE ID='{$textInput}'", "notice", "ID", $textInput);
break;
case 21:
search($connection, "SELECT * FROM notice WHERE title LIKE '%{$textInput}%' OR category LIKE '%{$textInput}%' OR UserID LIKE '%{$textInput}%'", "notice");
break;
case 22:
search($connection, "SELECT * FROM notice WHERE title LIKE '%{$textInput}%'", "notice");
break;
case 23:
search($connection, "SELECT * FROM notice WHERE category LIKE '%{$textInput}%' OR UserID LIKE '%{$textInput}%'", "notice");
示例7: DB_query
$tpl->assign('bank_number', $_POST['bank_number']);
$tpl->assign('bank_iban', $_POST['bank_iban']);
$tpl->assign('bank_name', $_POST['bank_name']);
$tpl->assign('bank_account', $_POST['bank_account']);
//Alle Rollen
$roles_query = DB_query("SELECT\n\t\t\t\t\t\t\trole_id,\n\t\t\t\t\t\t\tname\n\t\t\t\t\t\t\tFROM roles");
$roles = array();
while ($role = DB_fetchArray($roles_query)) {
$roles[] = array("id" => $role['role_id'], "name" => $role['name']);
}
$tpl->assign('roleslist', $roles);
$tpl->display();
}
} elseif ($_POST['action'] == 'edit') {
$LOG->write('3', 'admin/editUser.php: action=edit');
editUser();
$LOG->write('2', 'Nutzer ' . $_GET['catID'] . ' bearbeitet');
redirectURI('/admin/users.php');
} elseif ($_POST['action'] == 'editSelf') {
$LOG->write('3', 'admin/editUser.php: action=editSelf');
if ($_POST['password'] == $_POST['repeatPassword']) {
editSelfUser();
$LOG->write('2', 'Nutzer ' . $_GET['catID'] . ' bearbeitet');
redirectURI('/admin/index.php');
} else {
// falsche Passwortwiederholung
$passwordError = "1";
$tpl->assign('action', 'editSelf');
$tpl->assign('uID', $user->getID());
$tpl->assign('user_name', $user->getName());
$tpl->assign('user_lastname', $user->getLastname());
示例8: switch
$data = $_REQUEST;
//do relevant stuff with path[1]
switch ($path[0]) {
case "users":
switch ($method) {
case "GET":
$data["username"] = $path[1];
$results = getUser($data);
break;
case "PUT":
$data["username"] = $path[1];
$results = addUser($data);
break;
case "PATCH":
$data["username"] = $path[1];
$results = editUser($data);
break;
default:
$results["meta"] = methodNotAllowed($method, $path);
}
break;
case "goals":
switch ($method) {
case "GET":
$results = getGoals($data);
break;
case "POST":
$results = addGoal($data);
break;
case "PATCH":
$data["goalID"] = $path[1];
示例9: unset
// ============================================================================
// POST Method
// ============================================================================
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// Prevent editors to administrate other users.
if ($Login->role() !== 'admin') {
$_POST['username'] = $Login->username();
unset($_POST['role']);
}
if (isset($_POST['delete-user-all'])) {
deleteUser($_POST, true);
} elseif (isset($_POST['delete-user-associate'])) {
deleteUser($_POST, false);
} elseif (!empty($_POST['new-password']) && !empty($_POST['confirm-password'])) {
setPassword($_POST['username'], $_POST['new-password'], $_POST['confirm-password']);
} else {
editUser($_POST);
}
}
// ============================================================================
// Main after POST
// ============================================================================
if ($Login->role() !== 'admin') {
$layout['parameters'] = $Login->username();
}
$_user = $dbUsers->getDb($layout['parameters']);
// If the user doesn't exist, redirect to the users list.
if ($_user === false) {
Redirect::page('admin', 'users');
}
$_user['username'] = $layout['parameters'];
示例10: array
} else {
$app->halt(200);
}
}
if ($result === false) {
$app->flash('error', $statement->errorInfo()[2]);
$app->redirect($app->urlFor('userAdd'));
} else {
$app->redirect($app->urlFor('userList', array('active' => 'active')));
}
})->name('userAdd');
$app->get('/admin/users/edit/:user', function ($userID) use($app, $roles) {
$app->render('html/editUser.html', array('user' => getUserDetails($app->db, $userID), 'departments' => getDepartments($app->db), 'roles' => $roles));
})->name('editUser');
$app->post('/admin/users/edit/:user', function ($userID) use($app) {
$result = editUser($app->db, $userID, $app->request->post('user'), $app->request->post('email'), $app->request->post('department'), $app->request->post('role'), $app->request->post('archiveEnabled'), $app->request->post('archiveDate'), $app->request->post('archiveReason'));
if (!empty($result)) {
$app->flash('error', $result);
$app->redirect($app->urlFor('editUser', array('user' => $userID)));
} else {
$app->redirect($app->urlFor('userList', array('active' => 'active')));
}
});
$app->get('/admin/departments', function () use($app) {
$app->redirect($app->urlFor('departmentsList'));
});
$app->get('/admin/departments/list', function () use($app) {
$app->render('html/departments.html', array('departments' => getDepartments($app->db)));
})->name('departmentsList');
$app->get('/admin/departments/add', function () use($app) {
$app->render('html/adddepartment.html');
示例11: trim
}
require_once $mainframe->getPath('admin_html');
$task = trim(mosGetParam($_REQUEST, 'task', null));
$cid = mosGetParam($_REQUEST, 'cid', array(0));
if (!is_array($cid)) {
$cid = array(0);
}
switch ($task) {
case 'new':
editUser(0, $option);
break;
case 'edit':
editUser(intval($cid[0]), $option);
break;
case 'editA':
editUser($id, $option);
break;
case 'save':
case 'apply':
saveUser($option, $task);
break;
case 'remove':
removeUsers($cid, $option);
break;
case 'block':
changeUserBlock($cid, 1, $option);
break;
case 'unblock':
changeUserBlock($cid, 0, $option);
break;
case 'logout':
示例12: process_post
//.........这里部分代码省略.........
/*
* Add an event to the DB
*/
/*
* Add an event to the DB
*/
case "addevent":
addEventToDB();
break;
/*
* Request payout.
*/
/*
* Request payout.
*/
case "requestPayout":
requestPayout();
break;
/*
* Transfer Money
*/
/*
* Transfer Money
*/
case "transferMoney":
transferMoney();
break;
/*
* Do the payouts
*/
/*
* Do the payouts
*/
case "payout":
doPayout();
break;
/*
* Create a new can in the Database.
*/
/*
* Create a new can in the Database.
*/
case "addcan":
addCanToDatabase();
break;
/*
* Admin request to change a user.
*/
/*
* Admin request to change a user.
*/
case "edituser":
editUser();
break;
/*
* AddRun
* This adds a new run to the database.
*/
/*
* AddRun
* This adds a new run to the database.
*/
case "addrun":
addRun();
break;
/*
* Analog to AddRun, just for Hauls.
*/
/*
* Analog to AddRun, just for Hauls.
*/
case "addhaul":
addHaul();
break;
/*
* Create a new transaction.
*/
/*
* Create a new transaction.
*/
case "transaction":
createTransaction();
break;
/*
* Lotto stuff
*/
/*
* Lotto stuff
*/
case "editLottoTickets":
lotto_editCreditsInDB();
break;
case "createDrawing":
lotto_createDrawing();
break;
case "lottoBuyCredits":
lotto_buyTickets();
break;
}
}
示例13: switch
$action = $_POST['action'];
switch ($action) {
case 'getAllUsersDT':
echo getAllUsersDT();
break;
case 'deleteUser':
$id = $_POST['id'];
echo deleteUser($id);
break;
case 'editUser':
$id = $_POST['id'];
$name = $_POST['name'];
$login = $_POST['login'];
$pass = $_POST['pass'];
$valid = $_POST['valid'];
echo editUser($id, $name, $login, $pass, $valid);
break;
case 'createUser':
$name = $_POST['name'];
$login = $_POST['login'];
$pass = $_POST['pass'];
$valid = $_POST['valid'];
echo createUser($name, $login, $pass, $valid);
break;
}
}
function getAllUsersDT()
{
global $bdd, $_TABLES;
if (!is_null($bdd) && !is_null($_TABLES)) {
$content = '<thead>';
示例14: editUser
function editUser() {
empty($_POST['password_field']) ? $password = "" : $password = "password = '".md5($_POST['password_field'])."'," ;
$sql = "UPDATE ".TB_PREFIX."user
SET
email = :email,
$password
role_id = :role,
enabled = :enabled
WHERE
id = :id
";
return dbQuery($sql, ':email',$_POST['email'], ':role',$_POST['role'], ':enabled',$_POST['enabled'], ':id',$_POST['id']);
}
if( editUser() ) {
$saved = true;
}
}
$smarty -> assign('saved',$saved);
$smarty -> assign('pageActive', 'user');
$smarty -> assign('active_tab', '#people');
$smarty -> assign('errm',$errm[2])
?>
示例15: getUserById
$user = getUserById($_GET['id']);
// Si l'utilisateur n'existe pas, on repasse en mode ajout
if ($user === false) {
$editMode = false;
}
// On verifie si l'utilisateur essaie de s'auto-modifier ou si c'est un admin
if ($user['user_id'] != userID() && !userIsAdmin()) {
abort('Vous n\'avez pas le droit de modifier cet utilisateur');
}
}
// Gestion de l'envoi du formulaire
if (verifyKeysIn($_POST, 'submit')) {
// Si les champs du formulaire sont valides
if (verifyKeysIn($_POST, 'name', 'fname', 'mail', 'username', 'pwd', 'birth', 'desc')) {
if ($editMode) {
editUser($_GET['id'], $_POST['name'], $_POST['fname'], $_POST['mail'], $_POST['username'], $_POST['pwd'], $_POST['birth'], $_POST['desc']);
} else {
insertUser($_POST['name'], $_POST['fname'], $_POST['mail'], $_POST['username'], $_POST['pwd'], $_POST['birth'], $_POST['desc']);
}
// Retour à la liste des utilisateurs
redirect('list-users.php');
} else {
$errors[] = "Il manque des champs dans le formulaire";
}
}
function userValueOrEmpty($key)
{
global $user;
if ($user === false) {
return '';
}