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

PHP models\User类代码示例

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

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



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

示例1: seedImage

 public function seedImage(User $user)
 {
     $file = $this->faker->imageUrl(600, 400, 'people');
     Debugger::debug($file, 'image url');
     $image = new Image($file);
     Debugger::debug($image, 'image class');
     $filename = md5($file . $user->get('id')) . '.jpg';
     $imageDir = 'assets/images/profile-pics/original/';
     $imageDir .= substr($filename, 0, 1) . '/';
     $imageDir .= substr($filename, 1, 1) . '/';
     $imageDir .= substr($filename, 2, 1) . '/';
     if (!is_dir(PUBLIC_ROOT . $imageDir)) {
         mkdir(PUBLIC_ROOT . $imageDir, 0777, true);
     }
     $saveName = PUBLIC_ROOT . $imageDir . $filename;
     Debugger::debug($saveName, 'save name');
     $image->save($imageDir . $filename);
     $thumbnail = $this->seedThumbnail($image, $imageDir, $user);
     // update the database
     $userImage = new UserImage();
     $userImage->set('user_id', $user->get('id'));
     $userImage->set('image_url', '/' . $imageDir . $filename);
     $userImage->set('thumbnail', '/' . $thumbnail);
     $userImage->set('main_image', 1);
     $userImage->save();
 }
开发者ID:lenlyle1,项目名称:lightupdating,代码行数:26,代码来源:UserImages.php


示例2: signin

 public function signin()
 {
     $userModel = new \Models\User();
     $helper = $this->fb->getRedirectLoginHelper();
     $permissions = ['email', 'user_likes'];
     // optional
     $callback_url = DIR . 'account/fblogin';
     $this->data['loginUrl'] = $helper->getLoginUrl($callback_url, $permissions);
     if (isset($_POST['email']) && !empty($_POST['email'])) {
         $login = $userModel->login($_POST['email'], md5($_POST['password']));
         if (!is_bool($login)) {
             Session::set('user_id', $login->user_id);
             Session::set('user', $login);
             //redirects user to last visited page
             $redirectUrl = Session::get('redirectLogin');
             Session::destroy('redirectLogin');
             if (isset($redirectUrl) && $redirectUrl != '') {
                 Url::redirect($redirectUrl);
             } else {
                 Url::redirect('board');
             }
         } else {
             Session::set('error', 'Login Fails!');
         }
     }
     $this->data['title'] = 'Sign In';
     View::rendertemplate('header', $this->data);
     View::render('account/signin', $this->data);
     View::rendertemplate('footer', $this->data);
 }
开发者ID:Oluwafemikorede,项目名称:gbedu,代码行数:30,代码来源:Account.php


示例3: actionEdit_status

 public function actionEdit_status()
 {
     $user = new User();
     $user->find()->where(['id' => $_POST['userID']])->one();
     $user->status = $_POST['status'];
     $user->save();
 }
开发者ID:apuc,项目名称:app_to_vk,代码行数:7,代码来源:Admin.php


示例4: index

 public function index()
 {
     $f3 = \Base::instance();
     $this->_requireLogin();
     $user = $f3->get('user');
     $user_obj = $f3->get('user_obj');
     $user_org_links = $f3->get('user_org_links');
     $db = $f3->get('db.instance');
     $tickets = $db->exec('SELECT * FROM support_tickets WHERE memberId = ? ORDER BY id DESC', $user['id']);
     foreach ($tickets as $id => $ticket) {
         $result = $db->exec('SELECT COUNT(*) AS `count` FROM support_tickets_msg WHERE ticketId = ?', $ticket['id']);
         $tickets[$id]['messages_count'] = $result[0]['count'];
         // Assigned or not ?
         if ($ticket['assignedUserId'] != 0) {
             $assignedUser = new User();
             $assignedUser->load($ticket['assignedUserId']);
             $tickets[$id]['assignedUser'] = $assignedUser->cast();
         }
     }
     $f3->set('tickets', $tickets);
     $active_tickets = $db->exec("SELECT * FROM support_tickets WHERE memberId = ? AND status != 'closed'", $user['id']);
     $f3->set('active_tickets', $active_tickets);
     $closed_tickets = $db->exec("SELECT * FROM support_tickets WHERE memberId = ? AND status = 'closed'", $user['id']);
     $f3->set('closed_tickets', $closed_tickets);
     $f3->set('target', 'support/index.html');
     $this->_render('base.html');
 }
