error.php 5.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?php
  2. // Include functions if not already included
  3. require_once('functions.php');
  4. // Upgrade environment
  5. upgradeCheck();
  6. // Lazyload settings
  7. $databaseConfig = configLazy('config/config.php');
  8. // Load USER
  9. require_once("user.php");
  10. $USER = new User("registration_callback");
  11. if(isset($_GET['error'])){
  12. $status = (isset($_GET['error'])?$_GET['error']:404);
  13. setcookie('lec', $status, time() + (5), "/", DOMAIN);
  14. http_response_code($status);
  15. header('Location: '.$_SERVER['PHP_SELF']);
  16. }
  17. if(!isset($_COOKIE['lec'])) {
  18. $status = '404';
  19. } else {
  20. $status = $_COOKIE['lec'];
  21. }
  22. // Create Database Connection
  23. $file_db = new PDO('sqlite:'.DATABASE_LOCATION.'users.db');
  24. $file_db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  25. // Some PHP config stuff
  26. ini_set("display_errors", 1);
  27. ini_set("error_reporting", E_ALL | E_STRICT);
  28. //Color stuff
  29. foreach(loadAppearance() as $key => $value) {
  30. $$key = $value;
  31. }
  32. //error stuff
  33. $requested = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
  34. $codes = array(
  35. 400 => array('Bad Request', 'The server cannot or will not process the request due to an apparent client error.', 'sowwy'),
  36. 401 => array('Unauthorized', 'You do not have access to this page.', 'sowwy'),
  37. 403 => array('Forbidden', 'The server has refused to fulfill your request.', 'sowwy'),
  38. 404 => array('Not Found', $requested . ' was not found on this server.', 'confused'),
  39. 405 => array('Method Not Allowed', 'The method specified in the Request-Line is not allowed for the specified resource.', 'confused'),
  40. 408 => array('Request Timeout', 'Your browser failed to send a request in the time allowed by the server.', 'sowwy'),
  41. 500 => array('Internal Server Error', 'The request was unsuccessful due to an unexpected condition encountered by the server.', 'confused'),
  42. 502 => array('Bad Gateway', 'The server received an invalid response from the upstream server while trying to fulfill the request.', 'confused'),
  43. 503 => array('Service Unavailable', 'The server is currently unavailable (because it is overloaded or down for maintenance).', 'confused'),
  44. 504 => array('Gateway Timeout', 'The upstream server failed to send a request in the time allowed by the server.', 'confused'),
  45. 999 => array('Not Logged In', 'You need to be logged in to access this page.', 'confused'),
  46. );
  47. $errorTitle = ($codes[$status][0]) ? $codes[$status][0] : "Error";
  48. $message = ($codes[$status][1]) ? $codes[$status][1] : "An Error Occured";
  49. $errorImage = ($codes[$status][2]) ? $codes[$status][2] : "confused";
  50. ?>
  51. <!DOCTYPE html>
  52. <html lang="en" class="no-js">
  53. <head>
  54. <meta charset="UTF-8">
  55. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  56. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  57. <meta name="msapplication-tap-highlight" content="no" />
  58. <title><?=$errorTitle;?></title>
  59. <link rel="stylesheet" href="<?php echo checkRootPath(dirname($_SERVER['SCRIPT_NAME'])); ?>bower_components/font-awesome/css/font-awesome.min.css?v=<?php echo INSTALLEDVERSION; ?>">
  60. <link rel="stylesheet" href="<?php echo checkRootPath(dirname($_SERVER['SCRIPT_NAME'])); ?>bower_components/bootstrap/dist/css/bootstrap.min.css?v=<?php echo INSTALLEDVERSION; ?>">
  61. <link rel="stylesheet" href="<?php echo checkRootPath(dirname($_SERVER['SCRIPT_NAME'])); ?>bower_components/Waves/dist/waves.min.css">
  62. <link rel="stylesheet" href="<?php echo checkRootPath(dirname($_SERVER['SCRIPT_NAME'])); ?>css/style.css?v=<?php echo INSTALLEDVERSION; ?>">
  63. <style><?php customCSS(); ?></style>
  64. </head>
  65. <body id="body-error" class="gray-bg" style="padding: 0;">
  66. <div class="main-wrapper" style="position: initial;">
  67. <div style="margin:0 20px; overflow:hidden">
  68. <div class="table-wrapper" style="background:<?=$sidebar;?>;">
  69. <div class="table-row">
  70. <div class="table-cell text-center">
  71. <div class="pagenotfound i-block">
  72. <div class="content-box">
  73. <div class="top" style="background:<?=$topbar;?>;">
  74. <h1 class="zero-m" style="color:<?=$topbartext;?>;"><?=$status;?></h1>
  75. <a href="#" onclick="parent.location='../'" class="fa-stack fa-2x icon-back">
  76. <i class="fa fa-circle fa-stack-2x" style="color:<?=$topbartext;?>;"></i>
  77. <i class="fa fa-long-arrow-left fa-stack-1x fa-inverse" style="color:<?=$topbar;?>;"></i>
  78. </a>
  79. </div>
  80. <div class="big-box">
  81. <h4 style="color: <?=$topbar;?>;"><?=$errorTitle;?></h4>
  82. <p style="color: <?=$topbar;?>;"><?php echo $message;?></p>
  83. </div>
  84. </div>
  85. </div>
  86. </div>
  87. </div>
  88. </div>
  89. </div>
  90. </div>
  91. </body>
  92. </html>