本文整理汇总了PHP中Helper::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP Helper::redirect方法的具体用法?PHP Helper::redirect怎么用?PHP Helper::redirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Helper
的用法示例。
在下文中一共展示了Helper::redirect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: post2Url
public function post2Url($key = null)
{
if (!empty($key) && isset($_POST[$key])) {
$url = $this->objUrl->getCurrent($key);
$post_key = urlencode(stripslashes($_POST[$key]));
$url = !empty($post_key) ? $url . '/' . $key . '/' . $post_key : $url;
Helper::redirect($url);
}
}
示例2: loginAdmin
public static function loginAdmin($user, $url = NULL)
{
$url = !empty($url) ? SITE_URL . $url : SITE_URL . self::$_dashboard_admin;
$_SESSION[self::$_login_admin_id] = $user['id'];
$_SESSION[self::$_login_admin_first] = $user['first_name'];
$_SESSION[self::$_login_admin_last] = $user['last_name'];
$_SESSION[self::$_login_admin_level] = $user['level'];
$_SESSION[self::$_valid_login] = 1;
Helper::redirect($url);
}
示例3: __construct
function __construct()
{
$this->article = Load::model('article_model');
if (isset($_SESSION['time'])) {
if (Session::timeOut()) {
Helper::redirect('user/logout');
} else {
Session::set('time', time());
}
}
}
示例4: processLogin
public static function processLogin($id = null, $url = null, $remember = null)
{
if (!empty($id)) {
$url = !empty($url) ? $url : self::$_default;
if (!isset($_SESSION['SugarKMS'])) {
$_SESSION['SugarKMS'] = array();
}
$_SESSION['SugarKMS'][self::$_login_admin] = $id;
$_SESSION['SugarKMS'][self::$_valid_login] = 1;
if ($remember == 1) {
$hash = md5(time() . $id);
$objMember = new Member();
$objMember->updateMember(array('cookie_hash_kms' => $hash, 'time_kms' => time()), $id);
setcookie(self::$_cookie_name, 'hash=' . $hash, time() + self::$_cookie_time, '/', $_SERVER['SERVER_NAME']);
}
Helper::redirect($url);
}
}
示例5: activateMenu
/**
* Sets the menu as active by storing menu name in session
* @return [type] [description]
*/
public function activateMenu($parameter)
{
// instantiate model
$MenuManagerModel = new MenuManagerModel();
// retrieve data
$menuName = $MenuManagerModel->retrieveMenuName($parameter);
// flatten array by one level
$menuName = call_user_func_array('array_merge', $menuName);
Session::set('active_menu', $menuName);
Session::add('feedback_errors', ErrorMessage::get('MENU_ACTIVATED'));
Helper::redirect('menumanager/managemenus');
}
示例6: _loggedIn
private function _loggedIn()
{
if (Session::get('isLoggedIn')) {
return true;
} else {
Helper::redirect('user/logout');
}
}
示例7: mt_rand
}
$email = $objForm->getPost('email');
$user = $objUser->getByEmail($email);
if (!empty($user)) {
$objValid->add2Errors('email_duplicate');
}
if ($objValid->isValid()) {
// add hash for activating account
$objValid->_post['hash'] = mt_rand() . date('YmdHis') . mt_rand();
// add registration date
$objValid->_post['date'] = Helper::setDate();
if ($objUser->addUser($objValid->_post, $objForm->getPost('password'))) {
$_SESSION['link'] = $_POST['link'];
Helper::redirect('/start/?page=registered');
} else {
Helper::redirect('/start/?page=registered-failed');
}
}
}
require_once '_header.php';
?>
<h1>Login</h1>
<form action="" method="post">
<table cellspacing="0" cellpadding="0" class="tbl_insert" border="0">
<tr>
<th>
<label for="login_email">Login:</label>
</th>
<td>
示例8: processURL
public function processURL($cPage, $url_params)
{
switch ($cPage) {
case '':
//Helper::redirect(Login::$_default);
$member_id = Session::getSession(Login::$_login_admin);
$objMember = new Member();
$current_user = $objMember->getMemberById($member_id);
require_once ROOT_PATH . DS . PAGES_DIR . DS . 'home.php';
break;
case 'login':
Helper::redirect('/sugarkms/');
break;
case 'logout':
require_once ROOT_PATH . DS . PAGES_DIR . DS . 'logout.php';
break;
default:
$member_id = Session::getSession(Login::$_login_admin);
$objMember = new Member();
$current_user = $objMember->getMemberById($member_id);
//tim coi co cpage co phai la group nao trong db khong
$group = $this->objPage->getGroups(array('name' => $cPage));
if (!empty($group) && count($group) == 1) {
//neu cpage la mot trong nhung group da duoc luu trong dbase thi moi xet den params tren url
$group = $group[0];
$page_params = array();
//ghi vao page params dua theo url params
if (empty($url_params)) {
//neu khong co params tren url thi lay params cua default page cho vao
$default_page = $this->objPage->getPages(array('default' => 1, 'group_id' => $group['id']));
if (!empty($default_page) && count($default_page) == 1) {
//neu co duy nhat 1 default page thi moi xu ly tiep
//lay params cua default page
$default_page_params = $this->objPage->getPageParams(array('page_id' => $default_page[0]['id']));
//echo '<h1 style="background:white;">';
// var_dump($default_page_params);
// echo '</h1>';
if (empty($default_page_params)) {
$error = "No default page found.";
} else {
foreach ($default_page_params as $default_param) {
if ($default_param['required_value'] != '') {
//chi cho vao khi default page khong co params tuy bien (required value rong~)
$page_params[$default_param['param']] = $default_param['required_value'];
$this->cPage_id = $default_page[0]['id'];
} else {
$error = "No default page found.";
}
}
}
} else {
$error = "No default page found.";
}
} else {
//neu co params trong url
//neu chi co 1 thanh phan va thanh phan do la so, tuc la id, vay them action=view vao,
//con truong hop member thi split theo "-" roi xet thanh phan dau tien
if (count($url_params) == 1) {
if (is_numeric($url_params[0])) {
$url_params[] = 'view';
}
// //} else {
//// $first_element = $url_params[0];
//// $array = explode('-', $first_element);
//// $length = count($array)-1;
//// if(is_numeric($array[$length])) {
//// $url_params[0] = $array[$length];
//// $url_params[] = 'view';
//// };
////
//// }
//
//
}
//
// if(count($url_params) == 2) {
// //if($cPage == 'member' && count($url_params) == 2) {
// if(is_numeric($url_params[0])) {
// $url_params[] = 'view';
// //echo '<h1 style="background:white;">';
//// var_dump($url_params);
//// echo '</h1>';
// }
// }
$pages = $this->objPage->getPages(array('group_id' => $group['id']));
//echo '<h1 style="background:white;">';
// var_dump($url_params);
// echo '</h1>';
foreach ($pages as $page) {
//echo 'page name: ';
// var_dump($page['name']);
// echo '<br />';
$params_db = $this->objPage->getPageParams(array('page_id' => $page['id']), array('order' => 'asc'));
//echo '<h1 style="background:white;">';
// echo 'params db for page '.$page['name'].': ';
// var_dump($params_db);
// echo '</h1>';
if (count($params_db) == count($url_params)) {
foreach ($params_db as $key => $param_db) {
//echo 'current key: '.$key.'<br />';
//.........这里部分代码省略.........
示例9:
<?php
if ($this->admin['access'] != 1) {
Helper::redirect('/panel/content/c/pages/a/index');
}
$did = $this->objUrl->get('did');
if (!empty($did)) {
$type = $this->objLanguage->getType($did);
if (!empty($type) && $type['is_assigned'] != 1) {
$this->objLanguage->removeType($did);
}
Helper::redirect($this->objUrl->getCurrent(array('a', 'id', 'did')) . '/a/types');
} else {
$id = $this->objUrl->get('id');
if (!empty($id)) {
$type = $this->objLanguage->getType($id);
if (!empty($type) && $type['is_assigned'] != 1) {
require_once 'header.php';
?>
<h1><?php
echo $this->objLanguage->labels[21];
?>
:
<?php
echo $type['content'];
?>
</h1>
<p>
<?php
开发者ID:joakinCC,项目名称:udemy.com-Multilingual-CMS-Website-with-PHP-MySQL-jQuery,代码行数:31,代码来源:types-remove.php
示例10:
<?php
Login::logout();
Helper::redirect(Login::$_login_page);
示例11: User
<?php
$code = Url::getParam('code');
if (!empty($code)) {
$objUser = new User();
$user = $objUser->getUserByHash($code);
if (!empty($user)) {
if ($user['active'] == 0) {
if ($objUser->makeActive($user['id'])) {
$mess = "<h1>Thank you</h1>";
$mess .= "<p>Your account has now been successfully activated.<br />";
$mess .= "You can now log in and continue with your order.</p>";
} else {
$mess = "<h1>Activation unsuccessful</h1>";
$mess .= "<p>There has been a problem activating your account.<br />";
$mess .= "Please contact administrator.</p>";
}
} else {
$mess = "<h1>Account already activated</h1>";
$mess .= "<p>This account has already been activated.</p>";
}
} else {
Helper::redirect("/?page=error");
}
require_once "_header.php";
echo $mess;
require_once "_footer.php";
} else {
Helper::redirect("/?page=error");
}
示例12: Form
<?php
if (Login::isLogged()) {
Helper::redirect(Login::$_default);
}
$objForm = new Form();
$objValid = new Validation($objForm);
$objMember = new Member();
if ($objForm->isPost('login_email')) {
$member = $objMember->getMembers(array('personal_email' => $objForm->getPost('login_email'), 'password' => Login::hash($objForm->getPost('login_password'))));
if (!empty($member) && count($member) == 1) {
//echo '<h1>VALID</h1>';
Login::processLogin($member[0]['id'], '/sugarkms/' . $this->objURL->href($this->objURL->get(Login::$_referrer)), $objForm->getPost('remember'));
} else {
$objValid->add2Errors('login');
}
}
require_once '_header.php';
?>
<h1>Login</h1>
<form action="" method="post">
<table cellpadding="0" cellspacing="0" border="0" class="tbl_insert">
<tr>
<?php
echo $objValid->validate('login');
?>
<td><label for="login_email">Email:</label></td>
<td><input type="text" name="login_email" id="login_email" class="fld" value="" /></td>
</tr>
<tr>
<td><label for="login_password">Password:</label></td>
<td><input type="password" name="login_password" id="login_password" class="fld" value="" /></td>
示例13:
<?php
Helper::redirect(SITE_URL . DS . DEFAULT_PAGE);
require_once '_header.php';
require_once '_footer.php';
示例14: Form
<?php
if (Login::isLogged(Login::$_login_admin_id)) {
Helper::redirect(SITE_URL . Login::$_dashboard_admin);
}
$objForm = new Form();
$objValidation = new Validation($objForm);
if ($objForm->isPost('login_user')) {
$objAdmin = new Admin();
$objValidation->_required = array('login_user', 'login_password');
if ($objAdmin->isUser($objForm->getPost('login_user'), $objForm->getPost('login_password'))) {
$result = Login::loginAdmin($objAdmin->_user, Url::getReferrerUrl());
} else {
$objValidation->add2Errors('login');
}
if ($objValidation->isValid()) {
}
}
?>
<html>
<head>
<title>XBook Management System</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="css/Core.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="../css/bootstrap.min.css">
<link rel="stylesheet" href="../css/bootstrap-theme.min.css">
<link rel="stylesheet" href="../css/bootstrap-select.min.css">
示例15: restrictAdmin
public static function restrictAdmin()
{
if (!self::isLogged(self::$_login_admin)) {
Helper::redirect(self::$_login_page_admin);
}
}