php 403禁止提交表单

l3zydbqr  于 2023-01-19  发布在  PHP
关注(0)|答案(9)|浏览(128)

我有一个URL返回403,由于某些未知原因而被禁止。我已禁用.htaccess中的mod_security,将文件chmodded为0777。该URL为
http://www.veepiz.com/afrostar.php?app=help&func=addvideo
当你提交表格的时候就发生了有什么想法吗?
这是密码

function PublicAddVideo()
    {
    if (isset($_POST['submit_addvideo']))
        {
        require_once("class.phpmailer.php");     
        //send email tobirthday person
        $subject="New AfroStar Video Suggested";
        $msg = "Dear Jordah,\n".
              "Youtube video: ".$_POST['youtubesle']."\n Star Name: ".$_POST['starnamesle']."\n Country: ".$_POST['countrysle']."\n IP Address: ".getRealIpAddr();
        $mail = new PHPMailer();
        $mail->IsSMTP();                                      // set mailer to use SMTP
        $mail->Host = "localhost";  // specify main and backup server
        $mail->SMTPAuth = true;     // turn on SMTP authentication
        $mail->Username = "support@veepiz.com";  // SMTP username
        $mail->Password = "********"; // SMTP password
        $mail->From = "support@veepiz.com";
        $mail->FromName = "Veepiz";
        $mail->AddAddress('jordahz@hotmail.com',"Jordah Ferguson");
        $mail->AddReplyTo("support@veepiz.com", "Veepiz");
        $mail->WordWrap = 50;                                 // set word wrap to 50 characters
        $mail->IsHTML(true);                                  // set email format to HTML
        $mail->Subject = $subject;
        $mail->Body    = nl2br($msg);
        $mail->AltBody = $msg;
        if(!$mail->Send())
            {
            }
        ?>
        <div style='color:green;'>Admins at veepiz.com have been notified of your request and will update afrostar application accordingly.<div align='center' style='padding:10px'>&nbsp;&nbsp;<a  href='afrostar.php' onclick="return getPage('afrostar_class.php',{});" class='btn'>Back to AfroStars</a></div></div>
        <?php             
        } else
        {
        $this->DisplayHeader("Add African Video");    
        ?>
        <script language="javascript">
          var checkHelpVars=function ()
            {
            err='';
            if ($('#starnamesle').val().length==0) err+="Please type in the name of the star";
            if ($('#countrysle').val().length==0) err+="\nName of the country missing";
            if ($('#youtubesle').val().length==0) err+="\nYoutube url missing";
            var url=$('#youtubesle').val();
            var matches = url.match(/^http:\/\/(?:www\.)?youtube.com\/watch\?(?=.*v=[\w-]+)(?:\S+)?$/);
            if (matches) {
                } else {
                err +="\nInvalid Youtube Url";
                }                
            if (err.length>0)
                {
                alert(err);
                return false;    
                }    
            <?php 
            if (isloggedin())
                {
                echo "return postPage('afrostar_class.php?app=help&func=addvideo',{starnamesle:$('#starnamesle').val(),countrysle:$('#countrysle').val(),youtubesle:encodeURI($('#youtubesle').val()),submit_addvideo:1});";    
                } else
                {
                echo "return true;";    
                }                     
            ?>
            }  
        </script>
        <form id='helpform' method="POST" action="http://www.veepiz.com/afrostar.php?app=help&amp;func=addvideo">
        <table cellpadding="2" cellspacing="3">
            <tr>
                <td><b>Africa Artist Name:</b></td>
                <td><input id='starnamesle' type="text" style='' name='starnamesle' style='-webkit-border-radius: 8px;-moz-border-radius: 8px;border-radius: 8px;width:450px'/></td>
            </tr>
            <tr>
                <td><b>Country:</b></td>
                <td><input id='countrysle' type="text" style='' name='countrysle' style='-webkit-border-radius: 8px;-moz-border-radius: 8px;border-radius: 8px;width:450'/></td>
            </tr>                
            <tr>
                <td><b>Youtube link:</b></td>
                <td><input id='youtubesle' type="text" style='' name='countrysle' style='-webkit-border-radius: 8px;-moz-border-radius: 8px;border-radius: 8px;width:450'/><br/>Example:<small style='font-size:8pt;color:#666666'>http://www.youtube.com/watch?v=vJyftjMOd2w</small></td>
            </tr>                
            <tr>
                <td colspan="2" align="center"><input type="submit" class="btn" onclick="return checkHelpVars();" name='submit_addvideo' value="Finish"></td>
            </tr>                
        </table>
        </form>

        <?php    
        $this->DisplayFooter();
        }   
    }
h5qlskok

h5qlskok1#

检查您的帖子数据,如果它包含任何网址,那么有机会被阻止在服务器。
你应该替换你提交的网址中的某些字符,然后你需要转换回它的原始形式。

omhiaaxx

omhiaaxx2#

我的解决方案:

这听起来像是你在把你传递的URL嵌入到你要传递到的脚本的URL之前没有对它进行URL编码。

eivnm1vs

eivnm1vs4#

我意识到我已经为Countrysle定义了两次名称...所以我把它改成了这个,现在它可以工作了[在表单内]

<tr>
            <td><b>Country:</b></td>
            <td><input id='countrysle' type="text"  name='countrysle' style='-webkit-border-radius: 8px;-moz-border-radius: 8px;border-radius: 8px;width:250px'/></td>
        </tr>                
        <tr>
            <td><b>Youtube link:</b></td>
            <td><input id='youtubesle' type="text" name='youtubesle' style='-webkit-border-radius: 8px;-moz-border-radius: 8px;border-radius: 8px;width:250px'/><br/>Example:<small style='font-size:8pt;color:#666666'>http://www.youtube.com/watch?v=vJyftjMOd2w</small></td>
        </tr>
huwehgph

huwehgph5#

您需要在有问题的字段的input标记中使用type= "text"属性。另外,请尝试在form属性中使用method= "post",而不是get,这也会导致此问题。

k97glaaz

k97glaaz6#

1.创建**.htaccess文件
1.将此行
SecFilterEngine Off放入.htaccess文件
1.将此htaccess文件保存在
root**文件夹中

7ajki6be

7ajki6be7#

对于其他正在为此而挣扎的人来说,绝对值得检查一下其他人推荐的$_POST全局变量。
在我的例子中,我的问题是我从JS发出了一个fetch()请求。我打印了我的全局变量,但里面什么也没有。我发现这很奇怪,因为输出请求中的有效负载包含了我需要的所有数据,而且还指定了这是一个POST请求。
我过去使用过 AJAX ,但不想在这个示例中使用jQuery,因为它只用于这个请求。
对于任何处于我这种情况并希望使用fetch()对PHP脚本执行POST请求的人来说,使用FormData()接口是至关重要的。

ifmq2ha2

ifmq2ha28#

令人难以置信的是,我发现如果我把post字符串从'blank form webpage'改为'blank webpage',也就是说,省略了技术词汇'form',那么表单就可以发布文本,而服务器也不会弹出'Forbidden'的消息!!!

gpfsuwkq

gpfsuwkq9#

http://www.linuxforums.org/forum/servers/34130-you-dont-have-permission-access-server-solved.html
阅读该链接的最后一条评论:
“刚在谷歌上搜索了我的问题,发现了这个帖子。大部分都让我摸不着头脑,但我创建了一个新文件夹,把我的“禁止”文件放在那里,它就解决了这个问题。谢谢!”
哇!

相关问题