PHP / Apache错误:406不可接受

发布时间:2022-04-30 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了PHP / Apache错误:406不可接受脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
所以今天我收到了这个错误,我已经将其缩小到这个问题:

我的网站是我的音乐家页面here.它允许人们进来看我的照片,新闻,我的音乐和我正在玩的事件.

一切都在膨胀,我手动将数据输入MysqL,让它自动提供给主页.现在我正在添加控制面板,以便我可以从Web添加,编辑和删除数据库中的内容.

除了添加/编辑事件的能力之外,一切正常.我把它缩小到我无法输入2个URL或我收到此错误的事实.我需要输入2个网址(一个用于查看活动页面,一个用于购买门票)但我一次输入的数量不能超过1个,是否有任何我可以做的纠正或解决错误,无论是在apache还是我的码?

<?PHP
    $sPEcevlink = "http://faceBooklink.COM";
    $specgigtick = "http://ticketplacelink.com";
?>
     <form method="post" action="index.PHP?page=edITgigs">
         <table>
                <tr>
                     <td>
                          Event Page (Link):
                     </td>
                     <td style="text-align: left;">
                          <input type="url" name="giglink" value="<?PHP echo $specevlink; ?>" />
                     </td>
                </tr>
                <tr>
                     <td>
                          Event Tickets (Link):
                     </td>
                     <td style="text-align: left;">
                          <input type="url" name="gigtick" value="<?PHP echo $specgigtick; ?>" />
                     </td>
                </tr>
         </table><br />
         <input type="submit" name="editgig" value="submit" /><br />
         <br />
     </form>

编辑:

我正在添加完整的代码行,以便您可以确切地看到我正在使用的代码,

这是step 1的照片
这是step 2的照片

这包含在index.PHP文件中:

<?PHP
if(isset($_GET["page"])){
$page = $_GET["page"];
} else {
$page = "";
}

