• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Users类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getIndex

 public function getIndex()
 {
     $campaign = new Campaign();
     $image = $campaign->getCampaignImage();
     $users = new Users();
     $member = $users->getRecentUsers();
     $this->layout->foot = View::make("landing.foot")->with(array('data' => $image, 'data2' => $member));
     $this->layout->title = "Welcome to Sagip.ph";
     if (Session::has('userid')) {
         $username = Session::get('username');
         $logstatus = true;
         $userid = Session::get('userid');
         $profile = new Profile();
         $pic = "#";
         $result = $profile->getProfile($userid);
         if ($result) {
             $pic = $result->profilepic;
         }
         $data = array('username' => $username, 'logstatus' => $logstatus, 'profilepic' => $pic);
         $campaign = new Campaign();
         $data2 = $campaign->getCampaignHome();
         $this->layout->head = View::make("landing.head")->with($data);
         $this->layout->body = View::make("landing.bodycontributordash")->with($data);
     } else {
         $logstatus = false;
         $data = array('logstatus' => $logstatus);
         $campaign = new Campaign();
         $data2 = $campaign->getCampaignHome();
         $this->layout->head = View::make("landing.head")->with($data);
         $this->layout->body = View::make("landing.bodycontributordash")->with($data);
     }
 }
开发者ID:centaurustech,项目名称:sagip,代码行数:32,代码来源:ContributorController.php


示例2: upAction

 /**
  * Registration
  */
 public function upAction()
 {
     if ($this->request->isPost()) {
         $user = new Users();
         $user->login = $this->request->getPost('login', 'string');
         $user->password = $this->request->getPost('password', 'string');
         $passwordVerify = $this->request->getPost('password-verify', 'string');
         if (md5($user->password) !== md5($passwordVerify)) {
             $this->flashSession->error('Пароли не совпадают');
             return;
         }
         if (!$user->create()) {
             $this->flashSession->error(implode("<br/>", $user->getMessages()));
             return;
         }
         $auth = new Auth();
         $authSucceed = $auth->authorize($user);
         if ($authSucceed) {
             $this->response->redirect();
             return;
         }
         $this->dispatcher->forward(['controller' => 'sign', 'action' => 'in']);
         return;
     }
 }
开发者ID:vlad6085,项目名称:projectstorage,代码行数:28,代码来源:SignController.php


示例3: create_user

 public function create_user()
 {
     // If there are no users then let's create one.
     $db = Database::get_instance();
     $db->query('SELECT * FROM `users` LIMIT 1');
     if ($db->has_rows() && !Auth::get_instance()->logged_in()) {
         Flash::set('<p class="flash validation">Sorry but to create new users, you must be logged in.</p>');
         Core_Helpers::redirect(WEB_ROOT . 'login/');
     }
     $validator = Error::instance();
     if (isset($_POST['email'])) {
         $validator->email($_POST['email'], 'email');
         $validator->blank($_POST['username'], 'username');
         $validator->blank($_POST['password'], 'password');
         $validator->passwords($_POST['password'], $_POST['confirm_password'], 'confirm_password');
         $user = new Users();
         if ($user->select(array('username' => $_POST['username']))) {
             $validator->add('username', 'The username <strong>' . htmlspecialchars($_POST['username']) . '</strong> is already taken.');
         }
         if ($validator->ok()) {
             $user = new Users();
             $user->load($_POST);
             $user->level = 'admin';
             $user->insert();
             Flash::set('<p class="flash success">User created successfully.</p>');
             Core_Helpers::redirect(WEB_ROOT . 'login/');
         }
     }
     $this->data['error'] = $validator;
     $this->load_template('create_user');
 }
开发者ID:robv,项目名称:konnect,代码行数:31,代码来源:controller.main.php


示例4: __construct

 public function __construct()
 {
     $this->_siteID=$_SESSION["CATS"]->getSiteID();
     $users = new Users($this->_siteID);
     $this->usersRS = $users->getSelectList();
     $this->groupRS = $users->getSelectGroupList();
 }
开发者ID:Hassanj343,项目名称:candidats,代码行数:7,代码来源:ClsAuieoView.php


