function CreateHeroList($cacheDir = 'inc/cache/') { global $db; $sth = $db->prepare("SELECT * FROM " . OSDB_HEROES . " \n\t WHERE summary!= '-'\n\t ORDER BY `type` ASC, `description` ASC "); $result = $sth->execute(); $HeroFile = $cacheDir . "HeroList.php"; $NL = ' '; $FileContents = '<?php $HeroListStr = array(); $HeroListAgi = array(); $HeroListInt = array();' . $NL; $c = 0; while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { $row["description"] = OS_trim(trim($row["description"])); $row["summary"] = OS_trim(trim($row["summary"])); $row["stats"] = OS_trim(trim($row["stats"])); $row["skills"] = OS_trim(trim($row["skills"])); if ($row["type"] == 0) { $FileContents .= '$HeroListStr[' . $c . ']["heroid"] = "' . $row["heroid"] . '";' . $NL; $FileContents .= '$HeroListStr[' . $c . ']["original"] = "' . $row["original"] . '";' . $NL; $FileContents .= '$HeroListStr[' . $c . ']["description"] = "' . convEnt2($row["description"]) . '";' . $NL; $FileContents .= '$HeroListStr[' . $c . ']["summary"] = "' . convEnt2($row["summary"]) . '";' . $NL; $FileContents .= '$HeroListStr[' . $c . ']["stats"] = "' . convEnt2($row["stats"]) . '";' . $NL; $FileContents .= '$HeroListStr[' . $c . ']["skills"] = "' . convEnt2($row["skills"]) . '";' . $NL; } if ($row["type"] == 1) { $FileContents .= '$HeroListAgi[' . $c . ']["heroid"] = "' . $row["heroid"] . '";' . $NL; $FileContents .= '$HeroListAgi[' . $c . ']["original"] = "' . $row["original"] . '";' . $NL; $FileContents .= '$HeroListAgi[' . $c . ']["description"] = "' . convEnt2($row["description"]) . '";' . $NL; $FileContents .= '$HeroListAgi[' . $c . ']["summary"] = "' . convEnt2($row["summary"]) . '";' . $NL; $FileContents .= '$HeroListAgi[' . $c . ']["stats"] = "' . convEnt2($row["stats"]) . '";' . $NL; $FileContents .= '$HeroListAgi[' . $c . ']["skills"] = "' . convEnt2($row["skills"]) . '";' . $NL; } if ($row["type"] == 2) { $FileContents .= '$HeroListInt[' . $c . ']["heroid"] = "' . $row["heroid"] . '";' . $NL; $FileContents .= '$HeroListInt[' . $c . ']["original"] = "' . $row["original"] . '";' . $NL; $FileContents .= '$HeroListInt[' . $c . ']["description"] = "' . convEnt2($row["description"]) . '";' . $NL; $FileContents .= '$HeroListInt[' . $c . ']["summary"] = "' . convEnt2($row["summary"]) . '";' . $NL; $FileContents .= '$HeroListInt[' . $c . ']["stats"] = "' . convEnt2($row["stats"]) . '";'; $FileContents .= '$HeroListInt[' . $c . ']["skills"] = "' . convEnt2($row["skills"]) . '";' . $NL; } $c++; } $FileContents .= "?>"; file_put_contents($HeroFile, $FileContents); }
$server = ""; $reason = ""; $ip = ""; $admin = ""; $gn = ""; $date = date("Y-m-d H:i:00", time()); $expire = ""; $warn = ""; if (isset($_GET["edit"]) and is_numeric($_GET["edit"])) { $id = safeEscape((int) $_GET["edit"]); } //UPDATE if (isset($_POST["edit_ban"])) { $name = safeEscape(trim(strtolower($_POST["name"]))); $server = safeEscape(trim($_POST["server"])); $reason = EscapeStr(convEnt2(trim($_POST["reason"]))); $ip = EscapeStr(trim($_POST["ip"])); $country = EscapeStr(trim($_POST["country"])); //Force set name to 'iprange' if (substr($ip, 0, 1) == ":") { $name = 'iprange'; } if (!empty($ip) and $ip != '0.0.0.0') { $ipv = explode(".", $ip); if (count($ipv) >= 2) { $ip_part = $ipv[0] . "." . $ipv[1]; } $ip_part = str_replace(":", "", $ip_part); } else { $ip_part = ""; }
$total = $sth->rowCount(); $debug = ""; $count = 0; while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { $name = $row["player"]; $Letter = ""; $Country = ""; $ip = $row["ip"]; $Letter = geoip_country_code_by_addr($GeoIPDatabase, $ip); $Country = geoip_country_name_by_addr($GeoIPDatabase, $ip); // if ( substr($ip, 0,7) == "23.243." OR substr($ip, 0,7) == "23.242." OR substr($ip, 0,7) == "23.241." ) { /// $Letter = "US"; // $Country = "United States"; //} if (!empty($Country)) { $upd = $db->prepare("UPDATE " . OSDB_STATS . " SET country='" . convEnt2($Country) . "', country_code = '" . $Letter . "' WHERE id = '" . $row["id"] . "' "); $result = $upd->execute(); $count++; if ($total >= 1 and empty($debug) and $count >= 1) { $debug = " <b>Updating Countries (found: {$total} entries)</b>"; } if ($CronReportDetails == 2) { $debug .= "<div><b>{$name}</b>, {$ip}, {$Letter}, {$Country}</div>"; } } else { if ($CronReportDetails == 2) { $debug .= "<div><span style=\"color:red\">FAILED: <b>{$name}</b>, IP: {$ip}, LETTER: {$Letter}, COUNTRY: {$Country}</span></div>"; } } } //Cron entry example - LOG
$r = $sth->fetch(PDO::FETCH_NUM); $numrows = $r[0]; $result_per_page = $GamesPerPage; $draw_pagination = 0; include 'inc/pagination.php'; $draw_pagination = 1; $sql = getAllGames($MinDuration, $offset, $rowsperpage, $filter, "datetime DESC"); } $sth = $db->prepare($sql); $result = $sth->execute(); $c = 0; $GamesData = array(); while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { $GamesData[$c]["win"] = ""; $GamesData[$c]["id"] = (int) $row["id"]; $GetMap = convEnt2(substr($row["map"], strripos($row["map"], '\\') + 1)); $Map = explode(".w", $GetMap); $GamesData[$c]["map"] = $Map[0]; //$GamesData[$c]["map"] = convEnt2(substr($row["map"], strripos($row["map"], '\\')+1)); //$GamesData[$c]["map"] = reset( explode(".w", $GamesData[$c]["map"] ) ); //$GamesData[$c]["map"] = substr($GamesData[$c]["map"],0,20); $GamesData[$c]["datetime"] = $row["datetime"]; $GamesData[$c]["gamename"] = $row["gamename"]; $GamesData[$c]["ownername"] = $row["ownername"]; $GamesData[$c]["duration"] = $row["duration"]; $GamesData[$c]["creatorname"] = $row["creatorname"]; $GamesData[$c]["flag"] = $row["flag"]; if (isset($_GET["h"]) and file_exists("img/heroes/" . $_GET["h"] . ".gif")) { $GamesData[$c]["hero_history"] = $_GET["h"] . ""; } else { $GamesData[$c]["hero_history"] = "";
if ($replay->chat) { foreach ($replay->chat as $content) { $time = $content['time']; $mode = $content['mode']; $playerID = $content['player_id']; if (isset($names[$playerID])) { $playerName = $names[$playerID]; } else { $playerName = "System"; } if (isset($colors[$playerID])) { $playerColor = $colors[$playerID]; } else { $playerColor = ""; } $text = convEnt2($content['text']); $ply = "<span class='GameSystem'><i>(System)</i></span>"; if ($mode == 'All' || getTeam($playerColor) == 1) { $ply = "<a href='" . $website . "?u={$playerName}'><span class='{$playerColor}'>{$playerName}</span></a>"; } if ($mode == 'All' || getTeam($playerColor) == 2) { $ply = "<a href='" . $website . "?u={$playerName}'><span class='{$playerColor}'>{$playerName}</span></a>"; } $timeSec = secondsToTime($time / 1000); $drawTable = "replay_left"; include "" . OS_CURRENT_THEME_PATH . "/game_log.php"; if ($mode == 'All') { echo "<td class='all'>[All] {$text}</td>"; $str .= "<td class='all'>[All] {$text}</td>"; } else { if ($mode == 'System') {
if ($TotalHeroes >= 100) { $TotalHeroes = "100"; } $sql = getMostUsedHeroByItem("", $itemid, $TotalHeroes, $Item["shortname"]); $result = $db->prepare($sql); $result = $sth->execute(); if ($sth->rowCount() >= 1) { ?> <div> <h2><b>Most used by:</b></h2> <?php while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { $hero = strtoupper($row["hero"]); $heroName = convEnt2($row["heroname"]); $itemName = convEnt2($Item["shortname"]); $itemName2 = convEnt2($Item["shortname"]); $totals = $row["total"]; ?> <a href="<?php echo $website; ?> ?hero=<?php echo $hero; ?> " <?php echo ShowToolTip($heroName . " used " . $itemName2 . " " . $totals . "x", "", 200, 21, 15); ?> ><img width="48" height="48" src="<?php echo $website; ?> img/heroes/<?php
$item_info = ""; $price = ""; $type = ""; $icon = "AbyssalBlade.gif"; $itemID = ""; if (isset($_GET["edit"]) or isset($_GET["add"])) { if (isset($_GET["edit"])) { $edit = safeEscape($_GET["edit"]); } else { $edit = ""; } if (isset($_POST["edit_item"])) { $icon = safeEscape($_POST["icon"]); $name = convEnt2($_POST["name"]); $shortname = convEnt2($_POST["shortname"]); $item_info = my_nl2br(convEnt2(trim($_POST["item_info"]))); $item_info = str_replace(array("Š", "š"), array("Š", "š"), $item_info); $price = EscapeStr($_POST["price"]); $type = EscapeStr($_POST["type"]); $icon = EscapeStr($_POST["icon"]); if (strlen($name) >= 2 and strlen($shortname) >= 2) { if (isset($_GET["edit"])) { $upd = 1; $update = $db->update(OSDB_ITEMS, array("name" => $name, "shortname" => $shortname, "item_info" => $item_info, "price" => $price, "type" => $type, "icon" => $icon), "itemid = '" . $edit . "' "); if ($upd) { ?> <h2>Item successfully updated</h2><?php OS_AddLog($_SESSION["username"], "[os_items] EDITED ITEM ( {$name}, {$edit} )"); } } else { if (isset($_GET["add"])) {
} ?> <?php if (isset($_GET["hid"])) { $hid = safeEscape($_GET["hid"]); if (isset($_POST["heroid"])) { $hid = safeEscape($_POST["heroid"]); } $sth = $db->prepare("SELECT * FROM " . OSDB_HEROES . " WHERE original!='' AND heroid = '" . $hid . "' "); $result = $sth->execute(); if ($sth->rowCount() >= 1) { $row = $sth->fetch(PDO::FETCH_ASSOC); if (isset($_POST["add_guide"]) and isset($_POST["guide_url"])) { $url = EscapeStr($_POST["guide_url"]); $title = EscapeStr(convEnt2($_POST["guide_title"])); $errors = ""; $edit = ""; $code = $_POST["code"]; if ($code != $_SESSION["code"]) { $errors .= '<div><img src="' . $website . 'adm/del.png" alt="edit" /> Invalid form</div>'; } if (!strstr($url, "http")) { $errors .= "<div>Link is not valid.</div>"; } if (empty($errors)) { if (isset($_GET["edit"]) and is_numeric($_GET["edit"])) { $edit = safeEscape((int) $_GET["edit"]); $sql = "AND id != '" . $edit . "'"; } else { $sql = "";
?> <div align="center"> <h2>Post successfully deleted. <a href="<?php echo $website; ?> adm/?posts">« Back</a></h2> </div> <?php } //ADD / EDIT POST if (isset($_GET["add"]) or isset($_GET["edit"]) and is_numeric($_GET["edit"])) { if (isset($_POST["add_post"])) { $title = EscapeStr($_POST["post_title"]); $status = EscapeStr((int) $_POST["status"]); $allow_comments = EscapeStr((int) $_POST["allow_comments"]); $text = my_nl2br(convEnt2(trim($_POST["post_text"]))); $text = str_replace(array("Š", "š"), array("Š", "š"), $text); $errors = ""; $time = time(); $author = EscapeStr((int) $_POST["author"]); if (strlen($title) <= 3) { $errors .= "<div>Field Title does not have enough characters</div>"; } if (strlen($text) <= 5) { $errors .= "<div>Field Text does not have enough characters</div>"; } if (empty($errors)) { if (isset($_GET["add"])) { $ins = 1; $insert = $db->prepare("INSERT INTO " . OSDB_NEWS . "(news_title, news_content, news_date, status, allow_comments, author)\n\t\tVALUES('" . $title . "', '" . $text . "', '" . $time . "', '" . $status . "', '" . $allow_comments . "', '" . $author . "') "); $result = $insert->execute();