if($page === "editgigs"){
 include ('inc/logincheck.PHP');
?>
 <div class="label">
      EDIT GIGS
 </div><br />
 <div style="margin: 0 auto; text-align: center; width: 100%">
      <form method="post" action="index.PHP?page=editgigs">
<?PHP
      if(!isset($_POST['selectgigs'])){
           if(!isset($_POST['updgigs'])){
?>
                Select one of the options below:<br />
                <br />
                <select name="selgigs" style="max-width: 26%;">
<?PHP
                     while($gigsall_data = MysqLi_fetch_array($gigsall_query)){
                          $gigid = stripslashes($gigsall_data['idgigs']);
                          $gigdate = stripslashes($gigsall_data['date']);
                          $gigname = stripslashes($gigsall_data['name']);
                          $gigdate = date('F j,Y',strtotime($gigdate));
?>
                          <option value="<?PHP echo $gigid; ?>">
                               <?PHP echo $gigdate; ?>: <?PHP echo $gigname; ?>
                          </option>
<?PHP
                     }
?>
                </select><br /><br />
                <input type="submit" name="selectgigs" value="Select" /><br />
                <br />
<?PHP
           }
      }
      if(isset($_POST['selectgigs'])){
           $gigtoed = trim($_POST['selgigs']);
           $specgig_query = MysqLi_query($con,"SELECT * From `gigs` WHERE `idgigs` = '$gigtoed'") or die(MysqLi_error($con));
           $specgig_data = MysqLi_fetch_array($specgig_query);
           $specdate = stripslashes($specgig_data['date']);
           $specname = stripslashes($specgig_data['name']);
           $specevlink = stripslashes($specgig_data['evlink']);
           $specgigtick = stripslashes($specgig_data['ticklink']);
           $specnos = stripslashes($specgig_data['noshow']);
           if($specnos === '0'){
                $noshow = '';
           } else {
                $noshow = 'checked';
           }
?>
           <table style="border-spacing: 5px; padding: 10px;">
                <tr>
                     <td>
                          Past Event?:
                     </td>
                     <td style="text-align: left;">
                          <input type="checkBox" name="nos" <?PHP echo $noshow; ?> /> Past Event
                     </td>
                </tr>
                <tr>
                     <td>
                          Date:
                     </td>
                     <td style="text-align: left;">
                          <input type="date" name="gigdate" value="<?PHP echo $specdate; ?>" required />
                     </td>
                </tr>
                <tr>
                     <td>
                          Name:
                     </td>
                     <td style="text-align: left;">
                          <input type="text" name="gigname" value="<?PHP echo $specname; ?>" required />
                     </td>
                </tr>
                <tr>
                     <td>
                          Event Page (Link):
                     </td>
                     <td style="text-align: left; width: 350px;">
                          <input type="url" name="giglink" style="width: 100%;" value="<?PHP echo $specevlink; ?>" />
                     </td>
                </tr>
                <tr>
                     <td>
                          Event Tickets (Link):
                     </td>
                     <td style="text-align: left; width: 350px;">
                          <input type="url" name="gigtick" style="width: 100%;" value="<?PHP echo $specgigtick; ?>" />
                     </td>
                </tr>
           </table><br />
           <input type="hidden" name="gigid" value="<?PHP echo $gigtoed; ?>" />
           <input type="submit" name="updgigs" value="Update" /><br />
           <br />
<?PHP
      }
      if(isset($_POST['updgigs'])){
           $newid = trim($_POST['gigid']);
           $newdate = MysqLi_real_escape_string($con,trim($_POST['gigdate']));
           $newname = MysqLi_real_escape_string($con,trim($_POST['gigname']));
           $newlink = MysqLi_real_escape_string($con,trim($_POST['giglink']));
           $newtick = MysqLi_real_escape_string($con,trim($_POST['gigtick']));
           if(isset($_POST['nos'])){
                $newnoshow = MysqLi_real_escape_string($con,'1');
           } else {
                $newnoshow = MysqLi_real_escape_string($con,'0');
           }
           echo $newid.' '.$newdate.' '.$newname.' '.$newlink.' '.$newtick.' '.$newnoshow.'<br />';
           /*MysqLi_query($con,"UPDATE `gigs` SET `date` = '$newdate',`name` = '$newname',`evlink` = '$newlink',`ticklink` = '$newtick',`noshow` = '$newnoshow' WHERE `idgigs` = '$newid' LIMIT 1") or die(MysqLi_error($con));*/ //commented for testing
?>
           <div style="text-align: center;">
                <span class="confirm">
                     Successfully updated click <a href="index.PHP?page=events">here</a> to view it!
                </span>
           </div>
<?PHP
      }
?>
      </form>
 </div>
<?PHP
}

仅供参考 – LOGincheck.PHP什么都不做,只检查用户是否已登录,如果没有,则将其发送回主页.

如果任何用户输入项以http://或https://开头,则您的网站会产生错误.

当我尝试使用以http://开头的链接时,我得到了406 Not Acceptable:

http://onkore.us/?blah=http://www.google.com

我试试这个很好:

http://onkore.us/?blah=www.google.com

您已经提到过,如果它有多个链接,您就会遇到问题,但是当我尝试使用下面的两个链接时,它很好:

http://onkore.us/?blah1=www.google.com&blah2=www.google.com

但是,您可以找到并修复可能特定于您的服务器配置的问题,或者您可以尝试解决此问题.

我不确定这种解决方法是否有帮助,但考虑到http://或https://正在创建问题,我的想法是从用户输入中删除http://和https://.首先,您可能希望尝试将< input type =“url”更改为< input type =“text”,以便不强制执行URL格式.然后,您可以使用Javascript在提交到服务器之前从表单中的用户输入中删除http://和https://的出现.此外,您可以在填充表单值之前从数据中删除这些. 希望这可以帮助 . 正则表达式:@L_301_6@

脚本宝典总结

以上是脚本宝典为你收集整理的PHP / Apache错误:406不可接受全部内容,希望文章能够帮你解决PHP / Apache错误:406不可接受所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。