12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <?
- /**
- * Browser Integrity Check
- */
- class BIC {
- /**
- * Browser Integrity Check challenge
- */
- public static function challenge() {
- if (FEATURE_BIC) {
- session_start();
- if (!isset($_SESSION['_authorized'])) {
- if (isset($_POST['_authorized'])) {
- if (hash("sha512", substr(time(), 0, 9) . $_SERVER['HTTP_USER_AGENT'] . BIC_KEY) != $_POST['_authorized']) {
- error(400);
- } else {
- $_SESSION['_authorized'] = '';
- }
- } else {
- header("Cache-Control: no-store, no-cache, must-revalidate");
- header("Expires: off"); ?><html>
- <head><title>Browser Integrity Check</title>
- <style type="text/css">
- html, body {
- width: 100%;
- height: 100%;
- margin: 0;
- padding: 0;
- }
-
- body {
- background-color: #ffffff;
- font-family: Helvetica, Arial, sans-serif;
- font-size: 100%;
- }
- </style>
- </head>
- <body>
- <table width="100%" height="100%" cellpadding="20">
- <tr>
- <td align="center" valign="middle">
- <img src="<?= STATIC_SERVER ?>common/bic_flag.gif?v=<?= filemtime(SERVER_ROOT . '/static/common/bic_flag.gif') ?>"/>
- <h1>Browser Integrity Check</h1>
- <p>Please wait 3 seconds, the page will auto refresh.</p>
- <noscript><p>JavaScript is disabled, cannot continue. Please make sure your browser is
- supporting Cookies, JavaScript and POST.</p></noscript>
- </td>
- </tr>
- </table>
- <form method="post">
- <button type="submit" name="_authorized" style="display: none" id="_authorized"
- value="<?= hash("sha512", substr(time(), 0, 9) . $_SERVER['HTTP_USER_AGENT'] . BIC_KEY) ?>"></button>
- </form>
- <script>setTimeout(function () {
- document.getElementById("_authorized").click()
- }, 3000)</script>
- </body>
- </html>
- <? die();
- }
- }
- }
- }
- }
|