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


PHP Site::Redirect方法代码示例

本文整理汇总了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);
     }
 }
开发者ID:silmith,项目名称:IChooseYou,代码行数:7,代码来源:site.php

示例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);
     }
 }
开发者ID:iensenfirippu,项目名称:securipe,代码行数:12,代码来源:Functions.php

示例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()));
开发者ID:iensenfirippu,项目名称:securipe,代码行数:31,代码来源:ViewRecipe.php

示例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.");
    }
开发者ID:silmith,项目名称:IChooseYou,代码行数:31,代码来源:register.php

示例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;
开发者ID:silmith,项目名称:IChooseYou,代码行数:31,代码来源:manage-champions.php

示例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;
开发者ID:silmith,项目名称:IChooseYou,代码行数:31,代码来源:add-new-champion.php

示例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);
 }
开发者ID:iensenfirippu,项目名称:securipe,代码行数:13,代码来源:Login.php

示例8:

<?php

require_once $_SERVER['DOCUMENT_ROOT'] . "/include/scripts/include-all.php";
Site::Redirect("/process/log-out.php");
开发者ID:silmith,项目名称:IChooseYou,代码行数:4,代码来源:log-out.php


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