error.php 4.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. // Create Database Connection
  12. $file_db = new PDO('sqlite:'.DATABASE_LOCATION.'users.db');
  13. $file_db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  14. // Some PHP config stuff
  15. ini_set("display_errors", 1);
  16. ini_set("error_reporting", E_ALL | E_STRICT);
  17. // Load User List
  18. $gotUsers = $file_db->query('SELECT * FROM users');
  19. // Load Colours/Appearance
  20. foreach(loadAppearance() as $key => $value) {
  21. $$key = $value;
  22. }
  23. $requested = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
  24. $status = (isset($_GET['error'])?$_GET['error']:404);
  25. $codes = array(
  26. 400 => array('Bad Request', 'The server cannot or will not process the request due to an apparent client error.', 'sowwy'),
  27. 401 => array('Unauthorized', 'You do not have access to this page.', 'sowwy'),
  28. 403 => array('Forbidden', 'The server has refused to fulfill your request.', 'sowwy'),
  29. 404 => array('Not Found', $requested . ' was not found on this server.', 'confused'),
  30. 405 => array('Method Not Allowed', 'The method specified in the Request-Line is not allowed for the specified resource.', 'confused'),
  31. 408 => array('Request Timeout', 'Your browser failed to send a request in the time allowed by the server.', 'sowwy'),
  32. 500 => array('Internal Server Error', 'The request was unsuccessful due to an unexpected condition encountered by the server.', 'confused'),
  33. 502 => array('Bad Gateway', 'The server received an invalid response from the upstream server while trying to fulfill the request.', 'confused'),
  34. 503 => array('Service Unavailable', 'The server is currently unavailable (because it is overloaded or down for maintenance).', 'confused'),
  35. 504 => array('Gateway Timeout', 'The upstream server failed to send a request in the time allowed by the server.', 'confused'),
  36. 999 => array('Not Logged In', 'You need to be logged in to access this page.', 'confused'),
  37. );
  38. $errorTitle = $codes[$status][0];
  39. $message = $codes[$status][1];
  40. $errorImage = $codes[$status][2];
  41. ?>
  42. <!DOCTYPE html>
  43. <html lang="en" class="no-js">
  44. <head>
  45. <meta charset="UTF-8">
  46. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  47. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  48. <meta name="msapplication-tap-highlight" content="no" />
  49. <title><?=$errorTitle;?></title>
  50. <link rel="stylesheet" href="<?php echo dirname($_SERVER['SCRIPT_NAME']); ?>/bower_components/bootstrap/dist/css/bootstrap.min.css">
  51. <link rel="stylesheet" href="<?php echo dirname($_SERVER['SCRIPT_NAME']); ?>/bower_components/Waves/dist/waves.min.css">
  52. <link rel="stylesheet" href="<?php echo dirname($_SERVER['SCRIPT_NAME']); ?>/css/style.css">
  53. </head>
  54. <body class="gray-bg" style="padding: 0;">
  55. <div class="main-wrapper" style="position: initial;">
  56. <div style="margin:0 20px; overflow:hidden">
  57. <div class="table-wrapper" style="background:<?=$sidebar;?>;">
  58. <div class="table-row">
  59. <div class="table-cell text-center">
  60. <div class="login i-block">
  61. <div class="content-box">
  62. <div class="biggest-box" style="background:<?=$topbar;?>;">
  63. <h1 class="zero-m text-uppercase" style="color:<?=$topbartext;?>; font-size: 40px;"><?=$errorTitle;?></h1>
  64. </div>
  65. <div class="big-box text-left">
  66. <center><img src="images/<?=$errorImage;?>.png" style="height: 200px;"></center>
  67. <h4 style="color: <?=$topbar;?>;" class="text-center"><?php echo $message;?></h4>
  68. <button style="background:<?=$topbar;?>;" onclick="window.history.back();" type="button" class="btn log-in btn-block btn-primary text-uppercase waves waves-effect waves-float"><text style="color:<?=$topbartext;?>;"><?php echo $language->translate("GO_BACK");?></text></button>
  69. </div>
  70. </div>
  71. </div>
  72. </div>
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. </body>
  78. </html>