开发者ID:KindlyFire,项目名称:SquareMS-Web,代码行数:27,代码来源:index.php


示例5: index

 public function index()
 {
     $userModel = new User();
     $userModel->all();
     $users = $userModel->all();
     return view('index', compact('users'));
 }
开发者ID:Antoine07,项目名称:Base-Objet,代码行数:7,代码来源:UserController.php


示例6: index

 public function index()
 {
     $data['title'] = $this->language->get('title');
     $user = new User();
     var_dump($user->getData());
     View::renderTemplate('header', $data);
     View::render('welcome/welcome', $data);
     View::renderTemplate('footer', $data);
 }
开发者ID:hieunguyenbk,项目名称:AgriExtension,代码行数:9,代码来源:Hello.php


示例7: register

 public static function register($email, $nick, $password)
 {
     $user = new User();
     $user->email = $email;
     $user->nick = $nick;
     $user->password = password_hash($password, PASSWORD_DEFAULT);
     $user->save();
     return $_SESSION['user'] = $user->id;
 }
开发者ID:fant0m,项目名称:VAII,代码行数:9,代码来源:Auth.php


示例8: banUser

 public function banUser($id)
 {
     if ($this->user->banUser($id) !== 1) {
         Session::setError('something went wrong');
         Redirect::back();
     }
     Session::setMessage('Done');
     Redirect::to('/admin/users');
 }
开发者ID:re5pectR10,项目名称:PHPCustomFramework,代码行数:9,代码来源:AdminController.php


示例9: seedEmail

 public function seedEmail(User $user)
 {
     Debugger::debug('Seeding email');
     $userEmail = new Email();
     $userEmail->set('user_id', $user->get('id'));
     $userEmail->set('email', $this->faker->freeEmail);
     $userEmail->set('primary', 1);
     $userEmail->save();
 }
开发者ID:lenlyle1,项目名称:lightupdating,代码行数:9,代码来源:UserEmail.php


示例10: actionReg

 public function actionReg()
 {
     $vk_id = $this->app->cookie->get('vk_id');
     $user = new User();
     $user->find()->where(['vk_id' => $vk_id])->one();
     $user->status = $_GET['status'] == 1 ? 2 : 1;
     $user->save();
     $this->app->parser->render('profile', ['user' => $user]);
 }
开发者ID:apuc,项目名称:My_Framework,代码行数:9,代码来源:Auth.php


示例11: create

 protected function create()
 {
     $params = arrayKeysSnakeToCamel($_POST['user']);
     $user = new User();
     $user->fromArray($params);
     $user->save();
     $this->addFlash("success", "registered");
     redirectTo("/");
 }
开发者ID:OneTimeCZ,项目名称:Tasker,代码行数:9,代码来源:UserController.php


示例12: start

 public function start()
 {
     if ($this->user) {
         return $this->app->parser->renderW('main_menu', ['user' => $this->user], false);
     } else {
         $user = new User();
         $user->find()->where(['vk_id' => Cookie::get('vk_id')])->one();
         return $this->app->parser->renderW('main_menu', ['user' => $user], false);
     }
 }
开发者ID:apuc,项目名称:app_to_vk,代码行数:10,代码来源:MainMenu.php


