当前位置: 首页>>代码示例>>PHP>>正文


PHP Users::updateUser方法代码示例

本文整理汇总了PHP中Users::updateUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Users::updateUser方法的具体用法?PHP Users::updateUser怎么用?PHP Users::updateUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Users的用法示例。


在下文中一共展示了Users::updateUser方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: perform

 /**
  * Carries out the specified action
  */
 function perform()
 {
     // update the user information
     $this->_userInfo->setEmail(Textfilter::filterAllHTML($this->_request->getValue("userEmail")));
     if ($this->_userPassword != "") {
         $this->_userInfo->setPassword($this->_userPassword);
     }
     $this->_userInfo->setAboutMyself(Textfilter::filterAllHTML($this->_request->getValue("userAbout")));
     $this->_userInfo->setFullName(Textfilter::filterAllHTML($this->_request->getValue("userFullName")));
     $this->_userInfo->setPictureId($this->_request->getValue("userPictureId"));
     $this->_userInfo->setProperties($this->_request->getValue("properties"));
     $this->notifyEvent(EVENT_PRE_USER_UPDATE, array("user" => &$this->_userInfo));
     $this->_session->setValue("userInfo", $this->_userInfo);
     $this->saveSession();
     // update the user information
     $this->_view = new AdminUserProfileView($this->_blogInfo, $this->_userInfo);
     $users = new Users();
     if (!$users->updateUser($this->_userInfo)) {
         $this->_view->setErrorMessage($this->_locale->tr("error_updating_user_settings"));
     } else {
         $this->_view->setSuccessMessage($this->_locale->pr("user_settings_updated_ok", $this->_userInfo->getUsername()));
         // if everything fine, also say so...
         $this->notifyEvent(EVENT_POST_USER_UPDATE, array("user" => &$this->_userInfo));
     }
     $this->setCommonData();
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:plogfr-svn,代码行数:30,代码来源:adminupdateusersettingsaction.class.php

示例2: perform

 function perform()
 {
     $this->_userNameHash = $this->_request->getValue("b");
     $this->_requestHash = $this->_request->getValue("a");
     $this->_newPassword = $this->_request->getValue("newPassword");
     $this->_retypeNewPassword = $this->_request->getValue("retypePassword");
     $this->_userId = $this->_request->getValue("userId");
     // check if the passwords are correct and are the same
     if ($this->_newPassword != $this->_retypeNewPassword) {
         $this->_view = new SummaryView("changepassword");
         $this->_view->setErrorMessage($this->_locale->tr("error_passwords_do_not_match"));
         $this->setCommonData(true);
         return false;
     }
     $userInfo = SummaryTools::verifyRequest($this->_userNameHash, $this->_requestHash);
     if (!$userInfo) {
         $this->_view = new SummaryView("summaryerror");
         $this->_view->setErrorMessage($this->_locale->tr("error_incorrect_request"));
         $this->setCommonData(true);
         return false;
     }
     // so if everything went fine, we can *FINALLY* change the password!
     $users = new Users();
     $userInfo->setPassword($this->_newPassword);
     $users->updateUser($userInfo);
     $this->_view = new SummaryView("message");
     $this->_view->setSuccessMessage($this->_locale->tr("password_updated_ok"));
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:plogfr-svn,代码行数:29,代码来源:summaryupdatepassword.class.php

示例3: perform

 function perform()
 {
     $this->username = $this->_request->getValue("username");
     $this->activeCode = $this->_request->getValue("activeCode");
     $users = new Users();
     $userInfo = $users->getUserInfoFromUsername($this->username);
     if (!$userInfo) {
         $this->_view = new SummaryView("summaryerror");
         $this->_view->setErrorMessage($this->_locale->tr("error_invalid_user"));
         return false;
     }
     $activeCode = $userInfo->getValue("activeCode");
     if ($activeCode != $this->activeCode) {
         $this->_view = new SummaryView("summaryerror", $this->_locale->tr("error_invalid_activation_code"));
         return false;
     }
     // active user
     $userInfo->setStatus(USER_STATUS_ACTIVE);
     $users->updateUser($userInfo);
     // also active the blog that user owned
     // FIXME: how about other blogs that this user take part in?
     $blogId = $users->getUserBlogId($this->username);
     $blogs = new Blogs();
     $blog = $blogs->getBlogInfo($blogId);
     $blog->setStatus(BLOG_STATUS_ACTIVE);
     $blogs->updateBlog($blogId, $blog);
     $blogUrl = $blog->getBlogRequestGenerator();
     // create the message that we're going to show
     $message = "<p>" . $this->_locale->tr("blog_activated_ok") . "</p><p>" . $this->_locale->pr("register_blog_link", $blog->getBlog(), $blogUrl->blogLink()) . "</p><p>" . $this->_locale->tr("register_blog_admin_link") . "</p>";
     $this->_view = new SummaryMessageView($message);
     $this->setCommonData();
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:plogfr-svn,代码行数:33,代码来源:activeaccountaction.class.php

示例4: adminAction

 /**
  * The default action - show the registration form
  */
 public function adminAction()
 {
     $this->authenticate();
     // check if admin
     $identity = Zend_Auth::getInstance()->getIdentity();
     if ($identity['role'] != 'admin') {
         $this->_helper->getHelper('Redirector')->goto('view', 'portal');
     }
     if ($this->getRequest()->isPost()) {
         // submitting form
         $data = $this->_request->getParams();
         // update the user
         try {
             $this->users->updateUser($data);
         } catch (Exception $e) {
             $this->view->message = $e->getMessage();
         }
     }
     // show form
     $this->view->roles = UserRow::getRoles();
 }
开发者ID:BGCX261,项目名称:zportal-svn-to-git,代码行数:24,代码来源:UserController.php

示例5: register

 /**
  *
  * function: register
  * Register a new user
  * @access public
  * @param string $username
  * @param string $password
  * @param boolean $sticky (optional)
  * @return [boolean,User]
  */
 public function register($username, $password, $info = false)
 {
     $sql = 'INSERT INTO ' . $this->table . ' (username,password) VALUES (?,?);';
     $userId = $this->insert($sql, array($username, $this->bcrypt->hash(md5($password))));
     if (empty($userId)) {
         return false;
     } else {
         if (!empty($info)) {
             Users::updateUser($info, $userId);
         }
         Session::setUser($userId);
         if (!empty($sticky)) {
             Cookie::setCookie('user', $userId);
         }
         return $userId;
     }
 }
开发者ID:healeyb,项目名称:Helium,代码行数:27,代码来源:Users.php

示例6: perform

 function perform()
 {
     // get the data
     $this->_userId = $this->_request->getValue("userId");
     $this->_userPassword = trim(Textfilter::filterAllHTML($this->_request->getValue("userProfilePassword")));
     $this->_userEmail = Textfilter::filterAllHTML($this->_request->getValue("userEmail"));
     $this->_userAbout = Textfilter::filterAllHTML($this->_request->getValue("userAbout"));
     $this->_userFullName = Textfilter::filterAllHTML($this->_request->getValue("userFullName"));
     $this->_adminPrivs = $this->_request->getValue("userIsSiteAdmin");
     $this->_userProperties = $this->_request->getValue("properties");
     $this->_userStatus = $this->_request->getValue("userStatus");
     // load the user settings
     $users = new Users();
     $user = $users->getUserInfoFromId($this->_userId);
     // if no info could be fetched, shown an error and quit
     if (!$user) {
         $this->_view = new AdminSiteUsersListView($this->_blogInfo);
         $this->_view->setErrorMessage($this->_locale->tr("error_invalid_user"));
         $this->setCommonData();
         return false;
     }
     // update the user settings
     $user->setEmail($this->_userEmail);
     $user->setAboutMyself($this->_userAbout);
     $user->setSiteAdmin($this->_adminPrivs);
     $user->setFullName($this->_userFullName);
     $user->setProperties($this->_userProperties);
     $user->setStatus($this->_userStatus);
     if ($this->_userPassword != "") {
         $user->setPassword($this->_userPassword);
     }
     $this->notifyEvent(EVENT_PRE_USER_UPDATE, array("user" => &$user));
     // and now update them
     if (!$users->updateUser($user)) {
         $this->_view = new AdminSiteUsersListView($this->_blogInfo);
         $this->_view->setErrorMessage($this->_locale->tr("error_updating_user"));
         $this->setCommonData();
         return false;
     }
     // the post-update event... if needed
     $this->notifyEvent(EVENT_POST_USER_UPDATE, array("user" => &$user));
     $this->_view = new AdminSiteUsersListView($this->_blogInfo);
     $this->_view->setSuccessMessage($this->_locale->pr("user_updated_ok", $user->getUsername()));
     $this->setCommonData();
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:plogfr-svn,代码行数:46,代码来源:adminupdateuserprofileaction.class.php

示例7: editAction

 /**
  * Edit a users
  */
 public function editAction()
 {
     $usersModel = new Users();
     $form = $this->_getForm(false);
     $user = $usersModel->getUser($this->_getParam('userId'));
     $form->setDefaults($user);
     if ($this->getRequest()->isPost() && $form->isValid($_POST)) {
         $data = $form->getValues();
         if ($usersModel->isUserNameInUse($data['user_name'], $user['user_id'])) {
             $form->getElement('user_name')->addValidator('customMessages', false, array('Username is already in use'));
         }
         if ($usersModel->isEmailInUse($data['user_email'], $user['user_id'])) {
             $form->getElement('user_email')->addValidator('customMessages', false, array('E-Mail is already in use'));
         }
         if ($form->isValid($_POST)) {
             $password = !empty($data['user_password']) ? $data['user_password'] : null;
             $usersModel->updateUser($user['user_id'], $data['user_name'], $data['user_email'], $data['user_role'], $password);
             $this->_helper->getHelper('Redirector')->gotoRouteAndExit(array(), 'users-index');
         }
     }
     $this->view->form = $form;
     $this->view->users = $usersModel->getUsers();
 }
开发者ID:Tony133,项目名称:zf-web,代码行数:26,代码来源:GrfsController.php

示例8: catch

    } catch (Exception $e) {
        echo $e->getMessage();
    }
    if ($success) {
        if (isset($_SESSION['upload'])) {
            $_SESSION['upload'] = array_merge($_SESSION['upload'], $loader->getNameList());
        } else {
            $_SESSION['upload'] = $loader->getNameList();
        }
        header("Location: review.php");
        die;
    }
}
if (isset($validUpdate)) {
    $dbUsers = new Users($conn);
    $dbUsers->updateUser($_SESSION['userID'], $_SESSION['first_name'], $_SESSION['last_name'], $email, $username, $password);
    $_SESSION['username'] = $username;
    $_SESSION['user_email'] = $email;
}
//Gets all images user can delete.
//Replace with database
$dbImages = new Images($conn);
$filenames = $dbImages->imageList($_SESSION['userID']);
if (isset($_POST['delete'])) {
    //delete Code (rember to check if user has permission to delete image)
}
include './includes/title.php';
?>
<!DOCTYPE html>
<?php 
require "./includes/head.php";
开发者ID:GudniNatan,项目名称:Myndavefur-VEF2A3U,代码行数:31,代码来源:userpage.php

示例9: Views

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);
}
开发者ID:richardHutchinson,项目名称:ssl,代码行数:30,代码来源:user.php

