本文整理汇总了PHP中Redirect::redirectTo方法的典型用法代码示例。如果您正苦于以下问题:PHP Redirect::redirectTo方法的具体用法?PHP Redirect::redirectTo怎么用?PHP Redirect::redirectTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Redirect
的用法示例。
在下文中一共展示了Redirect::redirectTo方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<?php
require_once "src/init.php";
$pageTitle = "Log In";
if ($session->is_logged_in()) {
Redirect::redirectTo();
}
$sec = "login";
require ROOT_PATH . 'inc/head.php';
?>
</pre>
<body>
<div class="main login-page">
<div class="ui container">
<div class="ui raised very padded segment log-in">
<div class="ui message">
<div class="header">
Log in to your account.
</div>
</div>
<hr id="login-hr">
<div class="ui login form">
<form class="login-form" method="post">
<div class="field username">
<label>Username</label>
<input type="text" id="username" name="username" placeholder="Username">
<p class="note">You can login with your username, email or id.</p>
</div>
<div class="field password">
<label>Password</label>
<input type="password" name="password" placeholder="Password">
示例2: msgs
<?php
require_once $_SERVER["DOCUMENT_ROOT"] . "/src/init.php";
if (!$session->is_logged_in()) {
Redirect::redirectTo("/signup.php");
}
if (isset($_GET['msg'])) {
require_once 'message.php';
exit;
}
if (isset($_GET['pm'])) {
require_once 'convo.php';
exit;
}
$sh = isset($_GET['sh']) ? $_GET['sh'] : 'inb';
$pageTitle = "Messages";
$sec = "messages";
include_once ROOT_PATH . "inc/head.php";
?>
<div class="ui container section messages">
<?php
echo msgs();
?>
<ul class="msg-center center" id="msgs-msg" style="display:none;">
</ul>
<div class="ui grid">
<div class="four wide column">
<div class="ui vertical menu">
<a class="item <?php
echo $sh == 'compose' ? 'teal active' : null;
示例3: userLock
public function userLock($user)
{
if ($user) {
if ($this->is_logged_in() && $this->user_id === $user->id) {
return true;
} elseif ($this->adminCheck()) {
return true;
} else {
echo "You can't view this page.";
Redirect::redirectTo("/sha", 2);
return false;
}
} elseif ($this->adminCheck()) {
return true;
} else {
echo "User was not found.";
Redirect::redirectTo("/sha", 2);
}
}
示例4: unset
<?php
require_once $_SERVER["DOCUMENT_ROOT"] . '/src/init.php';
//Allow access only via ajax requests
if (empty($_SERVER['HTTP_X_REQUESTED_WITH']) || strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) != 'xmlhttprequest') {
Redirect::redirectTo('404');
}
if (isset($_POST['action'])) {
$action = $_POST['action'];
unset($_POST['action']);
} elseif (isset($_GET['action'])) {
$action = $_GET['action'];
unset($_GET['action']);
} else {
die("Error! bad request.");
}
switch ($action) {
// get user profile card
case 'profile_card':
$uid = $_POST['id'];
die(View::userCard($uid));
break;
case 'renderComment':
$id = $_GET['id'];
die(View::renderComment($id));
break;
default:
break;
}
示例5: sanitize_id
<?php
require_once $_SERVER["DOCUMENT_ROOT"] . "/src/init.php";
if (!$session->is_logged_in()) {
Redirect::redirectTo("/signup.php");
}
if (!isset($_GET['msg'])) {
Redirect::redirectTo("../messages");
}
$msgid = sanitize_id($_GET['msg']);
$message = Messages::getMsg($msgid);
if (!$message) {
Redirect::redirectTo('');
}
$pageTitle = "Messages";
if (!$message) {
$session->message("Message was not found", "../messages", "warning");
}
Messages::msgSeen(USER_ID, $msgid);
$self = USER_ID == $message->u_id ? true : false;
$arch = $message->deleted == 1 ? true : false;
$staff = $message->ual == 1 ? true : false;
$img_path = $message->img_path;
$date = $message->date;
$sec = "messages";
include ROOT_PATH . "inc/head.php";
?>
<div class="ui container section messages">
<?php
echo msgs();
?>
示例6: msgs
<?php
require_once "src/init.php";
$pageTitle = "Sign Up";
if ($session->is_logged_in()) {
Redirect::redirectTo('/sha');
}
$sec = "signup";
require ROOT_PATH . 'inc/head.php';
?>
<body>
<div class="main signup-page">
<div class="ui container">
<?php
echo msgs();
?>
<div class="ui raised very padded segment sign-up">
<div class="ui compact warning message">
<div class="header">
<i class="warning icon"></i>
It is recommended to not enter any sensitive or personal information.
</div>
</div>
<hr id="signup-hr">
<div class="ui sign-up form">
<form class="signup-form" method="POST">
<div class="field username">
<label>Username</label>
<input type="text" name="username" placeholder="Username" />
示例7: User
<?php
require_once $_SERVER["DOCUMENT_ROOT"] . "/src/init.php";
$session->is_logged_in() ? true : Redirect::redirectTo("/signup.php");
$id = USER_ID;
$user = new User($id);
$user = $user->user;
$session->userLock($user);
?>
<div class="ui segment user-settings">
<div class="ui dividing header">
Update your account settings
</div>
<div class="ui segment vertical">
<form id="update_settings" class="ui form">
<div class="field username">
<label for="username">Username</label>
<input type="text" name="username" value="<?php
echo $user->username;
?>
"/>
</div>
<div class="field email">
<label for="email">email</label>
<input type="email" name="email" value="<?php
echo $user->email;
?>
" />
</div>
示例8: Admin
<?php
require_once $_SERVER["DOCUMENT_ROOT"] . "/src/init.php";
$pageTitle = "Admin Control Panel";
$session->adminLock();
$admin = new Admin();
$users = $admin->getAllUsers();
$count = count($users);
$rpp = 6;
$cp = isset($_GET['cp']) ? $_GET['cp'] : 1;
$pag = new Pagination($count, $cp, $rpp);
if ($cp > $pag->total_pages() || $cp <= 0) {
Redirect::redirectTo('self');
}
$offset = $pag->offset();
$users = $admin->getAllUsers($rpp, $offset);
$sec = "users";
require ROOT_PATH . 'inc/head.php';
?>
<body>
<div class="main">
<div class="ui container section">
<div class="wrapper">
<h2>Users list</h2>
<h3 style="margin-top:0px"><?php
echo $count;
?>
total users</h3><hr><br>
<table class="ui striped single line table" style="width:90%">
<thead>
<tr>