本文整理汇总了PHP中Site::Redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP Site::Redirect方法的具体用法?PHP Site::Redirect怎么用?PHP Site::Redirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Site
的用法示例。
在下文中一共展示了Site::Redirect方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: RequiresLoggedInUser
public static function RequiresLoggedInUser($redirectTo)
{
if (!UserFacade::IsUserLoggenIn()) {
$error = new Error(Error::NotAuthenticated, "You have to log in to get access to that page.");
Site::Redirect($redirectTo, $error);
}
}
示例2: BackToHome
/**
* Redirects the page to the root of the website
* @param logout, if set to true will also log out the user.
*/
public static function BackToHome($logout = false)
{
if ($logout != false) {
Site::Redirect(Site::GetBaseURL(true) . 'Logout' . URLPAGEEXT);
} else {
Site::Redirect(Site::GetBaseURL() . 'Home' . URLPAGEEXT);
}
}
示例3:
$recipe = null;
$id = Site::GetArgumentSafely('id');
if (Value::SetAndNotNull($id)) {
$recipe = Recipe::Load($id);
if (Value::SetAndNotNull($recipe)) {
$recipe->LoadSteps();
$edit = false;
//Value::SetAndEqualTo($recipe->GetUsertrue, $GLOBALS, 'EDIT', true);
if (Value::SetAndNotNull($_POST, 'CommentInput') && Site::CheckSecurityToken()) {
$message = Site::GetPostValueSafely('CommentInput');
$commentid = Site::GetPostValueSafely('CommentSelect');
if (!is_numeric($commentid)) {
$commentid = EMPTYSTRING;
}
Comment::Insert($message, $id, $commentid);
Site::Redirect(EMPTYSTRING);
}
} else {
Site::BackToHome();
}
} else {
Site::BackToHome();
}
// Page Output
include_once 'Pages/OnAllPages.php';
$recipebox = new RTK_Box('recipebox');
$recipedescription = new RTK_Box(null, 'recipedescription');
$recipedescription->AddChild(new RTK_Header($recipe->GetTitle()));
//if (!$edit) { $recipedescription->AddChild(new RTK_Link('EditRecipe'.URLPAGEEXT, 'Edit')); }
if ($recipe->GetPicture() != null) {
$recipedescription->AddChild(new RTK_Image('/' . $recipe->GetPicture()->GetFileName()));
示例4: Error
if ($error->code != Error::NoError) {
Site::Redirect("/register.php", $error);
}
$error = UserFacade::RegisterUser($user, $password);
if ($error->code != Error::NoError) {
Site::Redirect("/register.php", $error);
}
$error = UserFacade::LogUserIn($user, $password);
if ($error->code != Error::NoError) {
Site::Redirect("/log-in.php", $error);
}
} else {
$error = new Error(Error::InvalidParameter, "No parameter has been sent.");
Site::Redirect("/register.php", $error);
}
Site::Redirect("/index.php");
//Checks whether parameters are correct
function ValidateParameters($user, $password, $retypedPassword)
{
if (empty($user)) {
return new Error(Error::InvalidParameter, "User name cannot be empty.");
}
if (UserFacade::IsUserRegistered($user)) {
return new Error(Error::NotUniqueValue, "User with provided name is already registered.");
}
if (empty($password)) {
return new Error(Error::InvalidParameter, "Password cannot be empty.");
}
if (strcmp($password, $retypedPassword)) {
return new Error(Error::InvalidParameter, "Passwords don't match to each other.");
}
示例5: Error
$actionName = $_POST["submit"];
$userId = UserFacade::GetLoggedUserId();
$error = new Error();
if ($championId == 0) {
$error = new Error(Error::InvalidParameter, "Invalid champion chosen.");
Site::Redirect("/manage-champions.php", $error);
}
$error = PerformAction($actionName, $championId, $userId);
if ($error->code != Error::NoError) {
Site::Redirect("/manage-champions.php", $error);
}
} else {
$error = new Error(Error::InvalidParameter, "No parameter has been sent.");
Site::Redirect("/manage-champions.php", $error);
}
Site::Redirect("/manage-champions.php");
//Based by provided action name, adds or removes provided champion.
//Returns error code
function PerformAction($actionName, $championId, $userId)
{
$error = new Error();
if (strcmp($actionName, "Add") == 0) {
$error = ChampionFacade::AddChampionToUser($championId, $userId);
} else {
if (strcmp($actionName, "Remove") == 0) {
$error = ChampionFacade::RemoveChampionFromUser($championId, $userId);
} else {
$error = new Error(Error::InvalidParameter, "Invalid action: " . $actionName);
}
}
return $error;
示例6: GenerateFileNameWithPath
Site::Redirect("/add-new-champion.php", $error);
}
$fileName = GenerateFileNameWithPath($championName);
$error = SaveFile($file, $fileName);
if ($error->code != Error::NoError) {
Site::Redirect("/add-new-champion.php", $error);
}
$error = ChampionFacade::AddChampion($championName, $fileName);
if ($error->code != Error::NoError) {
Site::Redirect("/add-new-champion.php", $error);
}
} else {
$error = new Error(Error::InvalidParameter, "No parameter has been sent.");
Site::Redirect("/add-new-champion.php", $error);
}
Site::Redirect("/add-new-champion.php");
//Checks whether all provided parameters are correct
function ValidateParameters($championName, $file)
{
if (strlen($championName) == 0) {
return new Error(Error::InvalidParameter, "Invalid champion name.");
}
if (ChampionFacade::DoesChampionExists($championName)) {
return new Error(Error::NotUniqueValue, "Provided champion already exists.");
}
if (!isset($file) || $file === null) {
return new Error(Error::InvalidFile, "File has not been uploaded.");
}
$error = ValidateFile($file);
if ($error->code != Error::NoError) {
return $error;
示例7: LogOut
/**
* Logs the user out.
**/
public static function LogOut()
{
// Clear the session and regenerate the id, on logout
// ...but make sure that the failed attempts carry over to the new session
$attempts = Login::GetAttempts();
session_unset();
session_regenerate_id();
Login::SetAttempts($attempts);
Site::Redirect('http://' . BASEURL . 'Home' . URLPAGEEXT);
}
示例8:
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . "/include/scripts/include-all.php";
Site::Redirect("/process/log-out.php");