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


PHP runner::flash方法代码示例

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


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

示例1: stack

 public static function stack($name, $value = null, $keep = false)
 {
     if (!is_null($value)) {
         self::$stack[$name] = $value;
         if ($keep) {
             self::flash($name, $value, 'stack', false);
             if (!isset($_SESSION["flash"])) {
                 $_SESSION["flash"] = array();
             }
             $_SESSION["flash"][$name] = $value;
         }
     } elseif (is_null($value) && isset(self::$stack[$name])) {
         return self::$stack[$name];
     } elseif (is_null($value) && ($value = \runner::flash($name, null, 'stack', false))) {
         return $value;
     } elseif (is_null($value) && isset($_SESSION["flash"][$name])) {
         return $_SESSION["flash"][$name];
     } else {
         return false;
     }
 }
开发者ID:RetroscopeCreative,项目名称:RouterunnerCMS,代码行数:21,代码来源:runner.php

示例2: set

 private static function set($user = null, $logout = false)
 {
     if (is_null($user)) {
         // logout user
         self::$me = false;
         self::$email = null;
         self::$name = null;
         self::$group = null;
         self::$scope = null;
         self::$auth = null;
         self::$custom = array();
         self::$alias = 0;
         self::close_token(self::$token);
         if ($logout) {
             $flash_var = \runner::config('User.UserFlashVar') ? \runner::config('User.UserFlashVar') : 'UserFlashVar';
             if (isset($_SESSION['routerunner-logout-' . $flash_var]) && $_SESSION['routerunner-logout-' . $flash_var] === true) {
                 $cookie = \runner::config('User.TokenCookie') ? \runner::config('User.TokenCookie') : 'TokenCookie';
                 \Routerunner\Routerunner::$slim->setCookie($cookie, null, -1, '/');
                 $flash_var = \runner::config('User.UserFlashVar') ? \runner::config('User.UserFlashVar') : 'UserFlashVar';
                 \runner::now($flash_var, false);
                 \runner::stack($flash_var, false);
                 \runner::flash($flash_var, false);
                 unset($_SESSION['slim.flash'][$flash_var]);
                 setcookie($cookie, null, -1, '/');
                 unset($_COOKIE[$cookie]);
                 unset($_SESSION['routerunner-logout-' . $flash_var]);
             } else {
                 $_SESSION['routerunner-logout-' . $flash_var] = true;
             }
         }
     } elseif (isset($user) && !is_null($user) && is_array($user)) {
         self::set();
         // clear user if exists
         $flash_var = \runner::config('User.UserFlashVar') ? \runner::config('User.UserFlashVar') : 'UserFlashVar';
         if (\runner::now($flash_var)) {
             $flash = \runner::now($flash_var);
         } elseif (\runner::stack($flash_var)) {
             $flash = \runner::stack($flash_var);
         } else {
             $flash = \runner::flash($flash_var);
         }
         $array_to_translate = \runner::config('User.UserArrayToTranslate') ? \runner::config('User.UserArrayToTranslate') : array();
         if ($flash === $user) {
             foreach ($user as $key => $value) {
                 $var = isset($array_to_translate[$key]) ? $array_to_translate[$key] : $key;
                 if ($var === 'email' || $var === 'name' || $var === 'alias') {
                     self::${$var} = $value;
                 } else {
                     self::$custom[$var] = $value;
                 }
             }
             if (self::get_user()) {
                 self::open_token();
                 self::set_session_token();
             }
         }
     }
 }
开发者ID:RetroscopeCreative,项目名称:RouterunnerCMS,代码行数:58,代码来源:User.php

示例3: array

<?php

/**
 * Created by PhpStorm.
 * User: csibi
 * Date: 2015.02.18.
 * Time: 14:55
 */
$post = $_POST;
$msg = "";
if (!logincrypt($post["email"], $post["password"], $msg)) {
    echo '<div class="alert alert-danger">' . $msg . '</div>';
} else {
    echo '<div class="alert alert-success">Logged in successfully!</div>';
    $SQL = "SELECT id, email, last_login, last_ip, licence FROM member WHERE email = :email";
    if ($result = \Routerunner\Db::query($SQL, array(":email" => $post["email"]))) {
        $user = $result[0];
        if (isset($post["rememberme"]) && $post["rememberme"]) {
            $user["rememberme"] = true;
        }
        \runner::flash('member', $user);
        $SQL = "UPDATE member SET last_login = :last_login, last_ip = :last_ip WHERE email = :email";
        $params = array(":last_login" => time(), ":last_ip" => $_SERVER["REMOTE_ADDR"], ":email" => $post["email"]);
        \Routerunner\Db::query($SQL, $params);
        \runner::redirect($_SERVER["HTTP_REFERER"]);
    }
}
开发者ID:RetroscopeCreative,项目名称:RouterunnerCMS,代码行数:27,代码来源:login.signin.submit.php


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