├── .gitmodules ├── test_nasty_strings.php ├── composer.json ├── sqlinjection.php ├── README.md ├── LICENSE └── lib └── jblond └── xss_filter.class.php /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "teststrings"] 2 | path = teststrings 3 | url = https://github.com/minimaxir/big-list-of-naughty-strings.git 4 | -------------------------------------------------------------------------------- /test_nasty_strings.php: -------------------------------------------------------------------------------- 1 | filter_it($test_line) . '
' ."\n"; 13 | } 14 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jblond/php-xss-filter", 3 | "description": "PHP XSS Filter", 4 | "license": "MIT", 5 | "keywords": [ 6 | "php", 7 | "xss" 8 | ], 9 | "authors": [ 10 | { 11 | "name": "JBlond", 12 | "email": "leet31337@web.de" 13 | } 14 | ], 15 | "require": { 16 | "php" : ">= 5.6" 17 | 18 | }, 19 | "require-dev": { 20 | "ext-mysqli": "*" 21 | }, 22 | "autoload": { 23 | "psr-4": { 24 | "jblond\\": "lib/jblond" 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /sqlinjection.php: -------------------------------------------------------------------------------- 1 | filter_it($string) . '


'; 10 | 11 | $mysqli = new \mysqli("localhost", "root", "", "mysql"); 12 | 13 | /* check connection */ 14 | if (mysqli_connect_errno()) { 15 | printf("Connect failed: %s\n", mysqli_connect_error()); 16 | } 17 | else 18 | { 19 | echo $mysqli->real_escape_string($string); 20 | } 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Code Climate](https://codeclimate.com/github/JBlond/PHP-XSS-Filter/badges/gpa.svg)](https://codeclimate.com/github/JBlond/PHP-XSS-Filter) [![SensioLabsInsight](https://insight.sensiolabs.com/projects/bf1c2ba8-b292-49de-bebc-93e39344a169/mini.png)](https://insight.sensiolabs.com/projects/bf1c2ba8-b292-49de-bebc-93e39344a169) [![Codacy Badge](https://api.codacy.com/project/badge/grade/a345b27631f240779f8b016abec85460)](https://www.codacy.com/app/leet31337/PHP-XSS-Filter) 2 | 3 | # PHP-XSS-Filter 4 | 5 | ## Install 6 | 7 | ```BASH 8 | composer require jblond/php-xss-filter 9 | ``` 10 | 11 | ## Example 12 | ```PHP 13 | require './xss_filter.class.php'; 14 | $xss = new xss_filter(); 15 | $string = '