本文整理汇总了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");
}
}
示例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);
}
}