Php codeigniter$此->;后->;输入未过帐完整值
我有一个用于上传嵌入代码的文本区域。当我发布嵌入代码时,它不是发布完整代码。 这是我的嵌入代码Php codeigniter$此->;后->;输入未过帐完整值,php,codeigniter,Php,Codeigniter,我有一个用于上传嵌入代码的文本区域。当我发布嵌入代码时,它不是发布完整代码。 这是我的嵌入代码 <iframe frameborder="0" width="480" height="308" src="http://www.dailymotion.com/embed/video/xt7dgo?autoplay=0&logo=0&hideInfos=1&start=0&syndication=108944&foreground=%23F7FFFD&a
<iframe frameborder="0" width="480" height="308" src="http://www.dailymotion.com/embed/video/xt7dgo?autoplay=0&logo=0&hideInfos=1&start=0&syndication=108944&foreground=%23F7FFFD&highlight=%23FFC300&background=%23171D1B"></iframe>
这是我的php代码
public function embeded(){
$this->form_validation->set_rules('video_heading', 'Video heading', 'required|trim|xss_clean');
$this->form_validation->set_rules('embeded', 'Embeded code', 'required|trim|xss_clean');
$this->load->model('videos');
$error['error']="";
if ($this->form_validation->run() == FALSE)
{
$error['error']= validation_errors();
$this->load->view('sidebar');
$this->load->view('addvideo', $error);
$this->load->view('footer');
}else{
//<iframe width="420" height="315" src="http://www.youtube.com/embed/Niiyh3sxwYk" frameborder="0" allowfullscreen></iframe>
$plink=$this->videos->processlink($this->input->post('embeded'));
$info = array('heading'=>$this->input->post('video_heading'),
'status'=>$this->input->post('status'),'video'=>$plink,
'comment'=>$this->input->post('comment'),'category'=>$this->input->post('category'));
$this->load->model('videos');
$obj= (object)$info;
echo "opsted_link".str_replace("syndication","syndicate", $_POST['embeded']);
if(isset($_POST['embeded']))
{
echo $_POST['embeded'];exit;
}
//$this->videos->addembededvideo($obj);
}
}
嵌入的公共函数(){
$this->form_validation->set_规则('video_heading','video heading','required | trim | xss_clean');
$this->form_validation->set_规则('embedded','embedded code','required | trim | xss_clean');
$this->load->model('videos');
$error['error']=“”;
如果($this->form\u validation->run()==FALSE)
{
$error['error']=验证错误();
$this->load->view('sidebar');
$this->load->view('addvideo',$error);
$this->load->view('footer');
}否则{
//
$plink=$this->videos->processlink($this->input->post('embedded'));
$info=array('heading'=>$this->input->post('video\u heading'),
“状态”=>this->input->post('status'),“视频”=>plink,
'comment'=>$this->input->post('comment'),'category'=>$this->input->post('category');
$this->load->model('videos');
$obj=(对象)$info;
echo“optsted_link”。str_替换(“辛迪加”、“辛迪加”、“嵌入的”$);
如果(isset($_POST['embedded']))
{
echo$_POST['embedded'];退出;
}
//$this->videos->addembeddedvideo($obj);
}
}
当我使用它时,我得到的帧代码部分是这样的
<iframe frameborder="0" width="480" height="308" src="http://www.dailymotion.com/embed/video/xt7dgo?autoplay=0&logo=0&hideInfos=1&start=0&syndicati></iframe>
我做了类似的事情
<iframe frameborder="0" width="480" height="308" src="http://www.dailymotion.com/embed/video/xt7dgo?autoplay=0&logo=0&hideInfos=1&start=0&syndicati></iframe>
这是我的控制器中的方法:
function framex()
{
$this->load->helper('form');
if(isset($_POST['frame']))
{
echo $_POST['frame'];exit;
}
$this->load->view('deneme');
}
这是查看页面:
<?php
echo form_open('deneme/framex');
?>
<textarea name="frame"></textarea>
<?php
echo form_submit('submit','Submit');
echo form_close();
?>
成功了 您的输入有可能会被XSS筛选器所捕获。这正是XSS过滤器的设计目的;保护您的站点免受跨站点脚本攻击。尝试删除要测试的xss_clean
规则,但请注意,不要将其投入生产
我的建议是只通过HTTP发送视频ID(以您的形式)。在这个特定的dailymotion视频中,您可以找到ID:xt7dgo
。它实际上是
标记中唯一重要的信息
其他属性包括自动播放、徽标(打开或关闭)、hideInfo(打开或关闭)、开始。。。等等。所有这些属性都可以在服务器上重新创建。使用服务器回显
标签+提交的id+所有其他属性。在系统/core/Security.php
的第607行或第2行中,存在缺陷xss_clean
正在调用它
$evil_attributes = array('on\w*', 'style', 'xmlns', 'formaction');
我甚至不知道是不是虫子。他们基本上是试图提供安全防范措施
// All javascript event handlers (e.g. onload, onclick, onmouseover), style, and xmlns
所以,我想你不得不接受它。或者,您可以将“syndication”更改为“syndicator”(就像您现在所做的那样),并在xss|u clean
之后将其转换回syndication。谢谢,这是因为这行代码$this->form|u validation->set_rules('embedded',embedded code',required | trim | xs u clean');我移除了xss_clean,现在可以正常工作了