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


PHP Web::sessionUnset方法代码示例

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


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

示例1: login_POST

function login_POST(Web &$w)
{
    if ($_POST['login'] && $_POST['password']) {
        $client_timezone = "Australia/Sydney";
        //$_POST['user_timezone'];
        $user = $w->Auth->login($_POST['login'], $_POST['password'], $client_timezone);
        if ($user) {
            if ($w->session('orig_path') != "auth/login") {
                $url = $w->session('orig_path');
                $w->Log->debug("Original path: " . $url);
                // If no url specified, go to the users defined url
                if (empty($url) || $url == "/") {
                    $url = $user->redirect_url;
                }
                $w->sessionUnset('orig_path');
                $w->redirect($w->localUrl($url));
            } else {
                $w->redirect(!empty($user->redirect_url) ? $w->localUrl($user->redirect_url) : $w->localUrl());
            }
        } else {
            $w->error("Login or Password incorrect", "/auth/login");
        }
    } else {
        $w->error("Please enter your login and password", "/auth/login");
    }
}
开发者ID:itillawarra,项目名称:cmfive,代码行数:26,代码来源:login.php

示例2: groupmember_POST

function groupmember_POST(Web $w)
{
    $p = $w->pathMatch("group_id");
    $member_id = $w->request('member_id');
    $group_id = $p['group_id'];
    $is_owner = $w->request('is_owner');
    $exceptions = array();
    // store all parent groups in session
    $groupUsers = $w->Auth->getUser($group_id)->isInGroups();
    if ($groupUsers) {
        foreach ($groupUsers as $groupUser) {
            $groupUser->getParents();
        }
    }
    // add member to the group only if it isn't already in there
    // this logic should move to the model!
    $existUser = $w->Auth->getUser($member_id)->isInGroups($group_id);
    if (!$existUser) {
        if (!$w->session('parents') || !in_array($member_id, $w->session('parents'))) {
            $groupMember = new GroupUser($w);
            $groupMember->group_id = $group_id;
            $groupMember->user_id = $member_id;
            $groupMember->role = $is_owner && $is_owner == 1 ? "owner" : "member";
            $groupMember->insert();
        }
        if ($w->session('parents') && in_array($member_id, $w->session('parents'))) {
            $exceptions[] = $w->Auth->getUser($member_id)->login;
        }
    } else {
        $user = $existUser[0]->getUser();
        $exceptions[] = $user->is_group == 1 ? $user->login : $user->getContact()->getFullName();
    }
    $w->sessionUnset('parents');
    if (!empty($exceptions)) {
        $w->error(implode(", ", $exceptions) . " can not be added!", "/admin/moreInfo/" . $group_id);
    } else {
        $w->msg("New members are added!", "/admin/moreInfo/" . $group_id);
    }
}
开发者ID:itillawarra,项目名称:cmfive,代码行数:39,代码来源:groupmember.php


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