1

I am using a CMS. when I put HTML code it works, when I put simple PHP code like "hello World" or when I try to connect to a database it works. But when I put more complex PHP code like " phpinfo()" or any SQL statements like "$reponse = $bdd->query('SELECT * FROM insription_14juin');" it doesn't work. The message that I get using fiddler is

 403 Forbidden
 You don't have permission to access /admin/modules/gestion_articles/updateContenu.php
on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

After multiple tests I think that a JavaScript file is trying to load information into a PHP file and apparently when the PHP code is complex the JavaScript file doesn't have permission to access the PHP file.

This is the JavaScript file:

  $(function() {
$('#savemodif').click(function() {
    $('#formModif').append('<img src="images/ajax-loader.gif" alt="Enregistrement en cours..." id="loadingImg" />');

            var contenu ="";
    var type = $('#type').val();
    if(type == '0')
    {
                tinyMCE.triggerSave();
                contenu = $('#contenu').val();
                contenu = encodeURIComponent(contenu);
    }
    else
    {
                contenu = $('#contenu').val();
                contenu = encodeURIComponent(contenu);
    }

    /* Récupération d'infos nécessaires à la mise à jour */
    var id = $('#idcontenu').val();
    var oldtitre = $('#oldtitre').val();

    /* Récupération des mises à jours */
    var titre = $('#titre').val();
    var date = $('#date').val();
    var publie = 0; if($('#publie').is(':checked')) publie = 1;
            var diapo = '0'; if($('#diapo').is(':checked')) diapo = '1';
    var prive = 0; if($('#prive').is(':checked')) prive = 1;

    $.ajax({
        url: 'modules/gestion_articles/updateContenu_test.php',
        type: 'POST',
        data: 'id='+encodeURIComponent(id)
            + '&oldtitre='+encodeURIComponent(oldtitre)
            + '&titre='+encodeURIComponent(titre)
            + '&date='+encodeURIComponent(date)
            + '&contenu='+contenu
            + '&publie='+encodeURIComponent(publie)
            + '&diapo='+encodeURIComponent(diapo)
                            + '&prive='+encodeURIComponent(prive),

        success: function(result) {
            $('#result').html(result);
            $('#loadingImg').fadeOut(1000, function() {
                $(this).remove();
            });
        }
    });

    $('#oldtitre').attr('value',titre);

    return false;
});
  });

I already tried changing permissions in cpanel, it doesn't work. I renamed every htaccess file, it doesnt work.

Any help would be appreciated.

4

3 回答 3

1

问题终于解决了,是关于modsecurity的。技术人员告诉我,modsecurity 存在限制。如果您遇到同样的问题,请咨询您的提供商。

我在上面发布的代码现在可以完美运行。

于 2012-08-28T13:57:41.767 回答
0

您的问题是文件系统的权限。我假设您不是服务器管理员。

向您的服务器管理员发送一封电子邮件,说明正在发生的事情,他会查看并更改权限。

于 2012-07-12T19:18:17.187 回答
0

这是在黑暗中拍摄的,但是每当页面的服务器文件夹中缺少占位符文件时,我都会在我的 cms 上遇到类似的消息。像 index.php 什么的。

另一件事可能是添加

async: false,

到您的 ajax 调用,以确保它使用适当的数据运行。

于 2012-07-12T19:40:18.863 回答