示例10: Users

<?php

include_once 'users.php';
$edit = new Users();
if (!empty($_POST)) {
    $edit_name = $_POST['edit_name'];
    $edit_address = $_POST['edit_address'];
    if ($edit->updateUser($_GET['id'], $edit_name, $edit_address)) {
        header("Location: manage_veiw.php");
    } else {
        echo 'Error';
    }
}
?>
<html>
<head>
    <meta charset="utf-8">
</head>
<body>
<form method="post" action="edit_user.php?<?php 
echo $_SERVER['QUERY_STRING'];
?>
">

    <h2>Edit user</h2>
    <?php 
foreach ($edit->getUser($_GET['id']) as $value) {
    echo "<input type=\"text\" name=\"edit_name\" value='{$value['1']}'><br >";
    echo "<input type=\"text\" name=\"edit_address\" value='{$value['2']}'><br >";
}
?>
开发者ID:GutenevB,项目名称:lesson,代码行数:31,代码来源:edit_user.php

示例11: trim

<?php

session_start();
?>
<!doctype html>
<?php 
if (isset($_POST['update'])) {
    $firstname = trim($_POST['firstname']);
    $lastname = trim($_POST['lastname']);
    $email = trim($_POST['email']);
    $password = trim($_POST['password']);
    require_once 'connection.php';
    require_once 'Users.php';
    $dbUsers = new Users($conn);
    print_r($_POST);
    $status = $dbUsers->updateUser($_SESSION['ID'], $firstname, $lastname, $email, $_SESSION['registername'], $password);
    if ($status) {
        $success = "Your account has been updated";
    } else {
        $errors[] = "Update failure";
    }
}
?>
<html class="no-js" lang="en">
<head>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <title>Picture Libary</title>
    <link rel="stylesheet" href="http://dhbhdrzi4tiry.cloudfront.net/cdn/sites/foundation.min.css">
    <link rel="stylesheet" href="styles.css">
    <?php 
