- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
codeigniter 的安全性中的一件事是检查 uri 是数字还是我们期望的东西!
这是代码:
$this->load->helper('form');
$this->load->library('pagination');
$config['permitted_uri_chars'] = '0-9';
$config['base_url'] = '/member/index';
$config['per_page'] = 5;
$config['num_links'] = 10;
$query_not_voted_rows = "SELECT p_id FROM photos WHERE p_id NOT IN (SELECT distinct p_id FROM p_votes where u_id = ".$this->session->userdata('u_id').")";
$config['total_rows'] = $this->db->query($query_not_voted_rows)->num_rows();
$config['full_tag_open'] = '<div id="pagination">';
$config['full_tag_close'] = '</div>';
$this->pagination->initialize($config);
if($this->uri->segment(3) == '')
{
$segment_url = 0;
}else{
$segment_url = $this->uri->segment(3);
}
$query_not_voted = "SELECT * FROM photos WHERE p_id NOT IN (SELECT distinct p_id FROM p_votes where u_id = ".$this->session->userdata('u_id').") LIMIT ".$segment_url.", ".$config['per_page'];
$segment_url
是 kdkdkdd 而不是数字!
最佳答案
这是我的简单解决方案:
if($this->uri->segment(3) == '')
{
$segment_url = 0;
}else{
if(!is_numeric($this->uri->segment(3))){
redirect('404');
}else{
$segment_url = $this->uri->segment(3);
}
}
关于php - 由于分页,Codeigniter 安全检查 uri 是否为数字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4540525/
晚上好, 在我启用我的网站之前,我显然想确保它是安全的(或尽可能安全)。 我有一个搜索表单,一个用户可以将条目上传到数据库的机会,我想仅此而已。 所以我只想检查我应该做些什么来保护事物。首先,我的数据
首先,我知道在空指针上调用方法是未定义的行为。我还知道,因为这不应该发生,所以编译器可以(并且确实)假定 this 始终为非空。 但在实际代码中,您有时会不小心这样做。通常,它没有不良影响,当然 th
按照我目前安排代码的方式,下一行将为各种托管对象上下文运行。一些获取的实体将具有“complededDate”,而其他实体将没有“completedDate”属性。 let task = retrie
codeigniter 的安全性中的一件事是检查 uri 是数字还是我们期望的东西! 这是代码: $this->load->helper('form'); $this->load->libra
在访问其 errorMessage 属性之前检查 jsonObject 是否未定义的最短语法是什么? var jsonObject = SomeMethodReturningAnObject(); i
现在我正在使用 j 安全检查和 md5 来验证我的 jsp 页面。我想在将密码存储到数据库之前加盐。由于在学校的访问受限,我无权创建触发器来注入(inject)一些盐。还有其他方法吗? 这是我的 Re
我的应用程序中有一个类似 ORM 的微型组件,用于处理基本更新/删除操作的查询生成,但我需要在查询级别建立一些安全性,因为主键是自动确定的(第二级肛门,如果你愿意的话)。 按照设计,每当我更新或删除一
我是一名优秀的程序员,十分优秀!