示例5: pdoEditModelAction

 public function pdoEditModelAction($id)
 {
     $this->_view->title = 'Model Edit Form';
     $this->_view->link = base_url() . 'pdo-database/pdo-model/pdo-edit-model/' . $id;
     $users = new Users();
     $row = $users->get($id);
     if (empty($row)) {
         redirect('pdo-database/pdo-model/pdo-model');
     }
     $this->_view->data = $row;
     if (!empty($_POST)) {
         $val = new Validation();
         $val->source = $_POST;
         $val->addValidator(array('name' => 'first_name', 'type' => 'string', 'required' => true));
         $val->addValidator(array('name' => 'last_name', 'type' => 'string', 'required' => true));
         $val->addValidator(array('name' => 'email', 'type' => 'email', 'required' => true));
         $val->addValidator(array('name' => 'address', 'type' => 'string', 'required' => true));
         $val->run();
         if (sizeof($val->errors) == 0) {
             $data = array('first_name' => $_POST['first_name'], 'last_name' => $_POST['last_name'], 'email' => $_POST['email'], 'address' => $_POST['address']);
             $users->update($id, $data);
             redirect('pdo-database/pdo-model/pdo-model');
         }
         $this->_view->errorMessage = $val->errorMessage();
         $this->_view->data = $_POST;
     }
     $this->renderView('pdo-database/pdo-model/_form');
 }
开发者ID:ngukho,项目名称:mvc-cms,代码行数:28,代码来源:PdoModelController.php


示例6: indexAction

 public function indexAction()
 {
     if ($this->request->isPost()) {
         $register = new Users();
         $register->id = UUID::v4();
         $register->password = $this->security->hash($this->request->getPost('password'));
         $register->phonenumber = $this->request->getPost('phonenumber');
         $register->email = $this->request->getPost('email');
         $register->name = $this->request->getPost('name');
         $register->created_date = Carbon::now()->now()->toDateTimeString();
         $register->updated_date = Carbon::now()->now()->toDateTimeString();
         $user = Users::findFirstByEmail($register->email);
         if ($user) {
             $this->flash->error("can not register, User " . $register->email . " Alredy Registerd! ");
             return true;
         }
         if ($register->save() === true) {
             $this->session->set('user_name', $register->name);
             $this->session->set('user_email', $register->email);
             $this->session->set('user_id', $register->id);
             $this->flash->success("Your " . $register->email . " has been registered Please Login for booking court");
             $this->response->redirect('dashboard');
         }
     }
 }
开发者ID:limferdi,项目名称:soccerStadiumReservation,代码行数:25,代码来源:RegisterController.php


示例7: forgotpassAction

 public function forgotpassAction()
 {
     $oForm = new Form_ForgotPass('/login/forgotpass/');
     $bSubmitted = false;
     if ($this->_request->isPost()) {
         if ($oForm->isValid($this->_request->getPost())) {
             $oUser = new Users();
             $oPersonalData = $oUser->getPersonalDataFromEmail($this->_request->getPost('email_add'));
             $oAccountData = $oUser->getAccountDataFromUserId($oPersonalData->id);
             //generate random password
             $sNewPassword = substr(md5(rand()), 0, 7);
             $oUser->updatePasswordData($oAccountData->id, $sNewPassword);
             //send email for reset
             $oEmail = new Emails();
             $oEmail->mailReset($oPersonalData['email_add'], $oAccountData['username'], $sNewPassword);
             $bSubmitted = true;
         } else {
             $auth = Zend_Auth::getInstance();
             $auth->clearIdentity();
             $oForm->populate($this->_request->getPost());
         }
     }
     if (!$bSubmitted) {
         $this->view->form = $oForm;
     } else {
         $this->view->form = "<h1>You have successfully resetted your password. Please check your email.</h1>";
     }
 }
开发者ID:joshauza,项目名称:baseapp,代码行数:28,代码来源:LoginController.php


示例8: indexAction

 /**
  * Action to register a new user
  */
 public function indexAction()
 {
     $form = new RegisterForm();
     if ($this->request->isPost()) {
         $name = $this->request->getPost('name', array('string', 'striptags'));
         $username = $this->request->getPost('username', 'alphanum');
         $email = $this->request->getPost('email', 'email');
         $password = $this->request->getPost('password');
         $repeatPassword = $this->request->getPost('repeatPassword');
         if ($password != $repeatPassword) {
             $this->flash->error('Passwords are diferent');
             return false;
         }
         $user = new Users();
         $user->username = $username;
         $user->password = sha1($password);
         $user->name = $name;
         $user->email = $email;
         $user->created_at = new Phalcon\Db\RawValue('now()');
         $user->active = 'Y';
         if ($user->save() == false) {
             foreach ($user->getMessages() as $message) {
                 $this->flash->error((string) $message);
             }
         } else {
             $this->tag->setDefault('email', '');
             $this->tag->setDefault('password', '');
             $this->flash->success('Thanks for sign-up, please log-in to start generating invoices');
             return $this->forward('session/index');
         }
     }
     $this->view->form = $form;
 }
