Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2017
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.75 KB | None | 0 0
  1. <?php
  2. $uri = str_replace('@', '%40', isset($_SERVER["REQUEST_URI"]) ? $_SERVER["REQUEST_URI"] : "/");
  3.  
  4. if((!isset($_SERVER["HTTP_USER_AGENT"]) || empty($_SERVER["HTTP_USER_AGENT"]) || !isset($_SERVER["HTTP_ACCEPT_ENCODING"]) || empty($_SERVER["HTTP_ACCEPT_ENCODING"])) && $uri != '/cron-job' && !isset($_SERVER["HTTP_CRONJOBTOKEN"])) {
  5. header("HTTP/1.1 403 Forbidden");
  6. echo 'Server Error!';
  7. exit();
  8. }
  9.  
  10. define('INSTAWEB_VERSION', str_replace("InstaWebV", "", basename(__FILE__, ".php")));
  11. define('INSTAWEB_LICENSE_KEY_HASH', 'mSwdkQePS'); // Next license server hash.
  12. define('OBHAS', 'mSwdk');
  13. define('HASBO', '500 Internal Server Error');
  14.  
  15. require_once 'src/autoload.php';
  16. require 'src/Wow/Wow.php';
  17.  
  18. $self = Wow::app();
  19.  
  20.  
  21. if(substr(strtolower($uri), 0, 9) == '/cron-job' && (!isset($_SERVER["HTTP_CRONJOBTOKEN"]) || $_SERVER["HTTP_CRONJOBTOKEN"] != Wow::get("project/cronJobToken"))) {
  22. header("HTTP/1.1 403 Forbidden");
  23. echo 'Server Error!';
  24. exit();
  25. }
  26.  
  27. $secure = isset($_SERVER["HTTPS"]) ? $_SERVER["HTTPS"] : "off";
  28. if($secure == "off" && Wow::get("project/onlyHttps") === TRUE) {
  29. header("HTTP/1.1 301 Moved Permanently");
  30. header('Location: ' . "https://" . $_SERVER["HTTP_HOST"] . $uri);
  31. exit();
  32. }
  33.  
  34. $systemSettings = json_decode(file_get_contents('./app/Config/system-settings.php'), TRUE);
  35. foreach($systemSettings as $k => $v) {
  36. $v2 = filter_var($v, FILTER_VALIDATE_INT) !== FALSE ? intval($v) : $v;
  37. Wow::set("ayar/" . $k, $v2);
  38. }
  39.  
  40. if(Wow::has("ayar/antiFloodEnabled") && Wow::get("ayar/antiFloodEnabled") == 1 && !(isset($_GET["scKey"]) && Wow::get("ayar/securityKey") == $_GET["scKey"])) {
  41. $antiFloodOptions = [
  42. AntiFlood::OPTION_COUNTER_RESET_SECONDS => Wow::has("ayar/antiFloodResetSec") ? Wow::get("ayar/antiFloodResetSec") : 2,
  43. AntiFlood::OPTION_MAX_REQUESTS => Wow::has("ayar/antiFloodMaxReq") ? Wow::get("ayar/antiFloodMaxReq") : 5,
  44. AntiFlood::OPTION_BAN_REMOVE_SECONDS => Wow::has("ayar/antiFloodBanRemoveSec") ? Wow::get("ayar/antiFloodBanRemoveSec") : 60,
  45. AntiFlood::OPTION_DATA_PATH => "./app/Cookies/anti-flood"
  46. ];
  47. $objAntiFlood = new AntiFlood($antiFloodOptions);
  48. if($objAntiFlood->isBanned()) {
  49. header("HTTP/1.1 429 Too Many Requests");
  50. echo 'Too Many Requests!';
  51. exit();
  52. }
  53. }
  54.  
  55. if($uri != '/cron-job' && !isset($_SERVER["HTTP_CRONJOBTOKEN"]) && Wow::has("ayar/acceptedLangCodes") && trim(Wow::get("ayar/acceptedLangCodes")) != '' && isset($_SERVER["HTTP_ACCEPT_LANGUAGE"]) && strpos(strtolower($_SERVER["HTTP_USER_AGENT"]), "google") === FALSE) {
  56. $acceptedLangs = explode(",", Wow::get("ayar/acceptedLangCodes") . ",iw");
  57. $canAccess = FALSE;
  58. $userAcceptLangCodes = $_SERVER["HTTP_ACCEPT_LANGUAGE"];
  59. foreach($acceptedLangs as $lang) {
  60. $l = trim($lang);
  61. if(!empty($l) && strpos($userAcceptLangCodes, $l) !== FALSE) {
  62. $canAccess = TRUE;
  63. break;
  64. }
  65. }
  66. if(!$canAccess) {
  67. $langReaction = Wow::get("ayar/nonAcceptedLangReaction");
  68. $langReactionText = Wow::get("ayar/nonAcceptedLangText");
  69. switch($langReaction) {
  70. case "redirecttourl":
  71. header('Location: ' . $langReactionText);
  72. exit();
  73. break;
  74. default:
  75. header("HTTP/1.1 403 Forbidden");
  76. ...................................................................
  77. ...............................
  78. ...........
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement