【问题标题】:Get 403 For some reason PHP error i think获取 403 出于某种原因我认为 PHP 错误
【发布时间】:2017-06-19 02:13:08
【问题描述】:

好的,所以我最近决定向我的站点添加一个维护页面,它是一个 .php 文件,所以当我启用它来测试它时,即使使用不同的 PC、网络,我也会收到 403 错误。我什至尝试过 VPN .. 谁能解释为什么我启用它时会得到一个 403 页面????

    <?php
session_id();
session_start();
ob_start();
date_default_timezone_set('America/Chicago');
$connection = mysql_pconnect("Hidden","Hidden","Hidden"); or die ("Error connecting to database.");
mysql_select_db("Hidden") or die ("Error connecting to database, hang tight, we are working on it.");
mysql_select_db("Hidden") or die ("Error connecting to database, hang tight, we are working on it.");


?>
<style>
body {
color:white;
font-family:Segoe UI;
}
body { background-image:url("http://www.freegreatpicture.com/files/191/20288-gyrosigma-light-blue-background.jpg"); }
#Opacity {
background: url(Opacity.png);
padding:12px;
border:1px solid #969696;
border-radius:6px;
width:380px;
}

h3 {
color:#F5F5F5;
font-size:25px;
margin:0;
padding:0;
padding-bottom:10px;
}

#h3sub {
color:#F5F5F5;
font-size:18px;
}

h2 {
color:#F5F5F5;
text-shadow:1px 0px 0px #999;
margin:0;
padding:0;
padding-bottom:10px;
}

input[type=text] {
width:300px;
background:white;
border:1px solid #999;
padding:4px;
font-family:Segoe UI;
border-radius:5px;
}

input[type=password] {
width:300px;
background:white;
border:1px solid #999;
padding:10px;
font-family:Segoe UI;
border-radius:7px;
}

#btn {
background:rgb(34,51,136);
padding:4px;
border-radius:7px;
color:white;
font-family:Verdana;
font-size:30px;
font-weight:bold;
text-shadow:1px 0px 0px rgb(34,34,34);
</style>
<center><td valign='top'>
            <center><img src='http://i.imgur.com/q1CODHB.png'></center>
        </td>
<div style='padding-bottom:0px;'></div>
<table>
        <h1><B><font color='darkred'>Maintenance Protocol</FONT></B></h1>
<h4><B><font color='darkred'>Gravitar is currently offline for maintenance and upgrades.</FONT></B></h4>
<h4><B><font color='darkred'>You will be redirected back to the website when this process is complete.</FONT></B></h4>
<br>
</br>
    <tr>

        <td valign='top'>
            <div id='Opacity'>
                        <h0><B><font color='darkblue'>Gravitar</FONT></B></h0>
                        <h2><font color='darkblue'>Developer Login</FONT></h2>
            <form action='' method='POST'>
                <table>
                    <tr>
                        <td>
                            <input type='password' name='Password' placeholder='Passcode...'>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <input type='submit' name='submit' value='U'>
    <input type='submit' name='submit' value='N'>
<input type='submit' name='submit' value='I'>
<input type='submit' name='submit' value='V'>
<input type='submit' name='submit' value='E'>
<input type='submit' name='submit' value='R'>
<input type='submit' name='submit' value='O'>
<input type='submit' name='submit' value='U'>
<input type='submit' name='submit' value='S'>

                        </td>
                    </tr>
                </table>
            </form>
            </div>
        </td>
    </tr>
</table>
<?php
$Password = mysql_real_escape_string(strip_tags(stripslashes($_POST['Password'])));
$submit = mysql_real_escape_string(strip_tags(stripslashes($_POST['submit'])));

    if ($submit) {

        $Passcode = "5y24G4H@$%Y56herGerefVVVVVVVerqcdfllllLOLFwew4wF!@#$";

        if ($Password == $Passcode) {

            $_SESSION['Admin']="hi";
            header("Location: index.php");

        }

    }
echo"<h4><center><font color='darkblue'>&copy Void Team Corporation. All Rights Reserved.</font></h4></center>";
?>
<?php
echo"</div></div>";
include "../Footer.php";
?>

【问题讨论】:

  • mysql_* 函数已弃用,请使用 mysqli_* 或 PDO。
  • 哇!这完全修复了我的代码!天哪!!!
  • 很难判断你是否在讽刺。
  • 它破坏了整个网站。
  • 你需要花时间转换它,参数结构不同。在当前版本的 PHP 中,mysql_* 函数被完全删除,第二次更新 PHP 所有这些函数都将变为未定义。 mysql_* 也有些地方坏了,可能会导致安全问题。

标签: php http-status-code-403


【解决方案1】:

使用 PDO 连接请求命令作为 Mysql 连接请求命令已被弃用

如果你甚至得到错误 请按照以下步骤操作

检查 URL 错误并确保您指定的是实际网页文件名和扩展名,而不仅仅是一个目录。大多数网站都配置为禁止目录浏览,因此在尝试显示文件夹而不是特定页面时出现 403 Forbidden 消息是正常且预期的。

注意:到目前为止,这是网站返回 403 Forbidden 错误的最常见原因。在花时间进行以下故障排除之前,请务必充分探索这种可能性。

确保您使用了正确的包含网址。

确保您在 HostManager 中提供了正确的 CHOMD,通常您应该提供读写权限。

如果您已经完成但仍然无法访问它,请确保该文件是否位于任何子目录下,请确保您甚至授予该文件夹适当的 CHOMD 权限。

最大可能的错误是**获得访问权限** 所以按照上面的步骤就可以解决了。

因为这是一个 HTTP 错误并且您正在使用 .php 文件,因此一旦预先检查您是否有任何错误,即使是问题也可能出现在您的 htaccess 文件中。

即使您没有得到解决方案,请随时 ping 我。

希望这两者都能帮助你摆脱错误。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-07-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-09
    • 2015-09-30
    • 1970-01-01
    相关资源
    最近更新 更多