开发者ID:Kefir92,项目名称:home-bookkeeping,代码行数:36,代码来源:RegisterController.php


示例9: removeFavoriteBy

 public function removeFavoriteBy(Users $user)
 {
     if ($user->hasFavoredThis($this)) {
         Favorites::query()->where('user_id = :user:', ['user' => $user->id])->andWhere('favoritable_type = :type:', ['type' => get_class($this)])->andWhere('favoritable_id = :id:', ['id' => $this->id])->execute()->delete();
     }
     return $this;
 }
开发者ID:huoybb,项目名称:movie,代码行数:7,代码来源:FavoritableTrait.php


示例10: registerAction

 public function registerAction()
 {
     // Instantiate the Query
     $query = $this->modelsManager->executeQuery("SELECT name,email FROM Users", $this->getDI());
     // Execute the query returning a result if any
     //$cars = $query->execute();
     echo '<pre>';
     print_r($query);
     /*$q = $this->modelsManager->executeQuery('select * from Users');*/
     foreach ($query as $k => $v) {
         echo $v;
     }
     die;
     $user = new Users();
     //		print_r($this->request->getHeaders());
     $res = $user->query('select * from users');
     print_r($res);
     print_r(get_class_methods($user));
     die;
     // Store and check for errors
     $success = $user->save($this->request->getPost(), array('name', 'email'));
     if ($success) {
         echo "Thanks for registering!";
     } else {
         echo "Sorry, the following problems were generated: ";
         foreach ($user->getMessages() as $message) {
             echo $message->getMessage(), "<br/>";
         }
     }
     $this->view->disable();
 }
开发者ID:CatDouby,项目名称:phalcon-demo,代码行数:31,代码来源:SignupController.php


示例11: login

 function login()
 {
     $u = new Users();
     if ($this->params['name'] && $this->params['password'] && $_POST['name'] && $_POST['password']) {
         $name = strtolower(trim($this->params['name']));
         $password = strtolower(trim($this->params['password']));
         if ($user = $u->find_by_name_and_password($name, $password)) {
             // Remmeber me forever
             if ($this->params['remember'] == 1) {
                 setcookie(DEFAULT_COOKIE, $user['session_id'], time() + 86400 * 360, "/");
             }
             $_SESSION['user'] = $user;
             $url = '/';
             if ($_SESSION['return_url']) {
                 $url = $_SESSION['return_url'];
                 unset($_SESSION['return_url']);
             }
             redirect_to($url);
             return;
         } else {
             $this->flash('Incorrect username or password!');
         }
     }
     $this->title = 'Login';
     $this->crumbs = array('Login');
 }
开发者ID:esconsut1,项目名称:php-rails-clone,代码行数:26,代码来源:user_controller.php