开发者ID:Remekgc,项目名称:Vef,代码行数:31,代码来源:PictureLibary.php

示例12: updateUser

 /**
  * funkce updatne uzivatele
  * @param int $user_id
  * @param object $data
  * @param bool $verification optional
  * @return array
  */
 public static function updateUser($user_id, $data, $verification = false)
 {
     try {
         return Users::updateUser($user_id, $data, $verification = false);
     } catch (Exception $e) {
         throw new RPCFault($e->getMessage(), $e->getCode(), $e->getCode());
     }
 }
开发者ID:kourim,项目名称:limedca,代码行数:15,代码来源:Application.php

示例13: sendConfirmEmail

 /**
  * send confirm email to user.
  * user will active his/her account according to this email
  */
 function sendConfirmEmail()
 {
     $activeCode = $this->generateActiveCode();
     // store the active code to the backend db in the properties field of user table
     $users = new Users();
     $userInfo = $users->getUserInfoFromUsername($this->userName);
     $userInfo->setProperties(array("activeCode" => $activeCode));
     $users->updateUser($userInfo);
     $message = new ConfirmEmailMessage();
     $message->setFrom($this->_config->getValue("post_notification_source_address"));
     $message->addTo($this->userEmail);
     $message->setSubject("pLog user registration confirmation for: " . $this->userName);
     $message->setUsername($this->userName);
     $message->setActiveCode($activeCode);
     // create active Link
     $base_url = $this->_config->getValue("base_url");
     $message->setActiveLink($base_url . "/summary.php?op=activeAccount&username=" . $this->userName . "&activeCode=" . $activeCode);
     $message->createBody();
     $service = new EmailService();
     $service->sendMessage($message);
 }
