function OS_UpdateScoresTable($name = "") { global $db; $name = OS_StrToUTF8(trim($name)); if (!empty($name)) { $sth = $db->prepare("SELECT * FROM scores WHERE (name) = ('" . $name . "')"); $result = $sth->execute(); if ($limit = $sth->rowCount() <= 0) { $sth = $db->prepare("INSERT INTO scores(category, name)VALUES('dota_elo','" . $name . "')"); $result = $sth->execute(); } //Get updated result $resultScore = $db->prepare("SELECT player,score FROM " . OSDB_STATS . " WHERE (player) = ('" . $name . "')"); $result = $resultScore->execute(); $rScore = $resultScore->fetch(PDO::FETCH_ASSOC); //update "scores" table $UpdateScoreTable = $db->prepare("UPDATE `scores` SET `score` = '" . $rScore["score"] . "' \n\tWHERE (name) = ('" . $rScore["player"] . "') "); $result = $UpdateScoreTable->execute(); } }
$DefaultHomeDescription = $HomeDesc; foreach ($_POST as $key => $value) { $_POST[$key] = FilterData($value); } foreach ($_GET as $key => $value) { $_GET[$key] = FilterData($value); } include OS_PAGE_PATH . "registration_login_page.php"; include OS_PAGE_PATH . "add_comment_page.php"; //Update last_login on active sessions after 15 min. if (os_is_logged() and isset($_SESSION["logged"]) and $_SESSION["logged"] + 60 * 15 <= time()) { $LastLogin = $db->update(OSDB_USERS, array("user_last_login" => (int) time()), "user_id = '" . (int) $_SESSION["user_id"] . "'"); } //If "u" is not a number, found in the database this user (if exists) if (isset($_GET["u"]) and !is_numeric($_GET["u"])) { $uid = OS_StrToUTF8(trim($_GET["u"])); $sql = ""; if (isset($_GET["game_type"])) { $game_type = (int) $_GET["game_type"]; $sql = "AND alias_id = '" . $game_type . "' "; } else { $sth = $db->prepare("SELECT * FROM " . OSDB_ALIASES . " WHERE default_alias = 1 LIMIT 1"); $result = $sth->execute(); if ($sth->rowCount() >= 1) { $row = $sth->fetch(PDO::FETCH_ASSOC); $sql = " AND alias_id = '" . $row["alias_id"] . "' "; } } $sth = $db->prepare("SELECT *\n\t FROM " . OSDB_STATS . " as s WHERE s.player = :player {$sql} ORDER BY id DESC LIMIT 1"); $sth->bindValue(':player', $uid, PDO::PARAM_STR); $result = $sth->execute();
<?php if (!isset($website)) { header('HTTP/1.1 404 Not Found'); die; } $errors = ""; ?> <div align="center"> <h2>Ban Appeals</h2> <?php if (isset($_POST["answer"]) and strlen($_POST["answer"]) >= 2) { $answer = OS_StrToUTF8($_POST['answer']); $answer = PrepareTextDB(strip_tags($answer)); $t = safeEscape($_GET["t"]); $player = safeEscape($_GET["edit"]); $sth = $db->prepare("UPDATE " . OSDB_APPEALS . " SET resolved_text = '" . $answer . "', resolved = '" . $_SESSION["username"] . "' WHERE LOWER(player_name) = LOWER('" . $player . "') AND added = '" . $t . "' LIMIT 1"); $result = $sth->execute(); if (isset($_POST["email"]) and $_POST["email"] == 1) { $sth = $db->prepare("SELECT * FROM " . OSDB_USERS . " WHERE LOWER(bnet_username) = LOWER('" . $player . "') LIMIT 1"); $result = $sth->execute(); $row = $sth->fetch(PDO::FETCH_ASSOC); if (isset($_SESSION["adm_email_send"]) and $_SESSION["adm_email_send"] == $row["user_email"]) { $dontSend = 1; } //send only one email (when edit) if (!empty($row["user_email"]) and !isset($dontSend)) { $message = "You have just received a message from " . $_SESSION["username"] . "<br />"; $message .= "<br />~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />"; $message .= convEnt($answer);
/*header("location: http://ohsystem.net/home/?error"); die();*/ $errors .= "<div>" . $lang["error_invalid_login"] . "</div>"; } else { $errors = "<div>" . $lang["error_invalid_login"] . "</div>"; } } } //REGISTER if (isset($_GET["login"]) and !is_logged() and isset($_POST["register_"])) { if ($UserActivation == 2) { require_once OS_PLUGINS_DIR . 'index.php'; os_init(); header('location: ' . OS_HOME . ''); die; } $username = OS_StrToUTF8($_POST["reg_un"]); $username = EscapeStr(trim($username)); $email = safeEscape(trim($_POST["reg_email"])); $email = strtolower($email); $password = safeEscape($_POST["reg_pw"]); $password2 = safeEscape($_POST["reg_pw2"]); $registration_errors = ""; $AllowedCharacters = '0123456789QWERTZUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklyxcvbnmљњертзуиопшђасдфгхјклчћжѕџцвбнмšđč枊ĐČĆŽЉЊЕРТЗУИОПШЂАСДФГХЈКЛЧЋЖЅЏЦВБНМ_-'; if (!preg_match('/^[' . $AllowedCharacters . ']+$/', $username)) { $registration_errors .= "<div>" . $lang["error_username"] . "</div>"; } //die($registration_errors." - ".$username); if (!preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,6}\$/i", $email)) { $registration_errors .= "<div>" . $lang["error_email"] . "</div>"; } if (strlen($username) <= 2) {
function OS_ParseGameLog($log_data) { /* //WRONG !!!! 1 - LobbyChatLog 2 - BotLobbyLog 3 - BotGameLog 4 - GameInfo (k/d/a/t/r) 5 - GameChatLog 6 - Channel, not added yet O_o 0 - GameInfo (k/d/a/t/r) 1 - GameChatLog 2 - LobbyChatLog 3 - BotGameLog 4 - BotLobbyLog 5 - Channel */ ## k - KILL ## ## s - SUICIDE ## ## sek - SENT KILL ## ## sck - SCOU KILL ## ## a - ASSIST ## ## tok - TOWER KILL ## ## setk - SENT TOWER KILL ## ## sctk - SCOU TOWER KILL ## ## rk - RAX KILL ## ## serk - SENT RAX KILL ## ## scrk - SCOU RAX KILL ## ## lu - LEVEL UP ## ## sw - SWAP ## ## hp - HERO PICK ## ## ftk - FROZEN THRONE GOT HURT ## ## wtk - WORLD TREE GOT HURT ## ## ally - ALLY CHAT ## ## all - ALL CHAT ## ## l - LOBBYLOG ## ## bgm - BOTGAMELOGDATA ## ## blm - BOTLOBBYLOGDATA ## ## um - USER MESSAGE ## ## uc - USER JOIN ## ## left - USER LEFT ## ## bm - BOT MESSAGE ## /* NEW FIELDS */ ## rosh - ROSHAN (Killer = Player1, Sentinel or Scourge ) ## ## ap - AEGIS PICK ## ## ad - AEGIS DROP ## ## mode - MODE? ## ## rs - STORED A RUNE IN A BOTTLE ## ## ru - USED A RUNE ## ## inv - ITEM ## - too many infos (SPAM CHAT) - deprecated ## fb - FIRST BLOOD ## dk, tk, ul, rk - DOUBLE KILL, TRIPPLE KILL, ULTRA KILL, RAMPAGE global $lang; global $LiveShowAegis; global $LiveShowSwaps; global $LiveShowHeroPicks; global $LiveShowPlayerLevels; global $LiveShowKills; global $LiveShowAssists; global $LiveShowSuicides; global $LiveShowRunes; global $LiveShowTowerKills; global $LiveShowRoshanKill; $DataArray = array_reverse(explode("\n", $log_data)); $Final = ""; $ASSISTS = ""; $GameType = ""; $OUTPUT = ""; $W = 24; $H = 24; //Icon dimensions 24 X 24 foreach ($DataArray as $Data) { $HTML = ""; $OUTPUT = ""; $Log = explode("\t", $Data); $type = $Log[0]; $p1 = ""; $p2 = ""; // if (isset($Log[1]) AND $Log[1]!= '-' ) $ChatID = $Log[1]; else $ChatID = ""; if (isset($Log[1]) and $Log[1] != '-') { $event = $Log[1]; } else { $event = ""; } if (isset($Log[2]) and $Log[2] != '-') { if ($Log[2] == "Sentinel") { $p1 = "Sentinel"; } else { if ($Log[2] == "Scourge") { $p1 = "Scourge"; } else { $p1 = "<a target='_blank' href='" . OS_HOME . "?u=" . $Log[2] . "'>" . $Log[2] . "</a>"; } } } if (isset($Log[3]) and $Log[3] != '-') { if ($Log[3] == "Sentinel") { $p2 = "Sentinel"; } else { if ($Log[3] == "Scourge") { $p2 = "Scourge"; } else { $p2 = "<a target='_blank' href='" . OS_HOME . "?u=" . $Log[3] . "'>" . $Log[3] . "</a>"; } } } if (isset($Log[4]) and $Log[4] != '-') { $h1 = $Log[4]; } else { $h1 = ""; } if (isset($Log[5]) and $Log[5] != '-') { $h2 = $Log[5]; } else { $h2 = ""; } if (isset($Log[6]) and $Log[6] != '-') { $GameTime = "<span class='GameTimeLog'>" . $Log[6] . "</span>"; } else { $GameTime = ""; } if (isset($Log[7]) and $Log[7] != '-') { $Message = OS_StrToUTF8(trim($Log[7])); } else { $Message = ""; } //SKIPPING playerlist AND type-6 (kda and hid) if ($event != "pl" and $type != 6 and $event != "whisp") { //Get Hero ICONS if (!empty($h1) and $h1 != '-') { $h1 = '<img class="imgvalign" src="' . OS_HOME . 'img/heroes/' . strtoupper($h1) . '.gif" alt="" width="' . $W . '" />'; } else { $h1 = ""; } if (!empty($h2) and $h2 != '-') { $h2 = '<img class="imgvalign" src="' . OS_HOME . 'img/heroes/' . strtoupper($h2) . '.gif" alt="" width="' . $H . '" />'; } else { $h2 = ""; } //Get log type if ($type == 4 and $event != "k") { $GameType = '' . $lang["gl_system"] . ''; } if ($type == 1) { $GameType = '' . $lang["gl_lobby"] . ''; } if ($type == 3 or $type == 2) { $GameType = $lang["gl_bot"]; } if ($type == 5) { $GameType = "[" . strtoupper($event) . "]"; } $DeadHero = '<span class="killX">X</span>'; $DeadHero = '<img class="killX" src="' . OS_HOME . 'img/loser.png" width="20" height="20" />'; if ($event == "k" or $event == "sek" or $event == "sck") { $KillCSS = " gl_killbackground "; } else { $KillCSS = ""; } if ($type == 3 or $type == 2) { $KillCSS = " gl_botmessage"; } $s = "<div class='LiveGamesSingleMessage" . $KillCSS . "'>"; $e = "</div>"; if ($type == 1 and !empty($Message)) { $OUTPUT = "{$s} {$GameTime} {$GameType} {$h1} <b>{$p1}</b> {$h2} <b>{$p2}</b> {$Message} {$e}"; //Don't display user this command!!! // Grief: !pw wont be displayed, we don't send any datas from it, we breack it and leave it local. Reg isnt a gamecommand, only possible by whisp ;) // Neubivljiv: IT WAS LONG TIME AGO, WHEN COMMAND IS DISPLAYED TO ALL USERS... if (substr($Message, 0, 3) == "!pw") { $OUTPUT = ""; } if (substr($Message, 0, 3) == "!reg") { $OUTPUT = ""; } } if ($type == 4) { if ($event == "mode") { $OUTPUT = "{$s}<span class='gl_gamemode'>{$GameTime} {$GameType} " . $lang["gl_mode"] . " {$Message}.</span>{$e}"; } if (!empty($p1)) { //FIRST BLOOD if ($event == "fb") { //Bugged heroe icons... $OUTPUT = "{$s}<span class='gl_playerkill'>{$GameTime} {$GameType} <b>{$p1}</b> <!--{$h1}--> " . $lang["gl_killed"] . " <!--{$h2}--> {$DeadHero} <b>{$p2}</b> for first blood</span>{$e}"; } //OK...HERE IS ITEM PICK - DEPRECATED . TOO MANY SPAMS if ($event == "inv" and isset($SHOW_ITEMS)) { //SHOULD BE LOADED ONLY ONCE --->> TO DO ->>> TOO LAZY NOW $ItemFilePath = "inc/cache/ItemList.php"; if (!file_exists("inc/cache/ItemList.php")) { $ItemFilePath = "../inc/cache/ItemList.php"; } if (file_exists($ItemFilePath)) { include $ItemFilePath; foreach ($ItemsList as $Item) { if (strtolower($Item["itemid"]) == strtolower($Message)) { $icon = $Item["icon"]; } } if (isset($icon)) { $OUTPUT = "{$s}<span class='gl_aegis'>{$GameTime} {$GameType} {$h1} <b>{$p1}</b> " . $lang["gl_item"] . " <img src='" . OS_HOME . "img/items/{$icon}' width='" . $W . "' height='" . $H . "' class='imgvalign' /></span>{$e}"; } } } //AEGIS if ($event == "ap" and $LiveShowAegis == 1) { $OUTPUT = "{$s}<span class='gl_aegis'>{$GameTime} {$GameType} {$h1} <b>{$p1}</b> " . $lang["gl_picked"] . " <img src='" . OS_HOME . "img/items/BTNArcaniteArmor.gif' width='" . $W . "' height='" . $H . "' class='imgvalign' /> Aegis.</span>{$e}"; } if ($event == "ad" and $LiveShowAegis == 1) { $OUTPUT = "{$s} {$GameTime} {$GameType} {$h1} <b>{$p1}</b> lost <img src='" . OS_HOME . "img/items/BTNArcaniteArmor.gif' width='" . $W . "' height='" . $H . "' class='imgvalign' /> Aegis.{$e}"; } //SWAP if ($event == "sw" and $LiveShowSwaps == 1) { $OUTPUT = "{$s}<span class='gl_swap'>{$GameTime} {$GameType} {$h1} <b>{$p1}</b> " . $lang["gl_swap"] . " {$h2} <b>{$p2}</b></span>{$e}"; } //GAME MODE //HERO PICK AND PLAYER LEVEL if ($event == "hp" and $LiveShowHeroPicks == 1) { $OUTPUT = "{$s}<span class='gl_heropick'>{$GameTime} {$GameType} <b>{$p1}</b> " . $lang["gl_heropick"] . " {$h1}.{$e}"; } if ($event == "lu" and $LiveShowPlayerLevels == 1) { $OUTPUT = "{$s}<span class='gl_playerlevel'>{$GameTime} {$GameType} {$h1} <b>{$p1}</b> " . $lang["gl_level"] . " {$Message}.</span>{$e}"; } //KILLS + ASSISTS if ($LiveShowKills == 1) { if ($event == "k" or $event == "sek" or $event == "sck" or $event == "a") { if ($event == "k" or $event == "sek" or $event == "sck") { if (!empty($ASSISTS)) { $txt = " <div class='gl_assistWrap'><b>" . $lang["gl_assists"] . "</b> <span class='gl_assist'>"; $ASSISTS = substr($ASSISTS, 0, strlen($ASSISTS) - 2) . "</span></div>"; } else { $txt = ""; } $OUTPUT .= "{$s}<span class='gl_playerkill'>{$GameTime} {$GameType} <b>{$p1}</b> {$h1} " . $lang["gl_killed"] . " {$h2} {$DeadHero} <b>{$p2}</b></span>. {$txt}" . $ASSISTS . "{$e}"; $ASSISTS = ""; } if ($event == "a" and $LiveShowAssists == 1) { $ASSISTS .= " {$h1} <b>{$p1}</b>, "; } } } //SUICIDE, RUNES if ($event == "s" and $LiveShowSuicides == 1) { $OUTPUT = "{$s}<span class='gl_suicide'>{$GameTime} {$GameType} {$h1} <b>{$p1}</b> " . $lang["gl_suicide"] . "</span>{$e}"; } if ($event == "ru" and $LiveShowRunes == 1) { $OUTPUT = "{$s}<span class='gl_rune'>{$GameTime} {$GameType} {$h1} <b>{$p1}</b> " . $lang["gl_used"] . " {$Message} " . $lang["gl_rune"] . "</span>{$e}"; } if ($event == "rs" and $LiveShowRunes == 1) { $OUTPUT = "{$s}<span class='gl_rune'>{$GameTime} {$GameType} {$h1} <b>{$p1}</b> " . $lang["gl_stored"] . " {$Message} " . $lang["gl_rune"] . "</span>{$e}"; } //TOWER if ($LiveShowTowerKills == 1) { if ($event == "tok" or $event == "setk" or $event == "sctk") { $OUTPUT = ""; $icon = "<img src='" . OS_HOME . "img/setower.gif' width='" . $W . "' height='" . $H . "' class='imgvalign' />"; if ($event == "sctk") { $icon = "<img src='" . OS_HOME . "img/setower.gif' width='" . $W . "' height='" . $H . "' class='imgvalign' />"; } if ($event == "setk") { $icon = "<img src='" . OS_HOME . "img/sctower.gif' width='" . $W . "' height='" . $H . "' class='imgvalign' />"; } $OUTPUT = "{$s}<span class='gl_towerkill'>{$GameTime} {$GameType} {$h1} <b>{$p1}</b> " . $lang["gl_killed_t"] . " {$icon} {$DeadHero} <b>{$p2}</b> " . $lang["gl_tower"] . " </span>{$e}"; } } //RAX if ($event == "rk" or $event == "serk" or $event == "scrk") { $OUTPUT = ""; $icon = "<img src='" . OS_HOME . "img/semrax.gif' width='" . $W . "' height='" . $H . "' class='imgvalign' />"; if ($event == "serk") { $icon = "<img src='" . OS_HOME . "img/semrax.gif' width='" . $W . "' height='" . $H . "' class='imgvalign' />"; } if ($event == "scrk") { $icon = "<img src='" . OS_HOME . "img/scmrax.gif' width='" . $W . "' height='" . $H . "' class='imgvalign' />"; } $OUTPUT = "{$s}<span class='gl_raxkill'>{$GameTime} {$GameType} {$h1} <b>{$p1}</b> " . $lang["gl_killed_t"] . " {$icon} {$DeadHero} <b>{$p2}</b> " . $lang["gl_rax"] . "</span>{$e}"; } //WORLD TREE if ($event == "ftk" or $event == "wtk") { $OUTPUT = "{$s}<span class='gl_worldtree'>{$GameTime} {$GameType} <b>{$p2}</b> " . $lang["gl_attack"] . " {$Message}%.</span>{$e}"; } //ROSHAN KILL if ($event == "rosh" and $LiveShowRoshanKill == 1) { $OUTPUT = "{$s}<span class='gl_roshan'>{$GameTime} {$GameType} <img src='" . OS_HOME . "img/roshan.gif' width='" . $W . "' height='" . $H . "' class='imgvalign' /> <b>Roshan</b> " . $lang["gl_killed_by"] . " <b>{$p1}</b>.</span>{$e}"; } } } if (($type == 2 or $type == 3) and !empty($Message)) { if ($Message == "1. . .") { $OUTPUT = "{$s}<img class='imgvalign' src='" . OS_HOME . "img/gamestarted.gif' alt='' width='160' height='24' /> <b>" . $lang["gl_game_started"] . "</b> {$e}"; } $OUTPUT .= "{$s} {$GameTime} {$GameType} {$Message} {$e}"; } //Scourge and Sentinel if ($type == 5 and !empty($Message) and !empty($p1)) { if ($event == "Scourge") { $color = "scourge"; } else { if ($event == "Sentinel") { $color = "sentinel"; } else { if ($event == "all") { $color = "all"; } } } $OUTPUT = "{$s} {$GameTime} <span class='{$color}'>{$GameType}</span> {$h1} <b>{$p1}</b>: {$h2} {$p2} {$Message}{$e}"; } //FILTER - for non-logged users if (!os_is_logged()) { $s = "<div class='LiveGamesSingleMessage LoginToViewLog'>"; $e = "</div>"; if ($event == "ap" and $LiveShowAegis == 2) { $OUTPUT = "{$s}" . $lang["gl_login"] . "{$e}"; } if ($event == "ad" and $LiveShowAegis == 2) { $OUTPUT = "{$s}" . $lang["gl_login"] . "{$e}"; } if ($event == "sw" and $LiveShowSwaps == 2) { $OUTPUT = "{$s}" . $lang["gl_login"] . "{$e}"; } if ($event == "hp" and $LiveShowHeroPicks == 2) { $OUTPUT = "{$s}" . $lang["gl_login"] . "{$e}"; } if ($event == "lu" and $LiveShowPlayerLevels == 2) { $OUTPUT = "{$s}" . $lang["gl_login"] . "{$e}"; } if ($LiveShowKills == 2 and ($event == "k" or $event == "sek" or $event == "sck" or $event == "a")) { $OUTPUT = "{$s}" . $lang["gl_login"] . "{$e}"; } if ($event == "s" and $LiveShowSuicides == 2) { $OUTPUT = "{$s}" . $lang["gl_login"] . "{$e}"; } if ($event == "ru" and $LiveShowRunes == 2) { $OUTPUT = "{$s}" . $lang["gl_login"] . "{$e}"; } if ($event == "rosh" and $LiveShowRoshanKill == 2) { $OUTPUT = "{$s}" . $lang["gl_login"] . "{$e}"; } if ($LiveShowTowerKills == 2 and ($event == "tok" or $event == "setk" or $event == "sctk")) { $OUTPUT = "{$s}" . $lang["gl_login"] . "{$e}"; } } //Finally OUTPUT - one line if (!empty($OUTPUT)) { $HTML = '' . $OUTPUT . ''; } //PLAYER LIST - SKIP if ($event == "pl") { $HTML = ""; } $Final .= $HTML; } } return $Final; }
$pid = safeEscape((int) $_GET["post_id"]); $del_1 = $db->exec("DELETE FROM " . OSDB_COMMENTS . " WHERE id = '" . (int) $id . "' AND post_id = '" . (int) $pid . "' LIMIT 1"); $sth = $db->prepare("SELECT COUNT(*) FROM " . OSDB_COMMENTS . " WHERE post_id=:post_id LIMIT 1"); $sth->bindValue(':post_id', (int) $pid, PDO::PARAM_INT); $result = $sth->execute(); $r = $sth->fetch(PDO::FETCH_NUM); $TotalComments = $r[0]; $update = $db->exec("UPDATE " . OSDB_NEWS . " SET comments = '" . (int) $TotalComments . "' WHERE news_id = '" . (int) $pid . "' "); header('location: ' . OS_HOME . '?post_id=' . $pid . '#comments'); die; } if (isset($_POST["add_comment"]) and os_is_logged() and isset($_GET["post_id"]) and is_numeric($_GET["post_id"]) and isset($_SESSION["code"]) and isset($_POST["code"]) and isset($_POST["pid"])) { require_once OS_PLUGINS_DIR . 'index.php'; os_init(); $id = safeEscape((int) $_GET["post_id"]); $text = OS_StrToUTF8($_POST["post_comment"]); $text = PrepareTextDB($text); //$text = EscapeStr( ($text) ); //$text = (($text)); $errors = ""; //Check if comments is allowed for this post $sth = $db->prepare("SELECT * FROM " . OSDB_NEWS . " WHERE news_id=:news_id AND allow_comments = 1"); $sth->bindValue(':news_id', (int) $id, PDO::PARAM_INT); $result = $sth->execute(); if ($sth->rowCount() <= 0) { $errors .= "<div>" . $lang["error_comment_not_allowed"] . "</div>"; } if ($_SESSION["code"] != $_POST["code"]) { $errors .= "<div>" . $lang["error_invalid_form"] . "</div>"; } if ($_POST["pid"] != $id) {