示例12: render

 public static function render($userInputObject, $user)
 {
     global $list_max_entries_per_page;
     $adb = PearDatabase::getInstance();
     $viewer = new Import_UI_Viewer();
     $ownerId = $userInputObject->get('foruser');
     $owner = new Users();
     $owner->id = $ownerId;
     $owner->retrieve_entity_info($ownerId, 'Users');
     if (!is_admin($user) && $user->id != $owner->id) {
         $viewer->display('OperationNotPermitted.tpl', 'Vtiger');
         exit;
     }
     $userDBTableName = Import_Utils::getDbTableName($owner);
     $moduleName = $userInputObject->get('module');
     $moduleMeta = self::getModuleMeta($moduleName, $user);
     $result = $adb->query('SELECT recordid FROM ' . $userDBTableName . ' WHERE status is NOT NULL AND recordid IS NOT NULL');
     $noOfRecords = $adb->num_rows($result);
     $importedRecordIds = array();
     for ($i = 0; $i < $noOfRecords; ++$i) {
         $importedRecordIds[] = $adb->query_result($result, $i, 'recordid');
     }
     if (count($importedRecordIds) == 0) {
         $importedRecordIds[] = 0;
     }
     $focus = CRMEntity::getInstance($moduleName);
     $queryGenerator = new QueryGenerator($moduleName, $user);
     $customView = new CustomView($moduleName);
     $viewId = $customView->getViewIdByName('All', $moduleName);
     $queryGenerator->initForCustomViewById($viewId);
     $list_query = $queryGenerator->getQuery();
     // Fetch only last imported records
     $list_query .= ' AND ' . $focus->table_name . '.' . $focus->table_index . ' IN (' . implode(',', $importedRecordIds) . ')';
     if (PerformancePrefs::getBoolean('LISTVIEW_COMPUTE_PAGE_COUNT', false) === true) {
         $count_result = $adb->query(mkCountQuery($list_query));
         $noofrows = $adb->query_result($count_result, 0, "count");
     } else {
         $noofrows = null;
     }
     $start = ListViewSession::getRequestCurrentPage($moduleName, $list_query, $viewId, false);
     $navigation_array = VT_getSimpleNavigationValues($start, $list_max_entries_per_page, $noofrows);
     $limit_start_rec = ($start - 1) * $list_max_entries_per_page;
     $list_result = $adb->pquery($list_query . " LIMIT {$limit_start_rec}, {$list_max_entries_per_page}", array());
     $recordListRangeMsg = getRecordRangeMessage($list_result, $limit_start_rec, $noofrows);
     $viewer->assign('recordListRange', $recordListRangeMsg);
     $controller = new ListViewController($adb, $user, $queryGenerator);
     $listview_header = $controller->getListViewHeader($focus, $moduleName, $url_string, $sorder, $order_by, true);
     $listview_entries = $controller->getListViewEntries($focus, $moduleName, $list_result, $navigation_array, true);
     $viewer->assign('CURRENT_PAGE', $start);
     $viewer->assign('LISTHEADER', $listview_header);
     $viewer->assign('LISTENTITY', $listview_entries);
     $viewer->assign('FOR_MODULE', $moduleName);
     $viewer->assign('FOR_USER', $ownerId);
     $isAjax = $userInputObject->get('ajax');
     if (!empty($isAjax)) {
         echo $viewer->fetch('ListViewEntries.tpl');
     } else {
         $viewer->display('ImportListView.tpl');
     }
 }
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:60,代码来源:Import_ListView_Controller.php


示例13: init

 public function init()
 {
     if (!Zend_Registry::isRegistered('user')) {
         if ($user = $this->getRequest()->getParam("user")) {
             $users = new Users();
             if ($user = $users->getUserFromUsername($user)) {
                 Zend_Registry::set("user", $user);
             }
         }
     }
     $this->_user = Zend_Registry::get("user");
     if (!Zend_Registry::isRegistered('shard')) {
         Zend_Registry::set("shard", $this->_user->id);
     }
     if (Zend_Registry::isRegistered("cache")) {
         $this->_cache = Zend_Registry::get("cache");
     }
     if (Zend_Registry::isRegistered("root")) {
         $this->_root = Zend_Registry::get("root");
     }
     if (Zend_Registry::isRegistered("configuration")) {
         $this->_config = Zend_Registry::get("configuration");
     }
     // Other global variables
     $this->_application = Stuffpress_Application::getInstance();
     $this->_properties = new Properties(array(Stuffpress_Db_Properties::KEY => $this->_user->id));
     $this->_admin = $this->_application->user && $this->_application->user->id == $this->_user->id ? true : false;
     // Disable layout if XMLHTTPRequest
     if ($this->_request->isXmlHttpRequest()) {
         $this->_helper->layout->disableLayout();
     }
 }
开发者ID:segphault,项目名称:storytlr,代码行数:32,代码来源:BaseController.php


示例14: 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


示例15: getUsers

 public function getUsers($tagId)
 {
     $user = new Users();
     $tag = new Filfolders();
     $selector = $this->select(Zend_Db_Table::SELECT_WITHOUT_FROM_PART)->setIntegrityCheck(false)->from(array('u' => $user->getTableName(true)), 'id')->join(array('fu' => $this->getTableName(true)), 'u.id = fu.users_id', '')->join(array('ff' => $tag->getTableName(true)), 'fu.filfolders_id = ff.id', '')->where('ff.id = ?', $tagId)->order('ff.pagorder');
     return $this->fetchAll($selector);
 }
