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


PHP pathang::redirect方法代码示例

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


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

示例1: login

 public function login()
 {
     //get the instances of session and basket
     $session = pathang::getInstance('session');
     $basket = pathang::getInstance('basket');
     //get username from request object
     $username = trim(pathang::getInstance('request')->filterHTMLSQL('username'));
     //get liveuser from session
     $liveuser = $session->get('liveuser');
     //if live user is available then load the user
     //else if username is available then check for login validation
     // else show the login page
     if ($liveuser) {
         //show the dashboard
         pathang::render('userlog', 'loggedin');
     } elseif ($username) {
         // get the username and password
         $password = trim(pathang::getInstance('request')->filterHTMLSQL('password'));
         //validate user in userlog model
         $status = pathang::getModel('userlog')->validateUser($username, $password);
         // if there is no error then load the userdetails into liveuser and store
         // it in session
         if (!$status->error) {
             $liveuser = new stdclass();
             //load user details
             $liveuser->username = $username;
             $liveuser->id = pathang::getModel('userlog')->getUserId($username);
             $liveuser->name = pathang::getModel('userlog')->getUserFullName($username);
             $liveuser->email = pathang::getModel('userlog')->getUserEmail($username);
             $liveuser->type = pathang::getModel('userlog')->getUserType($username);
             $liveuser->profile_link = ROOT . $liveuser->username;
             $liveuser->image_type = pathang::getModel('userlog')->getUserImageType($username);
             $liveuser->image = pathang::getHelper('userlog')->getUserImage($liveuser);
             $liveuser->feeds_per_page = pathang::getModel('userlog')->getFeedCount($username);
             $liveuser->access_token = pathang::getHelper('userlog')->getToken(pathang::getModel('userlog')->getUserLastLogin($username), $liveuser->id);
             //store liveuser in session
             $session->set('liveuser', $liveuser);
             // show dashboard
             pathang::redirect(ROOT);
         } else {
             //if error in login display error in login page
             // Error could be
             // error 1 - User not found
             // error 2 - Wrong password
             // error 3 - User blocked
             // error 4 - User not activated
             $basket->set('status_message', $status->message);
             $basket->set('status_error', $status->error);
             $basket->set('username', $username);
             //show login page
             pathang::render('userlog', 'login');
         }
     } else {
         //show login page
         pathang::render('userlog', 'login');
     }
 }
开发者ID:adrixnac,项目名称:RedSocial,代码行数:57,代码来源:userlog.php


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