Codeigniter安全抵消问题

时间:2015-02-27 12:18:09

标签: php codeigniter

我有一个非常简单的更新功能,我刚刚完成了这个功能,它没有与任何其他控制器或模型进行通信,每次调用此函数时我都会收到错误,

A PHP Error was encountered

Severity: Notice

Message: Undefined offset: 1

Filename: core/Security.php

Line Number: 543

A PHP Error was encountered

Severity: Notice

Message: Undefined offset: 2

Filename: core/Security.php

Line Number: 543

A PHP Error was encountered

Severity: Notice

Message: Undefined offset: 3

Filename: core/Security.php

Line Number: 543

我的应用程序上有所有其他类型的函数,这是唯一抛出此错误的函数

这是我对编辑的看法:

<div class="warper container-fluid">

<div class="page-header"><h1>Edit case study</h1></div>

<?php   echo validation_errors(); ?>   
<?php if (isset($success_msg)) {echo $success_msg;} ?>
<?php if (isset($error_msg)) {echo $error_msg;} ?>


<div class="row">

<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">Please fill the form below</div>
<div class="panel-body">

<form class="form-horizontal" action="<?php echo base_url() ?>admin/update_this_case" method="post" enctype="multipart/form-data">


    <div class="form-group">
      <label class="col-sm-2 control-label">Title</label>
      <div class="col-sm-7">
        <input type="text" class="form-control form-control-flat" placeholder="Title" name="case_study_title" value="<?php echo $edit_case_study->case_study_title; ?>">
      </div>
    </div>
    <hr class="dotted">


    <div class="form-group">
      <label class="col-sm-2 control-label">Active</label>
      <div class="col-sm-2">
        <select class="form-control chosen-select" data-placeholder="Please select one" name="case_study_active">
          <?php if($edit_case_study->case_study_active == '0') { ?> 

                 <option value="0" select="selected">No</option>
                <option value="0">No</option>

                <?php } else { ?>

                <option value="1" select="selected">Yes</option>
                <option value="0" >No</option>

               <?php } ?> 
        </select>
      </div>
    </div>

     <hr class="dotted">

    <div class="form-group">
      <label class="col-sm-2 control-label">Content</label>
      <div class="col-sm-7">
     <textarea class="wysihtml form-control" placeholder="Enter main content ..." style="height: 200px" name="case_study_content"><?php echo $edit_case_study->case_study_body; ?></textarea>
      </div>
    </div>

<div class="panel panel-default">
<div class="panel-heading">Current Image</div>
<div class="panel-body">
<div class="preview preview-md"><img src="<?php echo base_url(); ?>/uploads/<?php echo $edit_case_study->case_study_header_img; ?>"/></div>
</div>
</div>

     <hr class="dotted">
    <div class="form-group">
      <label class="col-sm-2 control-label">Image</label>
      <div class="col-sm-7">
       <input type="file" name="case_study_img" id="fileToUpload">
      </div>
    </div>


    <hr class="dotted">

      <div class="form-group">
      <label class="col-sm-2 control-label">Link</label>
      <div class="col-sm-7">
        <input type="text" class="form-control form-control-flat" placeholder="Add a link" name="case_study_link" value="<?php echo $edit_case_study->case_study_link; ?>">
      </div>
    </div>

     <hr class="dotted">

     <div class="form-group">
      <label class="col-sm-2 control-label">Video</label>
      <div class="col-sm-7">
        <input type="text" class="form-control form-control-flat" placeholder="Add a link" name="case_study_video" value="<?php echo $edit_case_study->case_study_video; ?>">
      </div>
    </div>

     <hr class="dotted">

     <input type="hidden" name="case_study_id" value="<?php echo $edit_case_study->case_study_id; ?>">

    <button type="submit" class="btn btn-purple pull-right" name="my_update_case">Submit</button>

</form>
</div>
</div>
</div>

</div>

</div>

这是我的控制器

public function update_this_case(){
        if (isset($_POST['my_update_case'])) {echo "Yes";}
    } // end of function

没有其他任何事情,我无法理解它。我找不到任何文档或类似的东西。你能帮忙吗?

////编辑///

我刚刚意识到,它在我的文本区域有问题,所以我创建了一个新内容并添加了一个内部没有链接的简单内容,我没有看到这个错误。这与我的帖子有关吗?

1 个答案:

答案 0 :(得分:0)

答案是在config.php中需要关闭XSS全局

我希望这可以帮助其他人解决同样的问题。

感谢大家的投入。