开发者ID:BackupTheBerlios,项目名称:plogfr-svn,代码行数:25,代码来源:dofinishregister.class.php

示例14: header

            $is_admin = 1;
        } else {
            $is_admin = 0;
        }
        $user->saveData($_POST['reg_login'], $_POST['email_addr'], $_POST['reg_password'], $is_admin, $_POST['name'], $_POST['surname'], $_POST['address'], $_POST['mob_phone']);
        header("Location: " . PATHSITE . "/admin-users");
        break;
    case "register":
        $user = new Users();
        $user->saveData($_POST['reg_login'], $_POST['email_addr'], $_POST['reg_password'], 0, $_POST['name'], $_POST['surname'], $_POST['address'], $_POST['mob_phone']);
        header("Location: " . PATHSITE);
        break;
    case "remove":
        $good = new Users();
        $good->deleteData("users", $_POST['id_user']);
        header("Location: " . PATHSITE . "/admin-users");
        break;
    case "update":
        if ($_POST['reg_password'] == "") {
            //если пароль пуст, то не меняем его
            $pass = $_POST['md5_old_password'];
        } else {
            $pass = md5($_POST['reg_password']);
        }
        $user = new Users();
        $user->updateUser($_POST['id_user'], $_POST['reg_login'], $_POST['email_addr'], $pass, $_POST['is_admin'], $_POST['name'], $_POST['surname'], $_POST['address'], $_POST['mob_phone']);
        header("Location: " . $_SERVER['HTTP_REFERER']);
        break;
    default:
        break;
}
开发者ID:alex-zayats,项目名称:php_shop,代码行数:31,代码来源:users.php


注:本文中的Users::updateUser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。