| Conditions | 6 |
| Paths | 5 |
| Total Lines | 28 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | public function close() |
||
| 16 | { |
||
| 17 | # STANDARD VALIDATIONS [check method] |
||
| 18 | if (!$this->isGet()) |
||
| 19 | { |
||
| 20 | $http = new Http(); |
||
| 21 | $http->writeStatus($http::HTTP_METHOD_NOT_ALLOWED); |
||
| 22 | |||
| 23 | die('Error ' . $http::HTTP_METHOD_NOT_ALLOWED .' (' . $http->getStatusText($http::HTTP_METHOD_NOT_ALLOWED) . ')!!'); |
||
|
|
|||
| 24 | } |
||
| 25 | |||
| 26 | $config = include 'module/Auth/config/user.config.php'; |
||
| 27 | $method = $config["authentication"]["method"]; |
||
| 28 | $key = $config["authentication"]["key"]; |
||
| 29 | |||
| 30 | switch ($method) |
||
| 31 | { |
||
| 32 | case '_COOKIE': |
||
| 33 | if (array_key_exists($key, $_COOKIE) || !empty($_COOKIE[$key])) |
||
| 34 | setcookie($key, $_COOKIE[$key], time() - 1, '/'); |
||
| 35 | break; |
||
| 36 | |||
| 37 | case '_SESSION': |
||
| 38 | session_destroy(); |
||
| 39 | break; |
||
| 40 | } |
||
| 41 | |||
| 42 | header("location: " . $this->getBasePath() . "/public/Auth"); |
||
| 43 | } |
||
| 44 | } |
In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.