本文整理汇总了PHP中Users::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Users::update方法的具体用法?PHP Users::update怎么用?PHP Users::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Users
的用法示例。
在下文中一共展示了Users::update方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
public function update()
{
include_once "models/Users.php";
$users = new Users();
$users->update();
//header("Location: ../profile?error=ok");
}
示例2: loginAction
function loginAction()
{
if ($this->_request->isPost('log-form')) {
Zend_Loader::loadClass('Zend_Filter_StripTags');
$filter = new Zend_Filter_StripTags();
$username = trim($filter->filter($this->_request->getPost('log-name')));
$password = trim($filter->filter($this->_request->getPost('log-pswd')));
$warnings = new Zend_Session_Namespace();
$warnings->username = $username;
$warnings->error = '';
$error_msg = '';
if ($username == '') {
$error_msg .= '<p>Enter your username.</p>';
} else {
if ($password == '') {
$error_msg .= '<p>Enter your password.</p>';
} else {
$data = new Users();
$query = 'login = "' . $username . '"';
$data_row = $data->fetchRow($query);
if (!count($data_row)) {
$error_msg .= '<p>There is no user with such username.</p>';
} else {
if ($data_row == '0') {
$error_msg .= '<p>Your account is not activated.</p>';
}
$check_pass = sha1($password . $data_row['salt']);
if ($check_pass != $data_row['password']) {
$error_msg .= '<p>Wrong password.</p>';
}
}
}
}
if ($error_msg != '') {
$warnings->error = $error_msg;
$warnings->status = '';
$this->_redirect('/');
return;
} else {
Zend_Loader::loadClass('Zend_Date');
$date = new Zend_Date();
$current_date = $date->toString('YYYY-MM-dd HH:mm:ss');
$where = 'login = "' . $username . '"';
$data = array('last_login' => $current_date);
$user_update = new Users();
$user_update->update($data, $where);
$warnings->error = '';
$warnings->username = '';
$warnings->email = '';
$warnings->real_name = '';
$warnings->status = ' hide';
$user_dates = new Zend_Session_Namespace();
$user_dates->username = $username;
$user_dates->status = '1';
$this->_redirect('/profile/');
return;
}
}
}
示例3: updateProcess
function updateProcess($id)
{
$send = Request::get('send');
$address = Request::get('address');
$address['firstname'] = $send['firstname'];
$address['lastname'] = $send['lastname'];
Users::update($id, $send);
Address::update($id, $address);
}
示例4: UpdateUser
function UpdateUser($data, $fields)
{
try {
$User = new Users();
$result = $User->update($fields);
return $result;
} catch (Exception $e) {
return array('Exception!! ' => $e->getMessage());
}
}
示例5: editAction
public function editAction(Users $user)
{
if ($this->request->isPost()) {
$data = $this->request->getPost();
if ($user->update($data)) {
$this->redirectByRoute(['for' => 'users.show', 'user' => $user->id]);
}
}
$this->view->form = $this->buildFormFromModel($user);
$this->view->user = $user;
}
示例6: loadApi
function loadApi($action)
{
switch ($action) {
case 'login':
if (isset($_COOKIE['userid'])) {
throw new Exception("You have been loggedin.");
}
$username = Request::get('username', '');
$password = Request::get('password', '');
try {
Users::makeLogin($username, $password);
return json_encode(array('error' => 'no', 'loggedin' => 'yes'));
} catch (Exception $e) {
throw new Exception($e->getMessage());
}
break;
case 'register':
try {
$id = Users::makeRegister();
return json_encode(array('error' => 'no', 'userid' => $id));
} catch (Exception $e) {
throw new Exception($e->getMessage());
}
break;
case 'verify_email':
$code = Request::get('verify_code', '');
if ($code == '') {
throw new Exception("Error Processing Request");
}
$loadData = Users::get(array('where' => "where verify_code='{$code}'"));
if (isset($loadData[0]['userid'])) {
Users::update($loadData[0]['userid'], array('verify_code' => ''));
Redirect::to(ROOT_URL);
// Users::sendNewPassword($loadData[0]['email']);
} else {
throw new Exception("Verify link not valid.");
}
break;
case 'verify_forgotpassword':
$code = Request::get('verify_code', '');
if ($code == '') {
throw new Exception("Error Processing Request");
}
$loadData = Users::get(array('where' => "where forgot_code='{$code}'"));
if (isset($loadData[0]['userid'])) {
Users::update($loadData[0]['userid'], array('forgot_code' => ''));
Users::sendNewPassword($loadData[0]['email']);
Redirect::to(ROOT_URL);
} else {
throw new Exception("Verify code not valid.");
}
break;
}
}
示例7: actionSetpwd
/**
* 设置密码
*/
public function actionSetpwd()
{
$Users = new Users();
$data = $this->Common->getFilter($_POST);
if (empty($data['pwd']) || empty($data['newpwd']) || empty($data['confirmpwd'])) {
$this->jumpBox('参数错误!', Wave::app()->homeUrl . 'member', 1);
}
if ($data['newpwd'] != $data['confirmpwd']) {
$this->jumpBox('两次密码不一样!', Wave::app()->homeUrl . 'member', 1);
}
$updateData = array('password' => md5($data['newpwd']));
$Users->update($updateData, array('userid' => $this->userinfo['userid']));
$this->jumpBox('修改成功!', Wave::app()->homeUrl . 'member', 1);
}
示例8: update
public static function update()
{
static::purifier();
if ($_POST['id'] != "" && $_POST['name'] != "" && $_POST['email'] != "" && $_POST['course'] != "" && $_POST['phone'] != "" && $_POST['semester'] != "" && $_POST['registry'] != "") {
$user = new Users($_POST);
try {
$user->update($_POST['id']);
$_SESSION['msg'] = 'success">Atualizado!';
array_key_exists('status', $_POST) && $_POST['status'] == '1' ? header('Location: ../views/candidates') : header('Location: ../views/subscribers');
} catch (pdoexception $e) {
$_SESSION['msg'] = 'fail">Erro.';
header('Location: ../views/edit-user');
}
}
}
示例9: edit
public function edit($id)
{
// find user
if (($user = Users::find(array('id' => $id))) === false) {
return Response::redirect($this->admin_url . '/users');
}
// process post request
if (Input::method() == 'POST') {
if (Users::update($id)) {
// redirect path
return Response::redirect($this->admin_url . '/users/edit/' . $id);
}
}
Template::render('users/edit', array('user' => $user));
}
示例10: recover
public function recover()
{
if (isset($_POST['email'])) {
$recover = new Users();
if ($recover->select(array('email' => $_POST['email']))) {
// Create a random password and update the table row
$recover->password = String::random();
$recover->update();
$msg = 'Your new password is: ' . $recover->password . '<br /><br />';
$msg .= 'Try logging in at <a href="' . WEB_ROOT . 'login/">' . WEB_ROOT . 'login/</a>';
Core_Helpers::send_html_mail($recover->email, 'Password Recovery', $msg, $data['config']->email_address);
Flash::set('<p class="flash success">Password has been reset and will be emailed to you shortly.</p>');
} else {
Flash::set('<p class="flash validation">Sorry, you have entered an email address that is not associated with any account.</p>');
}
}
$this->load_template('recover');
}
示例11: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Users('createSubAdmin');
if (isset($_POST['Users'])) {
$model->attributes = $_POST['Users'];
$model->status = $_POST['Users']['status'];
if ($model->validate()) {
$model->temp_password = $model->password_hash;
$model->created_date = date("Y-m-d H:i:s");
$model->application_id = BE;
//save user for back end
$model->save();
$model->password_hash = md5($model->password_hash);
$model->update();
$this->redirect(array('view', 'id' => $model->id));
}
}
$this->render('create', array('model' => $model, 'actions' => $this->listActionsCanAccess));
}
示例12: validateFolderPMDrive
/**
* Validate if exist folder PMDrive
*
* @param $userUid id user
*/
private function validateFolderPMDrive($usrUid)
{
if ($this->folderIdPMDrive != '') {
return;
}
$user = new Users();
$dataUser = $user->load($usrUid);
if (!empty($dataUser['USR_EMAIL'])) {
$this->setDriveUser($dataUser['USR_EMAIL']);
}
$this->folderIdPMDrive = empty($dataUser['USR_PMDRIVE_FOLDER_UID']) ? '' : $dataUser['USR_PMDRIVE_FOLDER_UID'];
$conf = $this->getConfigGmail();
$this->folderNamePMDrive = empty($conf->aConfig['folderNamePMDrive']) ? 'PMDrive (' . SYS_SYS . ')' : $conf->aConfig['folderNamePMDrive'];
if ($this->folderIdPMDrive == '') {
$folderid = $this->createFolder($this->folderNamePMDrive);
$this->folderIdPMDrive = $folderid->id;
$dataUser['USR_PMDRIVE_FOLDER_UID'] = $folderid->id;
$user->update($dataUser);
}
}
示例13: isValid
public function isValid($value, $context = null)
{
$value = (string) $value;
$this->_setValue($value);
if (is_array($context)) {
if (!isset($context['password'])) {
return false;
}
}
$dbAdapter = Zend_Registry::get('db');
$this->_authAdapter = new Zend_Auth_Adapter_DbTable($dbAdapter);
$this->_authAdapter->setTableName('users')->setIdentityColumn('username')->setCredentialColumn('password');
// get "salt" for better security
$salt = $this->_config->auth->salt;
$password = sha1($salt . $context['password']);
$this->_authAdapter->setIdentity($value);
$this->_authAdapter->setCredential($password);
$auth = Zend_Auth::getInstance();
$result = $auth->authenticate($this->_authAdapter);
if (!$result->isValid()) {
$this->_error(self::NOT_AUTHORISED);
return false;
}
//Updated the user table - this needs moving to the users model
$users = new Users();
$updateArray = array('visits' => new Zend_Db_Expr('visits + 1'), 'lastLogin' => Zend_Date::now()->toString('yyyy-MM-dd HH:mm'));
$where = array();
$where[] = $users->getAdapter()->quoteInto('username = ?', $value);
$users->update($updateArray, $where);
//Update login table needs moving to the login model
$logins = new Logins();
$data['loginDate'] = Zend_Date::now()->toString('yyyy-MM-dd HH:mm');
$data['userAgent'] = $_SERVER['HTTP_USER_AGENT'];
$data['ipAddress'] = $_SERVER['REMOTE_ADDR'];
$data['username'] = $value;
$insert = $logins->insert($data);
return true;
}
示例14: upgradeAction
/** Upgrade an account
* @access public
* @return void
*/
public function upgradeAction()
{
$allowed = array('public', 'member');
if (in_array($this->getRole(), $allowed)) {
$user = $this->getAccount();
$form = new AccountUpgradeForm();
$this->view->form = $form;
if ($this->getRequest()->isPost() && $form->isValid($this->_request->getPost())) {
if ($form->isValid($form->getValues())) {
$where = array();
$where[] = $this->_users->getAdapter()->quoteInto('id = ?', (int) $this->getAccount()->id);
$updateData = $form->getValues();
$updateData['higherLevel'] = 1;
$this->_users->update($updateData, $where);
$to = array(array('email' => $user->email, 'name' => $user->fullname));
$advisers = new Contacts();
$emails = $advisers->getAdvisersEmails();
$central = $advisers->getCentralEmails();
$emails = array_merge($to, $emails, $central);
$attachments = array(ROOT_PATH . '/public_html/documents/tac.pdf');
$assignData = array_merge($to[0], $form->getValues());
$toReferee = array(array('email' => $form->getValue('referenceEmail'), 'name' => $form->getValue('reference')));
//data, template, to, cc, from, bcc, attachments, subject
$this->sendAdvisers($assignData, $toReferee, $emails, $attachments);
$this->getFlash()->addMessage('Thank you! We have received your request.');
$this->redirect('/users/account/');
} else {
$form->populate($form->getValues());
$this->getFlash()->addMessage('There are a few problems with your registration<br>
Please review and correct them.');
}
}
} else {
$this->getFlash()->addMessage('You can\'t request an upgrade as you already have ' . $this->getRole() . ' status!');
$this->redirect('/users/account/');
}
}
示例15: actionModified
/**
* 提交信息
*/
public function actionModified()
{
$data = $this->Common->getFilter($_POST);
$userid = (int) $data['userid'];
unset($data['userid']);
$Users = new Users();
if ($userid == 0) {
unset($data['oldemail']);
$count = $Users->getCount('*', array('email' => $data['email']));
if ($count > 0) {
$this->jumpBox('邮箱不能重复!', Wave::app()->homeUrl . 'users', 1);
}
$data['password'] = md5($data['password']);
$data['add_date'] = date('Y-m-d H:i:s');
$userid = $Users->insert($data);
$data['userid'] = $userid;
$this->Log->saveLogs('添加用户', 1, $data);
} else {
if ($data['oldemail'] != $data['email']) {
$count = $Users->getCount('*', array('email' => $data['email']));
if ($count > 0) {
$this->jumpBox('邮箱不能重复!', Wave::app()->homeUrl . 'users', 1);
}
}
unset($data['oldemail']);
if (!empty($data['password'])) {
$data['password'] = md5($data['password']);
} else {
unset($data['password']);
}
$Users->update($data, array('userid' => $userid));
$data['userid'] = $userid;
$this->Log->saveLogs('更新用户', 1, $data);
}
$this->jumpBox('成功!', Wave::app()->homeUrl . 'users', 1);
}