FRED™  3.0
FRED™: Framework for Rapid and Easy Development
Injection.php
Go to the documentation of this file.
1 <?php
2 
4 
5 class Injection extends \Rsi\Fred\Security\Check{
6 
7  public $chars = ['\'','"','<','>'];
8 
9  protected function arrayKeys($array){
10  $keys = null;
11  if(is_array($array)) foreach($array as $key => $value) $keys .= $key . $this->arrayKeys($value);
12  return $keys;
13  }
14 
15  public function check($expected = false){
16  $query =
17  urldecode($this->component('router')->pathInfo . ($_SERVER['QUERY_STRING'] ?? null)) .
18  $this->arrayKeys($_POST);
19  foreach($this->chars as $char) if(strpos($query,$char) !== false) return false;
20  return true;
21  }
22 
23 }
component($name)
Get a component (local or default).
Definition: Component.php:80