FRED™  3.0
FRED™: Framework for Rapid and Easy Development
UserAgent.php
Go to the documentation of this file.
1 <?php
2 
4 
5 class UserAgent extends \Rsi\Fred\Security\Check{
6 
7  public $illegal = ['<script','{','}']; //!< Array containing illegal characters / snippets (reg-ex).
8 
9  public function check($expected = false){
10  $user_agent = preg_replace('/\\d+/','*',$this->component('client')->userAgent);
11  if(preg_match('/(' . implode('|',$this->illegal) . ')/i',$user_agent)) return false;
12  $orig = $this->session->userAgent;
13  if($orig !== null) return $user_agent === $orig;
14  $this->session->userAgent = $user_agent;
15  return true;
16  }
17 
18 }
$illegal
Array containing illegal characters / snippets (reg-ex).
Definition: UserAgent.php:7
component($name)
Get a component (local or default).
Definition: Component.php:80