示例13: connect

 public function connect(Application $app)
 {
     // creates a new controller based on the default route
     $front = $app['controllers_factory'];
     $front->get("/", 'FrontController\\Homepage::index')->bind("homepage");
     $front->match("/final_test", 'FrontController\\FinalTest::index')->bind("final_test");
     $front->match("/control_test", 'FrontController\\ControlTest::index')->bind("control_test");
     $front->match("/{course_type}", 'FrontController\\CourseType::index')->bind("course_type");
     //$front->post("/{course_type}", 'FrontController\Score::index')->bind("course_type");
     $app->get('/logout', function (Request $request) use($app) {
         $app['session']->set('username', '');
         $app['session']->set('id', '');
         $redirect = $app["url_generator"]->generate("homepage");
         return $app->redirect($redirect);
     })->bind("logout");
     $app->post('/login-check', function (Request $request) use($app) {
         $em = $app['orm.em'];
         $qb = $em->createQueryBuilder();
         if (null !== $request->get('username2')) {
             $username = $request->get('username2');
             $query = $qb->select('u')->from('models\\User', 'u')->where("u.username = '" . $username . "'")->getQuery();
             $result = $query->getResult();
             $result_count = count($result);
             if ($result_count > 0) {
                 return 'Helaas, de gebruikersnaam die je hebt ingevoerd bestaat al, probeer eens een andere.';
             } else {
                 $user = new User();
                 $user->setUsername($username);
                 $user->setRoles("ROLE_USER");
                 $em->persist($user);
                 $em->flush();
                 $id = $user->getId();
                 $app['session']->set('id', $id);
                 $app['session']->set('username', $username);
                 return 'succes';
             }
         } else {
             if ($request->get('username') != '') {
                 $username = $request->get('username');
                 $query = $qb->select('u')->from('models\\User', 'u')->where("u.username = '" . $username . "'")->getQuery();
                 $result = $query->getResult();
                 $result_count = count($result);
                 if ($result_count < 1) {
                     return 'De gebruikersnaam die je hebt ingevoerd bestaat niet, probeer het eens opnieuw.';
                 } else {
                     $id = $result[0]->id;
                     $app['session']->set('id', $id);
                     $app['session']->set('username', $username);
                     return 'succes';
                 }
             }
         }
     })->bind("login_check");
     return $front;
 }
开发者ID:janvaneck,项目名称:school,代码行数:55,代码来源:FrontProvider.php


示例14: users

 function users()
 {
     if (Session::isSession('user')) {
         $user = new User();
         $usersData = $user->getAll();
         $this->view->addUsers($usersData);
         $this->view->forAjax('users');
     } else {
         Error::authFail();
     }
 }
开发者ID:kowi90,项目名称:mvc_test,代码行数:11,代码来源:Index.php


示例15: actionMy

 public function actionMy()
 {
     $vk_id = Cookie::get('vk_id');
     $user = new User();
     $user->find()->where(['vk_id' => $vk_id])->one();
     $user->status = $_GET['status'] == 1 ? 2 : 1;
     $user->save();
     $region = new GeobaseRegion();
     $city = new GeobaseCity();
     $regionAll = $region->find()->orderBy('name', 'ASC')->all();
     $this->app->parser->render('profile', ['user' => $user, 'regionAll' => $regionAll]);
 }
开发者ID:apuc,项目名称:My_Framework,代码行数:12,代码来源:Profile.php


示例16: registerUser

 function registerUser($postdata)
 {
     $regname = htmlentities($postdata['regname']);
     $regpass = htmlentities($postdata['regpass']);
     $regauth = htmlentities($postdata['regauth']);
     $regpass = hash('sha256', $regpass);
     $user = new User();
     $user->setName($regname);
     $user->setPassword($regpass);
     $user->setAuthlevel($regauth);
     $user->save();
 }
开发者ID:kowi90,项目名称:mvc_test,代码行数:12,代码来源:Register.php


示例17: __construct

 public function __construct()
 {
     parent::__construct();
     $id = Register::get('id');
     if (!empty($id)) {
         $user = new User($id);
         $user->setLastVisit();
         $user->writeData(true);
         $this->logout();
     }
     $this->logout();
 }
开发者ID:Adam88Stanley,项目名称:portfolio,代码行数:12,代码来源:logout.php