开发者ID:Cryde,项目名称:sydney-core,代码行数:7,代码来源:FilfoldersUsersOp.php


示例16: perform

 function perform()
 {
     // fetch the data
     $this->_userName = $this->_request->getValue("userName");
     $this->_userEmail = $this->_request->getValue("userEmail");
     // try to see if there is a user who has this username and uses the
     // given mailbox as the email address
     $users = new Users();
     $userInfo = $users->getUserInfoFromUsername($this->_userName);
     // if the user doesn't exist, quit
     if (!$userInfo) {
         $this->_view = new SummaryView("resetpassword");
         $this->_form->setFieldValidationStatus("userName", false);
         $this->setCommonData(true);
         return false;
     }
     // if the user exists but this is not his/her mailbox, then quit too
     if ($userInfo->getEmail() != $this->_userEmail) {
         $this->_view = new SummaryView("resetpassword");
         $this->_form->setFieldValidationStatus("userEmail", false);
         $this->setCommonData(true);
         return false;
     }
     // if everything's fine, then send out the email message with a request to
     // reset the password
     $requestHash = SummaryTools::calculatePasswordResetHash($userInfo);
     $config =& Config::getConfig();
     $baseUrl = $config->getValue("base_url");
     $resetUrl = $baseUrl . "/summary.php?op=setNewPassword&a={$requestHash}&b=" . md5($userInfo->getUsername());
     SummaryTools::sendResetEmail($userInfo, $resetUrl);
     $this->_view = new SummaryMessageView($this->_locale->tr("password_reset_message_sent_ok"));
     $this->setCommonData();
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:plogfr-svn,代码行数:34,代码来源:summarysendresetemail.class.php


示例17: train

 function train($f3)
 {
     // Check if Logged In User is Allowed to Train
     if (!$f3->get('SESSION.active') || !$f3->get('SESSION.admin') && !\R::findOne('trainings', 'users_id=? AND tools_id=? AND level=?', array($f3->get('SESSION.id'), $this->D->id, 'T'))) {
         throw new \Exception('You are not authorized to train for this machine.');
     }
     if ($f3->get('POST')) {
         // Check Instructor Validity
         if ($f3->get('POST.instructor') != $f3->get('SESSION.username')) {
             if (!$f3->get('SESSION.admin')) {
                 throw new \Exception('Cannot Change Instructor');
             }
         }
         if (!($instructor = \R::findOne('users', 'username=? AND active=1', array($f3->get('POST.instructor'))))) {
             throw new \Exception('Invalid Instructor Username');
         }
         $f3->set('instructor', $instructor);
         if ($f3->exists('POST.username')) {
             // Ensure User Checked the Affirmation
             if (!$f3->get('POST.affirmation')) {
                 throw new \Exception('Did not check legal aggreement box.');
             }
             // Get Trained User
             $user = new Users($f3);
             $user->authenticate($f3);
             $user->update_user($f3);
             $this->create_record($f3, $user->D, $instructor);
         }
     }
     $f3->set('data.training_levels', json_decode($f3->get('data.training_levels')));
     show_page($f3, 'trainings.train');
 }
开发者ID:neyre,项目名称:tools.olin.edu,代码行数:32,代码来源:trainings.php


示例18: vtws_changePassword

/**
 *
 * @param WebserviceId $id
 * @param String $oldPassword
 * @param String $newPassword
 * @param String $confirmPassword
 * @param Users $user 
 * 
 */
function vtws_changePassword($id, $oldPassword, $newPassword, $confirmPassword, $user)
{
    vtws_preserveGlobal('current_user', $user);
    $idComponents = vtws_getIdComponents($id);
    if ($idComponents[1] == $user->id || is_admin($user)) {
        $newUser = new Users();
        $newUser->retrieve_entity_info($idComponents[1], 'Users');
        if (!is_admin($user)) {
            if (empty($oldPassword)) {
                throw new WebServiceException(WebServiceErrorCode::$INVALIDOLDPASSWORD, vtws_getWebserviceTranslatedString('LBL_' . WebServiceErrorCode::$INVALIDOLDPASSWORD));
            }
            if (!$user->verifyPassword($oldPassword)) {
                throw new WebServiceException(WebServiceErrorCode::$INVALIDOLDPASSWORD, vtws_getWebserviceTranslatedString('LBL_' . WebServiceErrorCode::$INVALIDOLDPASSWORD));
            }
        }
        if (strcmp($newPassword, $confirmPassword) === 0) {
            $success = $newUser->change_password($oldPassword, $newPassword);
            $error = $newUser->db->hasFailedTransaction();
            if ($error) {
                throw new WebServiceException(WebServiceErrorCode::$DATABASEQUERYERROR, vtws_getWebserviceTranslatedString('LBL_' . WebServiceErrorCode::$DATABASEQUERYERROR));
            }
            if (!$success) {
                throw new WebServiceException(WebServiceErrorCode::$CHANGEPASSWORDFAILURE, vtws_getWebserviceTranslatedString('LBL_' . WebServiceErrorCode::$CHANGEPASSWORDFAILURE));
            }
        } else {
            throw new WebServiceException(WebServiceErrorCode::$CHANGEPASSWORDFAILURE, vtws_getWebserviceTranslatedString('LBL_' . WebServiceErrorCode::$CHANGEPASSWORDFAILURE));
        }
        VTWS_PreserveGlobal::flush();
        return array('message' => 'Changed password successfully');
    }
}
开发者ID:vinzdrance,项目名称:YetiForceCRM,代码行数:40,代码来源:ChangePassword.php


示例19: vtws_login

function vtws_login($username, $pwd)
{
    $user = new Users();
    $userId = $user->retrieve_user_id($username);
    if (empty($userId)) {
        throw new WebServiceException(WebServiceErrorCode::$AUTHREQUIRED, 'Given user cannot be found');
    }
    $token = vtws_getActiveToken($userId);
    if ($token == null) {
        throw new WebServiceException(WebServiceErrorCode::$INVALIDTOKEN, "Specified token is invalid or expired");
    }
    $accessKey = vtws_getUserAccessKey($userId);
    if ($accessKey == null) {
        throw new WebServiceException(WebServiceErrorCode::$ACCESSKEYUNDEFINED, "Access key for the user is undefined");
    }
    $accessCrypt = md5($token . $accessKey);
    if (strcmp($accessCrypt, $pwd) !== 0) {
        throw new WebServiceException(WebServiceErrorCode::$INVALIDUSERPWD, "Invalid username or password");
    }
    $user = $user->retrieveCurrentUserInfoFromFile($userId);
    if ($user->status != 'Inactive') {
        return $user;
    }
    throw new WebServiceException(WebServiceErrorCode::$AUTHREQUIRED, 'Given user is inactive');
}
开发者ID:mslokhat,项目名称:corebos,代码行数:25,代码来源:Login.php


示例20: process

 function process(Vtiger_Request $request)
 {
     $currentUserModel = Users_Record_Model::getCurrentUserModel();
     $baseUserId = $currentUserModel->getId();
     $userId = $request->get('id');
     $user = new Users();
     $currentUser = $user->retrieveCurrentUserInfoFromFile($userId);
     $name = $currentUserModel->getName();
     $userName = $currentUser->column_fields['user_name'];
     Vtiger_Session::set('AUTHUSERID', $userId);
     Vtiger_Session::set('authenticated_user_id', $userId);
     Vtiger_Session::set('user_name', $userName);
     Vtiger_Session::set('full_user_name', $name);
     $status = 'Switched';
     if (Vtiger_Session::get('baseUserId') == '') {
         Vtiger_Session::set('baseUserId', $baseUserId);
         $status = 'Signed in';
     } elseif ($userId == Vtiger_Session::get('baseUserId')) {
         $baseUserId = $userId;
         Vtiger_Session::set('baseUserId', '');
         $status = 'Signed out';
     } else {
         $baseUserId = Vtiger_Session::get('baseUserId');
     }
     $dbLog = PearDatabase::getInstance('log');
     $dbLog->insert('l_yf_switch_users', ['baseid' => $baseUserId, 'destid' => $userId, 'busername' => $currentUserModel->getName(), 'dusername' => $name, 'date' => date('Y-m-d H:i:s'), 'ip' => Vtiger_Functions::getRemoteIP(), 'agent' => $_SERVER['HTTP_USER_AGENT'], 'status' => $status]);
     header('Location: index.php');
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:28,代码来源:SwitchUsers.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP UsersHelper类代码示例发布时间:2022-05-23
下一篇:
PHP Userflag类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap