Advertisement
Guest User

Untitled

a guest
May 3rd, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. ErrorDocument 403 /index.php/RESERVED.HTTP-STATUS-403.html
  2. ErrorDocument 404 /index.php/RESERVED.HTTP-STATUS-404.html
  3.  
  4. error_page 404 /RESERVED.HTTP-STATUS-404.html;
  5. error_page 403 /RESERVED.HTTP-STATUS-403.html;
  6.  
  7. location ~ ^/RESERVED.HTTP-STATUS-(403|404).html$ {
  8. rewrite ^/RESERVED.HTTP-STATUS-(403|404).html$ /index.php$0 last;
  9. }
  10.  
  11. /*Verifica se a função não esta disponível (versões anteriores ao php5.4)*/
  12. if (false === function_exists('http_response_code')) {
  13. /*Fallback para versões mais antigas que o PHP5.4*/
  14. function http_response_code($code = null)
  15. {
  16. static $currentStatus;
  17.  
  18. if ($code === null) {
  19. if ($currentStatus !== null) {
  20. return $currentStatus;
  21. }
  22.  
  23. $currentStatus = 200;
  24.  
  25. if (empty($_SERVER['PHP_SELF']) === false &&
  26. preg_match('#/RESERVED.HTTP-STATUS-(d{3}).html$#', $_SERVER['PHP_SELF'], $match) > 0)
  27. {
  28. $currentStatus = (int) $match[1];
  29. }
  30. } elseif (is_int($code) && headers_sent() === false) {
  31. header('X-PHP-Response-Code: ' . $code, true, $code);
  32. $currentStatus = $code;
  33. }
  34.  
  35. return $currentStatus;
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement