-2

ユーザーがphpページにアクセスできないようにする方法、つまり、phpページを入力しようとすると、「sory unauthorized page」というテキストでアクセスできないか、phpページに関連する別のページにリダイレクトするだけです。

次のように: www.mydomain.com/index.php は www.mydomain.com/home または /home.html www.mydomain.com/profile.php になり、ユーザーは書き換えページのみを入力します。 PHPページではありません。

ありがとう

4

2 に答える 2

0
if (!$isAllowed)
{
    (Redirect them)
}

とてもシンプルです。

http://www.instant-web-site-tools.com/html-redirect.html

http://php.net/manual/en/function.header.php

どちらもリダイレクトの方法を示しています。

于 2012-04-22T18:26:55.963 に答える
0

使用できます

headerリダイレクトexitまたはdieページ実行の停止

$url = "http://www.mydomain.com/home";
$isValidUser = false ;

if(!$isValidUser)
{
    header("Localtion: $url");
}

または

$isValidUser = false ;
if(!$isValidUser)
{
    die("Sorry un authorized page");
}

参照してください

http://php.net/manual/en/function.header.php

http://php.net/manual/en/function.die.php

http://php.net/manual/en/function.exit.php

于 2012-04-22T18:26:58.983 に答える