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


PHP Users类代码示例

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


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


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