示例18: index

 public function index()
 {
     $f3 = \Base::instance();
     $this->_requireLogin();
     $this->_requireRank('support');
     $user = $f3->get('user');
     $user_obj = $f3->get('user_obj');
     $user_org_links = $f3->get('user_org_links');
     $db = $f3->get('db.instance');
     $tickets = $db->exec('SELECT * FROM support_tickets ORDER BY id DESC');
     foreach ($tickets as $id => $ticket) {
         $result = $db->exec('SELECT COUNT(*) AS `count` FROM support_tickets_msg WHERE ticketId = ?', $ticket['id']);
         $tickets[$id]['messages_count'] = $result[0]['count'];
         // Assigned or not ?
         if ($ticket['assignedUserId'] != 0) {
             $assignedUser = new User();
             $assignedUser->load($ticket['assignedUserId']);
             $tickets[$id]['assignedUser'] = $assignedUser->cast();
         }
         // From who ?
         $ticketCreator = new User();
         $ticketCreator->load($ticket['memberId']);
         $tickets[$id]['member'] = $ticketCreator->cast();
     }
     $f3->set('tickets', $tickets);
     $active_tickets = $db->exec("SELECT * FROM support_tickets WHERE status != 'closed'");
     $f3->set('active_tickets', $active_tickets);
     $closed_tickets = $db->exec("SELECT * FROM support_tickets WHERE status = 'closed'");
     $f3->set('closed_tickets', $closed_tickets);
     // Very high priority tickets
     $prio_tickets = $db->exec("SELECT * FROM support_tickets WHERE status != 'closed' AND priority = 4 ORDER BY id DESC");
     foreach ($prio_tickets as $id => $ticket) {
         $result = $db->exec('SELECT COUNT(*) AS `count` FROM support_tickets_msg WHERE ticketId = ?', $ticket['id']);
         $prio_tickets[$id]['messages_count'] = $result[0]['count'];
         // Assigned or not ?
         if ($ticket['assignedUserId'] != 0) {
             $assignedUser = new User();
             $assignedUser->load($ticket['assignedUserId']);
             $prio_tickets[$id]['assignedUser'] = $assignedUser->cast();
         }
         // From who ?
         $ticketCreator = new User();
         $ticketCreator->load($ticket['memberId']);
         $prio_tickets[$id]['member'] = $ticketCreator->cast();
     }
     $f3->set('priority_tickets', $prio_tickets);
     // Some side-bar stats
     $result = $db->exec('SELECT count(*) AS `count` FROM users');
     $f3->set('users_count', $result[0]['count']);
     $f3->set('tickets_count', count($active_tickets));
     $f3->set('target', 'dashboard/admin/support/index.html');
     $this->_render('base.html');
 }
开发者ID:KindlyFire,项目名称:SquareMS-Web,代码行数:53,代码来源:index.php


示例19: postregister

 /**
  * @BingingModel RegisterUserBingingModel
  */
 public function postregister(RegisterUserBingingModel $userBindingModel)
 {
     if ($userBindingModel) {
         $user = new User();
         $user->setUsername($userBindingModel->getUsername());
         $user->setPassword($userBindingModel->getPassword());
         $user->setCash(10000);
         $this->data->register($user);
     }
     $this->view->appendToLayout('main', 'register');
     $this->view->display('layouts.default');
 }
开发者ID:KonstantinKirchev,项目名称:WebDevelopment,代码行数:15,代码来源:Users.php


示例20: logintry

 public function logintry($postdata)
 {
     $inputname = $postdata['inputname'];
     $inputpass = $postdata['inputpass'];
     $user = new User();
     $user->findByName($inputname);
     if ($user->getPassword() === hash('sha256', $inputpass)) {
         Session::create('user', $user->getName());
     } else {
         echo 0;
     }
 }
开发者ID:kowi90,项目名称:mvc_test,代码行数:12,代码来源:Login.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP models\UserAccountModel类代码示例发布时间:2022-05-23
下一篇:
PHP models\SiteModel类代码示例发布时间: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