| Conditions | 3 |
| Paths | 2 |
| Total Lines | 25 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 14 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | 5 | public function session_valid() |
|
| 15 | { |
||
| 16 | 5 | $ip_address = $_SERVER['REMOTE_ADDR']; |
|
| 17 | 5 | $user_agent = $_SERVER['HTTP_USER_AGENT']; |
|
| 18 | |||
| 19 | $ip_blacklist = [ |
||
| 20 | 5 | '0.0.0.0', |
|
| 21 | '127.0.0.1' |
||
| 22 | 5 | ]; |
|
| 23 | |||
| 24 | $ua_blacklist = [ |
||
| 25 | 5 | 'false', |
|
| 26 | 5 | FALSE, |
|
| 27 | 5 | '', |
|
| 28 | 'PHPUnit' |
||
| 29 | 5 | ]; |
|
| 30 | |||
| 31 | 5 | if (in_array($ip_address, $ip_blacklist) || in_array($user_agent, $ua_blacklist)) |
|
| 32 | 5 | { |
|
| 33 | 4 | $this->sess_destroy(); |
|
| 34 | 4 | return FALSE; |
|
| 35 | } |
||
| 36 | |||
| 37 | 1 | return TRUE; |
|
| 38 | } |
||
| 39 | |||
| 81 | /* Location: ./application/libraries/MY_Session.php */ |