Advertisement
Guest User

Symb V1 - Symbiant 2014

a guest
Sep 19th, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 33.87 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4.     $symb = new Symb;
  5.     echo "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'><script src='http://code.jquery.com/jquery-1.11.0.min.js'></script><script src='http://code.jquery.com/jquery-migrate-1.2.1.min.js'></script>";
  6.     $showWiki = true;
  7.     // Symb
  8.     class Symb {
  9.         /* ----Config Section---- */
  10.         /* Configurable */
  11.  
  12.         /* SQL Database */
  13.         public $sql_user = ""; // SQL Database USER
  14.         public $sql_pass = ""; // SQL Database PASSWORD
  15.         public $sql_host = ""; // SQL Database HOST
  16.         public $sql_datb = ""; // SQL Database DATABASE
  17.         public $owner = array("213.195.209.14"); // Your IP, if have different IPs add them here
  18.         public $owner_email = "ares75@email.cz";
  19.         public $enableLogs = true;
  20.         public $enableGlobalBan = true;
  21.         public $enableAccounts = true;
  22.  
  23.         public $debugLog = array();
  24.         public $version = "2.0"; // Please don't change
  25.  
  26.  
  27.         /* SQL Tables */
  28.         public $sql_table_prefix = "symbengine_";
  29.         public $sql_table_account = "account";
  30.         public $sql_table_info = "info";
  31.         public $sql_table_cache = "cache";
  32.         public $sql_table_logs = "logs";
  33.         public $sql_table_bans = "bans";
  34.  
  35.  
  36.  
  37.         /* Static */
  38.         private $isOwner = false;
  39.         private $globalKey = "";
  40.  
  41.  
  42.         public function __construct() {
  43.             // OnStart function
  44.  
  45.             if($_SERVER["REMOTE_ADDR"] == $this->owner) $this->isOwner = true;
  46.  
  47.                 $this->tables_check();
  48.                 $this->log();
  49.  
  50.  
  51.                 $r = $this->isBanned($_SERVER["REMOTE_ADDR"]);
  52.                 if(!empty($r)) die("You are banned<br>Reason: $r");
  53.  
  54.                 if($this->enableGlobalBan) {
  55.                     $addr = "http://games.symbiant.cz/projects/symb/public/globalban.php?globalKey=" . $this->globalKey . "&t=s&ip=" . $_SERVER["REMOTE_ADDR"];
  56.                     $content = file_get_contents($addr);
  57.  
  58.                     if(!empty($content)) {
  59.  
  60.                         die("We're sorry but you were globally banned!<br>Reason: <b>" . $content . "</b>");
  61.  
  62.                     }
  63.                 }
  64.         }
  65.  
  66.         public function Locale($x = "", $str1 = "", $str2 = "") {
  67.  
  68.             // Locale
  69.  
  70.         }
  71.  
  72.         function browser() {
  73.             $ExactBrowserNameUA=$_SERVER['HTTP_USER_AGENT'];
  74.             If (strpos(strtolower($ExactBrowserNameUA), "safari/") and strpos(strtolower($ExactBrowserNameUA), "opr/")) {
  75.                 // OPERA
  76.                 $ExactBrowserNameBR="Opera";
  77.             } ElseIf (strpos(strtolower($ExactBrowserNameUA), "safari/") and strpos(strtolower($ExactBrowserNameUA), "chrome/")) {
  78.                 // CHROME
  79.                 $ExactBrowserNameBR="Chrome";
  80.             } ElseIf (strpos(strtolower($ExactBrowserNameUA), "msie")) {
  81.                 // INTERNET EXPLORER
  82.                 $ExactBrowserNameBR="Internet Explorer";
  83.             } ElseIf (strpos(strtolower($ExactBrowserNameUA), "firefox/")) {
  84.                 // FIREFOX
  85.                 $ExactBrowserNameBR="Firefox";
  86.             } ElseIf (strpos(strtolower($ExactBrowserNameUA), "safari/") and strpos(strtolower($ExactBrowserNameUA), "opr/")==false and strpos(strtolower($ExactBrowserNameUA), "chrome/")==false) {
  87.                 // SAFARI
  88.                 $ExactBrowserNameBR="Safari";
  89.             } Else {
  90.                 // OUT OF DATA
  91.                 $ExactBrowserNameBR="OUT OF DATA";
  92.             };
  93.             return $ExactBrowserNameBR;
  94.         }
  95.  
  96.         public function id($includeUsername = "true", $username = "unknown", $includePort = "false", $includeBrowser = "true", $includeIP = "true") {
  97.             $symb_IP = "";
  98.             $symb_PORT = "";
  99.             $symb_NAME = "";
  100.             $symb_BROWSER = "";
  101.             if($includeIP == "true") {
  102.                 $symb_IP = $_SERVER["REMOTE_ADDR"];
  103.                 // Remove dots
  104.                 $symb_IPfix = explode(".",$symb_IP);
  105.                 $symb_IPnum = 0;
  106.                 while($symb_IPnum < count($symb_IPfix)) {
  107.                     if($symb_IPnum == 0) {
  108.                       $symb_IP = $symb_IPfix[$symb_IPnum];
  109.                       $symb_IP = $symb_IP . "symbHash";
  110.                     }
  111.                     else {
  112.                       $symb_IP = $symb_IP . $symb_IPfix[$symb_IPnum];
  113.                     }
  114.                     $symb_IPnum++;
  115.                 }
  116.               $symb_IP = "Symb" . $symb_IP . "#ash";
  117.             }
  118.             if($includePort == "true") $symb_PORT = $_SERVER["REMOTE_PORT"];
  119.             if($includeUsername == "true") $symb_NAME = $username;
  120.             if($includeBrowser == "true") $symb_BROWSER = $this->browser();
  121.             // Generate SYMB
  122.             $symb = $symb_IP . $symb_PORT . $symb_NAME . $symb_BROWSER;
  123.             return $symb;
  124.  
  125.         }
  126.  
  127.         public function error($message = "null", $hidden = "false") {
  128.           if(empty($symbengine_warNums)) $symbengine_warNums = 1;
  129.             $style = "<style>
  130.              .symb_error" . $symbengine_warNums . " {
  131.                  color: red;
  132.                  font-family: Arial;
  133.              }
  134.              .symb_error" . $symbengine_warNums . " a,a:hover,a:visited {
  135.                  color: red;
  136.                  font-family: Arial;
  137.              }
  138.              </style>";
  139.               if($hidden == "true") echo "<style>.symb_error" . $symbengine_warNums . " {display: none;}</style>";
  140.               if($message == "null") {
  141.                   $message = "Unknown error";
  142.                   return $style . "<span class='symb_error" . $symbengine_warNums . "'><h1>Symb Engine Error:</h1> " . $message . "</span>";
  143.               }
  144.               else return $style . "<span class='symb_error" . $symbengine_warNums . "'><h1>Symb Engine Error:</h1> " . $message . "&nbsp;&nbsp;&nbsp;<a onClick=\"$(.symb_error).hide();\" href='javascript:void(0);'>Hide error</a></span>";
  145.             $symbengine_warNums++;
  146.         }
  147.  
  148.         public function connect() {
  149.             $sql = mysqli_connect($this->sql_host, $this->sql_user, $this->sql_pass);
  150.             mysqli_select_db($sql, $this->sql_datb) or die( $this->error( mysqli_error($sql) ) );
  151.             return $sql;
  152.         }
  153.  
  154.         public function tables_check() {
  155.             $cache = $this->formate("sql_table_cache");
  156.             $logs = $this->formate("sql_table_logs");
  157.             $accounts = $this->formate("sql_table_account");
  158.             $bans = $this->formate("sql_table_bans");
  159.             $sql = $this->connect();
  160.             $sql1 = mysqli_query($sql, "CREATE TABLE IF NOT EXISTS `$cache` (
  161.              `id` int(11) NOT NULL AUTO_INCREMENT,
  162.              `symb_id` text NOT NULL,
  163.              `symb_name` text NOT NULL,
  164.              `symb_value` text NOT NULL,
  165.              `expire` text NOT NULL,
  166.              PRIMARY KEY (`id`)
  167.              ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1") or die( $this->error( mysqli_error($sql) ) );
  168.             $sql2 = mysqli_query($sql, "CREATE TABLE IF NOT EXISTS `$logs` (
  169.            `id` int(11) NOT NULL AUTO_INCREMENT,
  170.            `log` text NOT NULL,
  171.            `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  172.            PRIMARY KEY (`id`)
  173.            ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1") or die( $this->error( mysqli_error($sql) ) );
  174.             $sql3 = mysqli_query($sql, "CREATE TABLE IF NOT EXISTS `$bans` (
  175.              `id` int(11) NOT NULL AUTO_INCREMENT,
  176.              `ip` text NOT NULL,
  177.              `reason` text NOT NULL,
  178.              PRIMARY KEY (`id`)
  179.              ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1") or die( $this->error( mysqli_error($sql) ) );
  180.             $sql4 = mysqli_query($sql, "CREATE TABLE IF NOT EXISTS `$accounts` (
  181.              `id` int(11) NOT NULL AUTO_INCREMENT,
  182.              `username` text NOT NULL,
  183.              `password` text NOT NULL,
  184.              `email` text NOT NULL,
  185.              `skype` text NOT NULL,
  186.              `phone1` text NOT NULL,
  187.              `phone2` text NOT NULL,
  188.              `activate_code` text NOT NULL,
  189.              `pw_recovery1` text NOT NULL,
  190.              `pw_recovery2` text NOT NULL,
  191.              `ip_register` text NOT NULL,
  192.              `ip_last` text NOT NULL,
  193.              `banned` int(11) NOT NULL,
  194.              PRIMARY KEY (`id`)
  195.              ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1") or die( $this->error( mysqli_error($sql) ) );
  196.             mysqli_close($sql);
  197.         }
  198.  
  199.         private function formate($x = "") {
  200.             return $this->sql_table_prefix . $this->$x;
  201.         }
  202.  
  203.         public function time($type = "") {
  204.               /*
  205.                 Date info
  206.                 Year  = Y
  207.                 Month = n
  208.                 Day   = j
  209.                 Hour  = G
  210.                 Minute= i
  211.                 Second= s
  212.               */
  213.               $year =     date("Y");
  214.               $month =    date("n");
  215.               $day =      date("j");
  216.               $hour =     date("G");
  217.               $minute =   date("i");
  218.               $second =   date("s");
  219.  
  220.               if($type == "3hour") {
  221.                 $hour++; $hour++; $hour++;
  222.                 if($hour > 24) {
  223.                   $hour = $hour - 24;
  224.                   $day++;
  225.                 }
  226.                 $date = $year . $month . $day . $hour . $minute . $second;
  227.               }
  228.               else if($type == "3days") {
  229.                 $day++; $day++; $day++;
  230.                 if($day > 28) {
  231.                   $day = $day - 28;
  232.                   $month++;
  233.                 }
  234.                 $date = $year . $month . $day . $hour . $minute . $second;
  235.               }
  236.               else if($type == "hour") {
  237.                 $hour++;
  238.                 $date = $year . $month . $day . $hour . $minute . $second;
  239.               }
  240.               else if($type == "long-life") {
  241.                 $month++;
  242.                 $date = $year . $month . $day . $hour . $minute . $second;
  243.               }
  244.               else $date = $year . $month . $day . $hour . $minute . $second;
  245.               return $date;
  246.             }
  247.  
  248.             function Write($symb_NAME = "", $symb_VALUE = "", $symb_ID = "", $expire = "3hour", $perm_OVERWRITE = "true") {
  249.             if(empty($symb_ID)) $symb_ID = $this->id("false");
  250.             if(empty($symb_NAME)) die($this->error("To use write(); you have to enter Symb NAME!"));
  251.             if(empty($symb_VALUE)) die($this->error("To use write(); you have to enter Symb VALUE!"));
  252.             $symb_EXPIRE = $this->time("$expire");
  253.             $sql = $this->connect();
  254.             $query = "SELECT * FROM " . $this->formate("sql_table_cache") . " WHERE symb_id='" . $symb_ID . "' AND symb_name='" . $symb_NAME . "'";
  255.             $result = mysqli_query($sql, $query) or die( $this->error( mysqli_error($sql) ) );
  256.             $num = mysqli_num_rows($result);
  257.             if($num == 0) {
  258.               $query = "INSERT INTO " . $this->formate("sql_table_cache") . " (symb_name, symb_value, symb_id, expire)
  259.              VALUES ('" . $symb_NAME . "','" . $symb_VALUE . "','" . $symb_ID . "','" . $symb_EXPIRE . "')";
  260.             $result = mysqli_query($sql, $query) or die( $this->error( mysqli_error($sql) ) );
  261.             }
  262.             else {
  263.               if($perm_OVERWRITE == "true") {
  264.                 $query = "UPDATE " . $this->formate("sql_table_cache") . "
  265.                SET symb_value='" . $symb_VALUE . "', symb_name='" . $symb_NAME . "', expire='" . $symb_EXPIRE . "'
  266.                WHERE symb_id='" . $symb_ID . "' AND symb_name='" . $symb_NAME . "'";
  267.                 $result = mysqli_query($sql, $query) or die( $this->error( mysqli_error($sql) ) );
  268.               }
  269.               else {
  270.                 echo $this->error("Symb $symb_NAME is already exist.", "true");
  271.               }
  272.             }
  273.             return $result;
  274.             mysqli_close($sql);
  275.           }
  276.  
  277.           public function safeSQL($link, $sql) {
  278.             $string = mysqli_real_escape_string($link, $sql) or die("Real_Escape_String() Error");
  279.  
  280.             return $string;
  281.           }
  282.  
  283.           public function read($symb_NAME = "", $symb_ID = "") {
  284.             if(empty($symb_ID)) $symb_ID = $this->id("false");
  285.             if(empty($symb_NAME)) die($this->error("To use read(); you have to enter Symb NAME!"));
  286.             $sql = $this->connect();
  287.             $query = "SELECT * FROM " . $this->formate("sql_table_cache") . " WHERE symb_id='" . $symb_ID . "' AND symb_name='" . $symb_NAME . "'";
  288.             $result = mysqli_query($sql, $query) or die( $this->error( mysqli_error($sql) ) );
  289.             $num = mysqli_num_rows($result);
  290.             $sql_index_menu = 0;
  291.             mysqli_close($sql);
  292.             if($num == 0) return;
  293.             else return $this->mysqli_result($result, 0, "symb_value");
  294.           }
  295.  
  296.           public function mysqli_result($result,$row,$field=0) {
  297.                 if ($result===false) return false;
  298.                 if ($row>=mysqli_num_rows($result)) return false;
  299.                 if (is_string($field) && !(strpos($field,".")===false)) {
  300.                     $t_field=explode(".",$field);
  301.                     $field=-1;
  302.                     $t_fields=mysqli_fetch_fields($result);
  303.                     for ($id=0;$id<mysqli_num_fields($result);$id++) {
  304.                         if ($t_fields[$id]->table==$t_field[0] && $t_fields[$id]->name==$t_field[1]) {
  305.                             $field=$id;
  306.                             break;
  307.                         }
  308.                     }
  309.                     if ($field==-1) return false;
  310.                 }
  311.                 mysqli_data_seek($result,$row);
  312.                 $line=mysqli_fetch_array($result);
  313.                 return isset($line[$field])?$line[$field]:false;
  314.           }
  315.  
  316.           public function isExist($symb_NAME = "", $symb_ID = "") {
  317.             if(empty($symb_ID)) $symb_ID = $this->id("false");
  318.             if(empty($symb_NAME)) die(symb_error("To use isExist(); you have to enter Symb NAME!"));
  319.             $sql = $this->connect();
  320.             $query = "SELECT * FROM " . $this->formate("sql_table_cache") . " WHERE symb_id='" . $symb_ID . "' AND symb_name='" . $symb_NAME . "'";
  321.             $result = mysqli_query($sql, $query) or die( $this->error( mysqli_error($sql) ) );
  322.             $num = mysqli_num_rows($result);
  323.             $sql_index_menu = 0;
  324.             mysqli_close($sql);
  325.             if($num == 0) return "false";
  326.             else return "true";
  327.           }
  328.  
  329.           public function delete($symb_NAME = "", $symb_ID = "") {
  330.             if(empty($symb_ID)) $symb_ID = $this->id("false");
  331.             if(empty($symb_NAME)) die($this->error("Pro použití funkce symb_delete(); je zapotřebí Symb NAME!"));
  332.             $sql = $this->connect();
  333.             $query = "DELETE FROM " . $this->formate("sql_table_cache") . "
  334.            WHERE symb_id='" . $symb_ID . "' AND symb_name='" . $symb_NAME . "'";
  335.             $result = mysqli_query($sql, $query);
  336.             mysqli_close($sql);
  337.             return $result;
  338.           }
  339.  
  340.           public function kill($symb_ID = "") {
  341.             if(empty($symb_ID)) $symb_ID = $this->id("false");
  342.             $sql = $this->connect();
  343.             $query = "DELETE FROM " . $this->formate("sql_table_cache"). "
  344.            WHERE symb_id='" . $symb_ID . "'";
  345.             $result = mysqli_query($sql, $query);
  346.             mysqli_close($sql);
  347.             return $result;
  348.           }
  349.  
  350.           public function redirect($url = "") {
  351.             echo "<meta http-equiv='refresh' content='0; url=" . $url . "' />";
  352.             die("Redirecting...");
  353.           }
  354.  
  355.           private function generate_key($length = 20) {
  356.             $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
  357.             $randomString = '';
  358.             for ($i = 0; $i < $length; $i++) {
  359.                 $randomString .= $characters[rand(0, strlen($characters) - 1)];
  360.             }
  361.             return $randomString;
  362.           }
  363.  
  364.           public function bot($action = "check_expires") {
  365.             if($action == "check_expires") {
  366.                 $sql = $this->connect();
  367.                 $t = $this->time();
  368.                 $query = "DELETE FROM " . $this->formate("sql_table_cache") . "
  369.                WHERE expire<'" . $t . "'";
  370.                 $result = mysqli_query($sql, $query) or die( $this->error( mysqli_error($sql) ) );
  371.                 mysqli_close($sql);
  372.             }
  373.             else if($action == "clear_symb") {
  374.                 $sql = $this->connect();
  375.                 $query = "DELETE FROM " . $this->formate("sql_table_cache");
  376.                 $result = mysqli_query($sql, $query) or die( $this->error( mysqli_error($sql) ) );
  377.                 mysqli_close($sql);
  378.             }
  379.             return $result;
  380.         }
  381.  
  382.        public function hash($string = "") {
  383.          $replace = array(
  384.             "1" => "mk", " " => "chJ",
  385.             "2" => "Wq", "§" => "jHS",
  386.             "3" => "Ga", "$" => "dlR",
  387.             "4" => "Zu",
  388.             "5" => "Li",
  389.             "6" => "FA",
  390.             "7" => "OQ",
  391.             "8" => "Rm",
  392.             "9" => "Mr",
  393.             "0" => "XI","q" => "YW","w" => "xx","e" => "yP","r" => "lg","t" => "lG",
  394.             "z" => "5Q","u" => "1I","i" => "8i",
  395.             "o" => "Zax","p" => "Hay","a" => "Xaa","s" => "fGw","d" => "aRgh","f" => "tawA","g" => "asCW",
  396.             "h" => "laQo","j" => "L1pO","k" => "kSň","l" => "íd","y" => "Ani","x" => "aKv","c" => "eče","v" => "Ři","b" => "FsdQ","n" => "RamD",
  397.             "m" => "5dm","Q" => "Sex","W" => "FiqZz","E" => "LenmW","R" => "yRAcg","T" => "tAyaWq","Z" => "uMoaku","U" => "SUi",
  398.             "I" => "75asf","O" => "78sh","P" => "12dnhG","A" => "83agA","S" => "5Sd2S","D" => "7A0fa","F" => "9156G","G" => "ambR",
  399.             "H" => "12ath","J" => "457at","K" => "74asgS","L" => "3agb6G","Y" => "2a5SDA","X" => "201DA","C" => "fsdaAW","V" => "gaQkl",
  400.             "B" => "36lG","N" => "asd2R","M" => "kAWuze", " " => "sdgW2", "!" => "aqWer", "?" => "poYt",
  401.           );
  402.             $output = strtr($string, $replace);
  403.             $output = md5($output);
  404.             $output = sha1($output);
  405.             $output = strtr($output, $replace);
  406.             $output = md5($output);
  407.             return $output;
  408.        }
  409.  
  410.        private function currentTime() {
  411.                 $year =     date("Y");
  412.                 $month =    date("n");
  413.                 $day =      date("j");
  414.                 $hour =     date("G");
  415.                 $minute =   date("i");
  416.                 $second =   date("s");
  417.  
  418.                 return $month . "/" . $day . "/" . $year . " - " . $hour . ":" . $minute . ":" . $second;
  419.        }
  420.  
  421.        public function checkWiki($string) {
  422.             $replace = array(
  423.                 "{VERSION_CURRENT}" => $this->version,
  424.                 "{TIME_CURRENT}" => $this->currentTime(),
  425.                 "{SIGNATURE}" => "Tomas Malcanek",
  426.                 "{CHARSET}" => "UTF-8",
  427.                  );
  428.             $output = strtr($string, $replace);
  429.             return $output;
  430.        }
  431.  
  432.        public function Log() {
  433.             if($this->enableLogs) {
  434.                 $year =     date("Y");
  435.                 $month =    date("n");
  436.                 $day =      date("j");
  437.                 $hour =     date("G");
  438.                 $minute =   date("i");
  439.                 $second =   date("s");
  440.                 $log = $day . $month . $hour . $minute . $second . ";";
  441.                 $log .= $this->id("false") . ";";
  442.        //         $log .= $_SERVER["HTTP_REFERER"] . ";";
  443.                 $log .= $_SERVER["REMOTE_ADDR"] . ";";
  444.        //         $log .= $_SERVER["PATH_INFO"];
  445.                 $sql = $this->connect();
  446.                 mysqli_query($sql, "INSERT INTO " . $this->formate("sql_table_logs") . " (log) VALUES ('" . $log . "')") or die($this->error(mysqli_error($sql)));
  447.                 mysqli_close($sql);
  448.             }
  449.        }
  450.  
  451.        public function Ban($ip= "", $reason = "") {
  452.             $sql = $this->connect();
  453.             mysqli_query($sql, "INSERT INTO " . $this->formate("sql_table_bans") . " (ip, reason) VALUES ('" . $ip . "', '" . $reason . "')") or die($this->error(mysqli_error($sql)));
  454.             mysqli_close($sql);
  455.        }
  456.  
  457.        public function isBanned($ip = "") {
  458.             $sql = $this->connect();
  459.             $result = mysqli_query($sql, "SELECT * FROM " . $this->formate("sql_table_bans") . " WHERE ip='" . $ip . "'") or die($this->error(mysqli_error($sql)));
  460.             $rows = mysqli_num_rows($result);
  461.             if($rows > 0) return $this->mysqli_result($result, 0, "reason");
  462.        }
  463.  
  464.        private function sendTraffic($url = "") {
  465.             $replace = Array("#" => "$");
  466.             $url = strtr($url, $replace);
  467.             $ch = curl_init($url);
  468.             $result = curl_exec($ch);
  469.             curl_close($ch);
  470.             return $result;
  471.             //return file_get_contents($url);
  472.        }
  473.  
  474.        public function globalBan($ip = "", $reason = "") {
  475.             $key = $this->globalKey;
  476.             $r = $this->sendTraffic("http://www.games.symbiant.cz/projects/symb/public/globalban.php?t=n&ip=$ip&globalKey=$key&reason=$reason");
  477.             return $r;
  478.             }
  479.  
  480.  
  481.        public function globalWrite($name = "", $value = "", $id = "", $expire = "3hour", $overwrite = "true") {
  482.             // WIP
  483.             /*$key = $this->globalKey;
  484.             if(empty($id)) $id = $this->id("false");
  485.             //$expire = $this->time("$expire");
  486.             $r = $this->sendTraffic("http://www.games.symbiant.cz/projects/symb/public/globalcache.php?t=w&key=$key&n=$name&v=$value&id=$id&expire=$expire&ow=$overwrite");
  487.             return $r;*/
  488.        }
  489.  
  490.        public function globalRead($name = "", $id = "") {
  491.             // WIP
  492.        }
  493.  
  494.        public function globalKill($id = "") {
  495.             // WIP
  496.        }
  497.  
  498.        public function globalDelete($name = "", $id = "") {
  499.             // WIP
  500.        }
  501.  
  502.        public function email($message = "", $subject = "", $to = "", $from = "", $from_name = "", $reply = "") {
  503.             $mailTo = $to;
  504.             $mailFrom = $from;
  505.             $mailFromName = $from_name;
  506.             $mailReplyTo = $reply;
  507.             $mailSubject = $subject;
  508.             $mailMessage = $message;
  509.             $mailCharset = "utf-8"; // must be accurate (e.g. "Windows - 1252" is invalid)
  510.             $headers  = "Content-type: text/html; charset=$mailCharset\r\n";
  511.             $headers .= "From: $mailFromName <$mailFrom>\r\n";
  512.             $headers .= "Reply-To: $mailReplyTo\r\n";
  513.             $headers .= "Cc: $mailCc\r\n";
  514.             $headers .= "Bcc: $mailBcc\r\n";
  515.             mail($mailTo, $mailSubject, $mailMessage, $headers);
  516.             return;
  517.        }
  518.  
  519.        public function register($username = "", $password = "", $email = "", $recovery1 = "", $recovery2 = "", $phone = "", $skype = "", $ip = "", $phone2 = "", $activate_code = "") {
  520.             if(empty($username)) die( $this->error("No username") );
  521.             if(empty($password)) die( $this->error("No email") );
  522.             if(empty($activate_code)) $activate_code = $this->generate_key();
  523.             $password = $this->hash($password);
  524.             $sql = $this->connect();
  525.             $query = "INSERT INTO " . $this->formate("sql_table_account") . " (username, password, email, phone1, phone2, pw_recovery1, pw_recovery2, ip_register, ip_last, skype, activate_code) VALUES ('$username', '$password', '$email', '$phone1', '$phone2', '$recovery1', '$recovery2', '$ip', '$ip', '$skype', '$activate_code')";
  526.             $result = mysqli_query($sql, $query);
  527.             if($result && !empty($email)) {
  528.                 $this->email($msg, "Confirm your registration", $email, "noreply@symb.com", "Symb Notifier");
  529.             }
  530.        }
  531.  
  532.        public function getDataTable($table = "", $row = 0, $field = "", $query = "") {
  533.             $sql = $this->connect();
  534.             if(empty($query)) $query = "SELECT * FROM $table";
  535.  
  536.             $result = mysqli_query($sql, $query);
  537.             mysqli_close($sql);
  538.  
  539.             return $this->mysqli_result($result, $row, $field);
  540.        }
  541.  
  542.        public function getDataRows($table = "", $query = "") {
  543.             $sql = $this->connect();
  544.             if(empty($query)) $query = "SELECT * FROM $table";
  545.  
  546.             $result = mysqli_query($sql, $query);
  547.             $rows = mysqli_num_rows($result);
  548.             mysqli_close($sql);
  549.             return $rows;
  550.        }
  551.  
  552.        public function saveData($table = "", $names = "", $values = "") {
  553.             $sql = $this->connect();
  554.             if(empty($query)) $query = "INSERT INTO $table ($names) VALUES ($values)";
  555.  
  556.             $result = mysqli_query($sql, $query);
  557.             mysqli_close($sql);
  558.             return $result;
  559.        }
  560.     }
  561.  
  562.     $symb_ID = $symb->id("false");
  563.  
  564.     if($_GET["check_expires"] == "true") $symb->bot();
  565.  
  566.     // It's website
  567.  
  568.  
  569.     if($isMy != true && $showWiki == true) {
  570. ?>
  571.  
  572. <head>
  573.  
  574.     <title>Symb</title>
  575.  
  576.     <style>
  577.  
  578.         body {
  579.             font-family: Arial;
  580.             padding-left: 300px;
  581.         }
  582.  
  583.         a,a:visited {
  584.             color: #474747;
  585.             text-decoration: none;
  586.             font-weight: bold;
  587.         }
  588.         a:hover {
  589.             text-decoration: underline;
  590.         }
  591.  
  592.         #sideMenu {
  593.             position: fixed;
  594.             top: 0;
  595.             left: 0;
  596.             height: 100%;
  597.             border-right: 1px solid black;
  598.             background-color: #B2B2B2;
  599.             color: black;
  600.             padding-left: 4px;
  601.             padding-right: 5px;
  602.             overflow-y: scroll;
  603.             width: 250px;
  604.         }
  605.  
  606.         #sideMenu span {
  607.             font-family: "Courier New", Courier, monospace;
  608.             font-style: italic;
  609.             padding-right: 0.8px;
  610.         }
  611.  
  612.         #sideMenu a,a:visited {
  613.             font-weight: normal;
  614.         }
  615.  
  616.         #sideMenu a:hover {
  617.             font-weight: bold;
  618.         }
  619.  
  620.         #bottom {
  621.             left: 0;
  622.             bottom: 0;
  623.             position: fixed;
  624.             width: 100%;
  625.             padding-top: 15px;
  626.             padding-bottom: 20px;
  627.             background-color: #BDBDBD;
  628.             color: black;
  629.             border-top: 1px solid black;
  630.             text-align: center;
  631.         }
  632.  
  633.         #top img {
  634.             position: relative;
  635.             margin-bottom: -14px;
  636.         }
  637.  
  638.         .version {
  639.             font-style: italic;
  640.             font-size: small;
  641.         }
  642.  
  643.         #screenSaver {
  644.             height: 100px;
  645.         }
  646.  
  647.     </style>
  648.     <script>
  649.  
  650.         function loc(x, y) {
  651.             $('input[name="location"]').val(x);
  652.             $('input[name="add"]').val(y);
  653.             $( "form:first" ).submit();
  654.         }
  655.  
  656.         $('input[name="ip"]').val("<?php echo $_SERVER["REMOTE_ADDR"]; ?>");
  657.     </script>
  658.  
  659.     <link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.1/styles/default.min.css">
  660.     <script src="http://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.1/highlight.min.js"></script>
  661.     <script>hljs.initHighlightingOnLoad();</script>
  662.  
  663.     <form method="POST" name="locator">
  664.         <input type="hidden" name="location" value='' />
  665.         <input type="hidden" name="add" value='' />
  666.     </form>
  667. </head>
  668. <html>
  669.     <body>
  670.  
  671.         <!-- Top -->
  672.             <div id="top">
  673.                 <h1><img width="50" height="50" src="http://www.games.symbiant.cz/projects/symb/public/source_code-128.png" /> Symb - Intensifies your code</h1>
  674.             </div>
  675.         <!-- Content -->
  676.             <div id="sideMenu">
  677.                 <a href="#" onClick="loc('home');">Home</a><br>
  678.                 <a href="#" onClick="loc('start');">How to start using Symb</a><br>
  679.                 <a href="#" onClick="loc('bots');">Bots</a><br>
  680.                 <a href="#" onClick="loc('fwrite');"><span>f</span>Symb::Write</a><br>
  681.                 <a href="#" onClick="loc('fread');"><span>f</span>Symb::Read</a><br>
  682.                 <a href="#" onClick="loc('fkill');"><span>f</span>Symb::Kill</a><br>
  683.                 <a href="#" onClick="loc('fdelete');"><span>f</span>Symb::Delete</a><br>
  684.                 <a href="#" onClick="loc('fisexist');"><span>f</span>Symb::isExist</a><br>
  685.                 <a href="#" onClick="loc('fbot');"><span>f</span>Symb::Bot</a><br>
  686.                 <a href="#" onClick="loc('fbrowser');"><span>f</span>Symb::Browser</a><br>
  687.                 <a href="#" onClick="loc('fid');"><span>f</span>Symb::ID</a><br>
  688.                 <a href="#" onClick="loc('fconnect');"><span>f</span>Symb::Connect</a><br>
  689.                 <a href="#" onClick="loc('fgeneratekey');"><span>f</span>Symb::Generate_Key</a><br>
  690.                 <a href="#" onClick="loc('fredirect');"><span>f</span>Symb::Redirect</a><br>
  691.                 <a href="#" onClick="loc('mysqli_result');"><span>f</span>Symb::Mysqli_Result</a><br>
  692.                 <a href="#" onClick="loc('ftime');"><span>f</span>Symb::Time</a><br>
  693.                 <a href="#" onClick="loc('ferror');"><span>f</span>Symb::Error</a><br>
  694.                 <a href="#" onClick="loc('flog');"><span>f</span>Symb::Log</a><br>
  695.                 <a href="#" onClick="loc('fban');"><span>f</span>Symb::Ban</a><br>
  696.                 <a href="#" onClick="loc('fisbanned');"><span>f</span>Symb::isBanned</a><br>
  697.                 <a href="#" onClick="loc('fglobalban');"><span>f</span>Symb::GlobalBan</a><br>
  698.                 <a href="#" onClick="loc('fauth');"><span>f</span>Symb::Auth</a><br>
  699.                 <?php
  700.                     echo file_get_contents('http://games.symbiant.cz/projects/symb/public/helpmenu.html');
  701.                 ?>
  702.                 <div id="screenSaver"></div>
  703.             </div>
  704.  
  705.             <div id="content">
  706.                 <?php
  707.                     $loc = $_POST["location"];
  708.                     if($loc == "start") $content = file_get_contents('http://games.symbiant.cz/projects/symb/public/wiki_start.html');
  709.                     else if($loc == "bots") $content = file_get_contents('http://games.symbiant.cz/projects/symb/public/wiki_bots.html');
  710.                     else if($loc == "fwrite") $content = file_get_contents('http://games.symbiant.cz/projects/symb/public/wiki_fwrite.html');
  711.                     else if($loc == "fread") $content = file_get_contents('http://games.symbiant.cz/projects/symb/public/wiki_fread.html');
  712.                     else if($loc == "fkill") $content = file_get_contents('http://games.symbiant.cz/projects/symb/public/wiki_fkill.html');
  713.                     else if($loc == "fdelete") $content = file_get_contents('http://games.symbiant.cz/projects/symb/public/wiki_fdelete.html');
  714.                     else if($loc == "fisexist") $content = file_get_contents('http://games.symbiant.cz/projects/symb/public/wiki_fisexist.html');
  715.                     else if($loc == "fbot") $content = file_get_contents('http://games.symbiant.cz/projects/symb/public/wiki_fbot.html');
  716.                     else if($loc == "fbrowser") $content = file_get_contents('http://games.symbiant.cz/projects/symb/public/wiki_fbrowser.html');
  717.                     else if($loc == "fid") $content = file_get_contents('http://games.symbiant.cz/projects/symb/public/wiki_fid.html');
  718.                     else if($loc == "fconnect") $content = file_get_contents('http://games.symbiant.cz/projects/symb/public/wiki_fconnect.html');
  719.                     else if($loc == "fgeneratekey") $content = file_get_contents('http://games.symbiant.cz/projects/symb/public/wiki_fgeneratekey.html');
  720.                     else if($loc == "fredirect") $content = file_get_contents('http://games.symbiant.cz/projects/symb/public/wiki_fredirect.html');
  721.                     else if($loc == "mysqli_result") $content = file_get_contents('http://games.symbiant.cz/projects/symb/public/wiki_mysqliresult.html');
  722.                     else if($loc == "ftime") $content = file_get_contents('http://games.symbiant.cz/projects/symb/public/wiki_ftime.html');
  723.                     else if($loc == "ferror") $content = file_get_contents('http://games.symbiant.cz/projects/symb/public/wiki_ferror.html');
  724.                     else if($loc == "flog") $content = file_get_contents('http://games.symbiant.cz/projects/symb/public/wiki_flog.html');
  725.                     else if($loc == "fban") $content = file_get_contents('http://games.symbiant.cz/projects/symb/public/wiki_fban.html');
  726.                     else if($loc == "fisbanned") $content = file_get_contents('http://games.symbiant.cz/projects/symb/public/wiki_fisbanned.html');
  727.                     else if($loc == "fglobalban") $content = file_get_contents('http://games.symbiant.cz/projects/symb/public/wiki_fglobalban.html');
  728.                     else if($loc == "additional") $content = file_get_contents('http://games.symbiant.cz/projects/symb/public/wiki_more.php?i=' . $_POST["add"]);
  729.                     else $content = file_get_contents('http://games.symbiant.cz/projects/symb/public/wiki_home.html');
  730.                     $content = $symb->checkWiki($content);
  731.  
  732.                     // Adding more links in content
  733.                     $functions = file_get_contents("http://games.symbiant.cz/projects/symb/public/functions.html");
  734.                     $function = explode(" ", $functions);
  735.                     $num=0;
  736.                     while($num < count($function)) {
  737.                         $parts = explode(":", $function[$num]);
  738.                         $part1 = strtr($parts[0], array("-" => "::"));
  739.                         $content = strtr($content, array($part1 => "<a href='#' onClick=\"loc('$parts[1]');\">$part1</a>"));
  740.                         $num++;
  741.                     }
  742.                     echo $content;
  743.                 ?>
  744.                 <div id="screenSaver"></div>
  745.             </div>
  746.         <!-- Bottom -->
  747.             <div id="bottom">&copy;2014 - Symbiant<span class='reg'>&reg;</span> Games<br><i>All rights reserved</i><br>
  748.             <span class="version">Current version: <?php echo $symb->version; ?></span></div>
  749.  
  750.     </body>
  751. </html>
  752. <?php } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement