Advertisement
Guest User

Untitled

a guest
Apr 10th, 2016
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.61 KB | None | 0 0
  1. <?php
  2. set_time_limit(0);
  3. date_default_timezone_set('Australia/Melbourne');
  4. ini_set("display_errors", "on");
  5. error_reporting(E_ALL);
  6.  
  7. new core();
  8.  
  9. class core
  10. {
  11. public $userid, $configured = False, $mysql = Null, $config = False, $auth = False;
  12.  
  13. public function __construct()
  14. {
  15. session_start();
  16. $GLOBALS["core"] = &$this;
  17. $this->dir = __DIR__ . DIRECTORY_SEPARATOR;
  18. $this->root = str_replace(array('\', '/'), DIRECTORY_SEPARATOR, $_SERVER["DOCUMENT_ROOT"]) . DIRECTORY_SEPARATOR;
  19. $this->ds = DIRECTORY_SEPARATOR; /* Cause I get sick of typing "DIRECTORY_SEPARATOR" */
  20. $this->userip = isset($_SERVER["HTTP_CF_CONNECTING_IP"]) ? $_SERVER["HTTP_CF_CONNECTING_IP"] : $_SERVER["REMOTE_ADDR"];
  21. @include_once $this->dir . "_config.php";
  22. require_once $this->dir . "_pdo.php";
  23. $this->config = (object) array();
  24. if(isset($config))
  25. {
  26. $this->config = (object) $config;
  27. $this->mysql = new Database($this->config->sql->host, $this->config->sql->user, $this->config->sql->pass, $this->config->sql->name);
  28. if($this->mysql !== Null)
  29. {
  30. $config = $this->mysql->fetch_array("select * from `server` limit 0, 1;");
  31. if(!empty($config))
  32. {
  33. $this->config->bind_ip = $config[0]["server_ip"];
  34. $this->config->server_ip = $config[0]["connect_ip"];
  35. $this->config->server_pt = $config[0]["server_pt"];
  36. $this->config->server_domain = $config[0]['server_domain']";
  37. $this->config->verification = $config[0]['verification'] == 1 ? True : False;
  38. $this->config->starting_xats = $config[0]['starting_xats'];
  39. $this->config->starting_days = $config[0]['starting_days'];
  40. $this->config->max_per_ip = $config[0]['max_per_ip'];
  41. $this->config->max_total = $config[0]['max_total'];
  42. $this->config->spam_wait = 800;
  43. $this->config->staff = @(array) json_decode($config[0]['staff']);
  44. $this->config->pawns = @(array) json_decode($config[0]['pawns']);
  45. $this->configured = True;
  46. $this->auth = $this->auth();
  47.  
  48. }
  49. }
  50. }
  51. $this->page = isset($_GET["page"]) && is_string($_GET["page"]) ? strtolower($_GET["page"]) : "home";
  52. $this->parse_page();
  53. $this->pc = trim(ob_get_contents());
  54. $this->pc = utf8_encode($this->pc);
  55. ob_clean();
  56. }
  57.  
  58. public function auth()
  59. {
  60. if(empty($_SESSION) && empty($_COOKIE))
  61. {
  62. return False;
  63. }
  64. if(empty($_SESSION) && !empty($_COOKIE[md5($this->userip)]))
  65. {
  66. $cookie = explode(chr(0), $_COOKIE[md5($this->userip)]);
  67. $cookie = array_map(array($this->mysql, 'decrypt'), $cookie);
  68. if(count($cookie) == 2 && $cookie[0] != false && $cookie[1] != false)
  69. {
  70. $_SESSION["user"] = $cookie[0];
  71. $_SESSION["pass"] = $cookie[1];
  72. }
  73. }
  74. if(empty($_SESSION["user"]))
  75. {
  76. return false;
  77. }
  78. $user = $this->mysql->fetch_array("select * from `users` where `username`='{$this->mysql->sanatize($_SESSION["user"])}';");
  79. if(empty($user))
  80. {
  81. session_destroy();
  82. setcookie(md5($this->userip), null, time() - 86400);
  83. exit(header("Location: /ixat/home"));
  84. } else {
  85. $_SESSION["id"] = $this->userid = $user[0]["id"];
  86. }
  87. return isset($_SESSION["id"]) ? true : false;
  88. }
  89.  
  90. public function parse_page()
  91. {
  92. $this->pages = glob($this->root . "_pages" . $this->ds . "*.php");
  93. $this->pages = array_map(function($x)
  94. {
  95. return strtolower(substr($x, strrpos($x, DIRECTORY_SEPARATOR) + 1, -4));
  96. }, $this->pages);
  97. if(!in_array($this->page, $this->pages))
  98. {
  99. $embed = $this->getEmbed($this->page);
  100. if($embed !== false)
  101. {
  102. return print "<h2 class=\"nopadding nomargin\"> {$this->page} </h2> <hr class=\"nopadding nomargin\" /> <br /> <div class=\"center\">{$embed}</div>";
  103. } else {
  104. $this->page = "home";
  105. }
  106. }
  107. $core = &$this;
  108. require_once "{$this->root}ixat/_pages{$this->ds}{$this->page}.php";
  109. }
  110.  
  111. public function getEmbed($chat, $pass = false)
  112. {
  113. $chat = $this->mysql->fetch_array("select * from `chats` where `name`='{$this->mysql->sanatize($chat)}' or `id`='{$this->mysql->sanatize($chat)}';");
  114. if($pass !== false)
  115. {
  116. $pass = "&pass=" . urlencode($pass);
  117. }
  118. return empty($chat) ? false : "<div class=\"panel panel-default\"><div class=\"panel-heading\"><h3 class=\"panel-title\"><b><font color=\"black\">{$chat[0]["name"]}</font></b></h3></div><br /><div class=\"panel-body\"><embed id=\"XenoBox\" width=\"730\" height=\"490\" type=\"application/x-shockwave-flash\" quality=\"high\" src=\"http://{$_SERVER["SERVER_NAME"]}/static/static.php?c=chat.swf&d=flash&id={$chat[0]["id"]}&gn={$chat[0]["name"]}{$pass}\" flashvars=\"id={$chat[0]["id"]}&gn={$chat[0]["name"]}{$pass}\" wmode=\"transparent\"></div></div>";
  119. }
  120.  
  121. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement