<?php class Params { public $get = array(); public $post = array(); function __construct() { if (!empty($_GET)) { foreach ($_GET as $key => $val) { if (is_numeric($val)) { $this->get[$key] = $this->getInt($val); } else { $this->get[$key] = $this->getStr($val); } } } if (!empty($_POST)) { foreach ($_POST as $key => $val) { if (is_numeric($val)) { $this->post[$key] = $this->getInt($val); } else { $this->post[$key] = $this->getStr($val); } } } }
This is a PHP security library that uses prepared statements and parameterized queries. SQL statements with any parameters will be sent to the database server and parsed! It is impossible for an attacker to maliciously inject SQL!
All resources on this site are contributed by netizens or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this site are for learning reference only. Please do not use them for commercial purposes. Otherwise, you will be responsible for all consequences! If there is any infringement, please contact us to delete it. Contact information: admin@php.cn
Related Article
13Jul2016
PHP anti-injection configuration and PHP anti-injection code. There are two types of anti-injection in php. One is sql anti-injection. The other is a process like many cms. All the variables are submitted. The other is to configure php.ini directly. I will tell you respectively below.
25Jul2016
PHP anti-sql injection class (php pdo prevents sql injection class)
21Jul2016
PHP anti-injection security code. Brief description: /**************************** Description: Determine whether the passed variables contain illegal characters such as $_POST, $_GET Function: Anti-injection ******************************/ Copy the code code as follows
13Jul2016
PHP anti-injection security implementation code. I have talked about a lot of SQL injection prevention codes before, but we still have to start with our server script. Let’s talk about some common methods of preventing injection in PHP. You can refer to it.
20Feb2017
Session Injection A similar problem to session exposure is session injection. This type of attack is based on your WEB server not only having read permissions to the session storage directory, but also having write permissions. Therefore, it is possible to write a paragraph that allows other users to add...
Hot Tools
PHP library for dependency injection containers
PHP library for dependency injection containers
A collection of 50 excellent classic PHP algorithms
Classic PHP algorithm, learn excellent ideas and expand your thinking
Small PHP library for optimizing images
Small PHP library for optimizing images