л2 топ
2 ответов98 просмотровСейчас просматривают: 1
· 29.12.2009, 19:25
Подскажите что мне делать.Стоит движок stress 8.0
Суть проблеммы в том,что не могу получить приз,проголосовал на л2топ но когда ввожу у себя на сайте получить приз мне пишет что такого персонажа не существует(ввожу всё верно) и + в бд в табличке л2 топа почемуто нечего не происходит..Подскажите как настроить скрипт л2 топа.
0
· 29.12.2009, 19:46
Раскрывающийся текст
<?php
/**
* STRESS WEB
* @author Alexandr Yuschenko (S.T.R.E.S.S.)
* @copyright 2008 - 2009 STRESS WEB
* @version 8.0
* @web http://stressweb.ru
*/
if (!defined("STRESSWEB"))
die("Hacking!!!");
$_act = (isset($_POST["act"])) ? phpInjection(sqlInjection($_POST["act"])) : "";
if ($config["l2top"]["enable"] == "1")
{
$_vote_error = "";
$tpl->get_template("vote.tpl");
$tpl->set_var('{voteID}', $config["l2top"]["id"]);
if ($_act == "")
{
for ($i = 0; $i < $l2db["gameserver"]["count"]; $i++)
{
if ($l2db["gameserver"][$i]["on"] == "1")
{
$tmpServerList[$i] = $l2db["gameserver"][$i]["title"];
}
}
$tpl->set_block("'\\[check\\](.*?)\\[/check\\]'si", "\\1");
$tpl->set_block("'\\[vote\\](.*?)\\[/vote\\]'si", "");
$tpl->set_block("'\\[error\\](.*?)\\[/error\\]'si", "");
$tpl->set_var('{message}', $config["l2top"]["message"]);
$tpl->set_var('{selectServer}', select("server", $tmpServerList, $_serv_id, "style='width: 125px;'"));
$tpl->set_var("{l2sec_code}", "<span id=\"sw-captcha\"><img src=\"/inc/captcha/antibot.php\" alt=\"Код безопасности\" border=\"0\" /> <br /><a onclick=\"reload(); return false;\" href=\"#\">Обновить код</a></span>");
}
/**************************
* Vote
**************************/
if ($_act == "check")
{
$_vote_nick = $ldb->safe($_POST["character"]);
$_vote_sec_code = $ldb->safe($_POST["l2sec_code"]);
$_sess_sec_code = $_SESSION["sw_captcha"];
//Розкомментировать для отключения каптчи
//$_vote_sec_code = 1;
//$_sess_sec_code = 1;
if (empty($_vote_error) && ($_vote_nick == "" || $_vote_sec_code == ""))
{
$_vote_error = "<div class='error'>Вы не ввели ник персонажа или код с картинки. <a href='index.php?f=vote'>Назад</a></div>";
}
if (empty($_vote_error) && ($_vote_sec_code != $_sess_sec_code || !$_sess_sec_code))
{
$_vote_error = "<div class='error'>Введенный код не совпадает с указанным на картинке! <a href='index.php?f=vote'>Назад</a></div>";
}
if (empty($_vote_error) and (eregi('[^a-zA-Z0-9\(\)\|\_\-]', $_vote_nick) || is_numeric($_vote_nick)))
{
$_vote_error = "<div class='error'>Имя вашего игрока содержит запрещенные символы. <a href='index.php?f=vote'>Назад</a></div>";
}
if (empty($_vote_error))
{
$query = $gdb[$_serv_id]->query($gdb[$_serv_id]->_parse_query($qList[$l2db_gs]["l2top"]["getChar"], array("name" => $_vote_nick)));
if ($gdb[$_serv_id]->numrows($query) == 1)
{
$prefixList = array_map("trim", explode(",", $config["l2top"]["prefixList"]));
$server = (trim($config["l2top"]["prefixList"]) != "" && isset($prefixList[$_serv_id])) ? $prefixList[$_serv_id] : $_serv_id;
if ($config["l2top"]["prefixLink"])
{
$url = "http://l2top.ru/vote/{$config["l2top"]["id"]}/?prefix={$server}";
$_vote_name = $_vote_nick;
}
else
{
$url = "http://l2top.ru/vote/{$config["l2top"]["id"]}/";
$_vote_name = $server . "-" . $_vote_nick;
}
$tpl->set_block("'\\[check\\](.*?)\\[/check\\]'si", "");
$tpl->set_block("'\\[vote\\](.*?)\\[/vote\\]'si", "\\1");
$tpl->set_block("'\\[error\\](.*?)\\[/error\\]'si", "");
$tpl->set_var('{url}', $url);
$tpl->set_var('{name}', $_vote_name);
$tpl->set_var('{character}', $_vote_nick);
}
else
{
$_vote_error = "<div class='error'>Такой игрок на нашем сервере не существует. <a href='index.php?f=vote'>Назад</a></div>";
}
}
}
if ($_act == "get")
{
$name = $ldb->safe($_POST["name"]);
$prefixList = array_map("trim", explode(",", $config["l2top"]["prefixList"]));
print_r($prefixList);
$lines = file($config["l2top"]["url"]);
$top = array();
$n = 0;
foreach ($lines as $line)
{
$date = substr($line, 0, 19);
$char = rtrim(substr($line, 20), "\n");
if (preg_match("#([a-zA-Z0-9]+)\-([a-zA-Z0-9 -]*)#", $char, $char_matches))
{
$server = array_search($char_matches[1], $prefixList);
if ($server === false)
{
$server = false;
$character = "";
}
else
{
$character = $char_matches[2];
$server = $server;
}
}
else
{
$server = $config["l2top"]["server"];
$character = $char;
}
if (isset($gdb[$server]) == false)
{
$server = $config["l2top"]["server"];
$character = "";
}
if (strtolower($name) == strtolower($character))
{
$top[$n]['nick'] = $character;
$top[$n]['server'] = $server;
$top[$n]['date'] = $date;
$n++;
}
}
if (empty($top))
{
$_vote_error = "<div class='error'>Ваш голос в L2Top.ru не найден. <a href='index.php?f=vote'>Назад</a></div>";
}
else
{
$bonus_count = 0;
$bonus_name = "";
$status = false;
for ($i = 0; $i < count($top); $i++)
{
$query = $ldb->query("SELECT `id` FROM `l2top` WHERE `nick`='{$top[$i]["nick"]}' AND `date` = '{$top[$i]["date"]}'");
if ($ldb->numrows($query) == 0)
{
$status = true;
$server = $top[$i]["server"];
$success = false;
$l2db_gs = $versionList[$l2db["gameserver"][$server]["version"]];
include_once INC_DIR . '/l2db/l2j_' . $l2db_gs . '.php';
$character_data = $gdb[$server]->fetch_array($gdb[$server]->query($gdb[$server]->_parse_query($qList[$l2db_gs]["l2top"]["getChar"], array("name" => $top[$i]["nick"]))));
if ($config["l2top"]["bonus"] == "l2money")
{
$ldb->query("INSERT INTO `l2top` SET `nick` = '{$top[$i]["nick"]}', `date` = '{$top[$i]["date"]}', `server` = '{$server}', `success`='0'");
$bonus_name = $config["wm"]["money"];
$money = floatval($config["l2top"]["l2money_count"]);
$bonus_count += $money;
$query = $ldb->query("SELECT `money` FROM `stress_donate_money` WHERE `account`='{$character_data["account_name"]}'");
if ($ldb->numrows($query) == 1)
{
$ldb->query("UPDATE `stress_donate_money` SET `money` = `money` + {$money} WHERE `account` = '{$character_data["account_name"]}'");
}
else
{
$ldb->query("INSERT INTO `stress_donate_money` SET `account`='{$character_data["account_name"]}', `money` = '{$money}'");
}
$success = true;
}
else
{
$bonus_name = "бонусных предметов";
if ($config["l2top"]["method"] == "telnet" && $character_data["online"] != 1)
{
$_vote_error = "<div class='error'>Ваш персонаж должен быть онлайн!</div>";
} elseif ($config["l2top"]["method"] == "mysql" && $character_data["online"] == 1)
{
$_vote_error = "<div class='error'>Ваш персонаж должен быть оффлайн!</div>";
} elseif ($config["l2top"]["method"] != "telnet" && $config["l2top"]["method"] != "mysql")
{
$_vote_error = "<div class='error'>Ошибка, попробуйте еще раз!</div>";
}
if (empty($_vote_error) && $config["l2top"]["method"] == "telnet")
{
$ldb->query("INSERT INTO `l2top` SET `nick` = '{$top[$i]["nick"]}', `date` = '{$top[$i]["date"]}', `server` = '{$server}', `success`='0'");
$host = $l2db["gameserver"][$server]["server"]["host"];
$port = $l2db["gameserver"][$server]["telnet"]["port"];
$timeout = $l2db["gameserver"][$server]["telnet"]["timeout"];
$telnet = @fsockopen($host, $port, $errno, $errstr, $timeout);
if ($telnet)
{
@fputs($telnet, $l2db["gameserver"][$server]["telnet"]["pass"]);
@fputs($telnet, "\r\n");
if (!empty($l2db["gameserver"][$server]["telnet"]["gmname"]))
{
@fputs($telnet, $l2db["gameserver"][$server]["telnet"]["gmname"]);
@fputs($telnet, "\r\n");
}
fputs($telnet, "give {$top[$i]["nick"]} {$config["l2top"]["itemID"]} {$config["l2top"]["item_count"]}");
$success = true;
$bonus_count += $config["l2top"]["item_count"];
}
@fclose($telnet);
}
if (empty($_vote_error) && $config["l2top"]["method"] == "mysql")
{
$ldb->query("INSERT INTO `l2top` SET `nick` = '{$top[$i]["nick"]}', `date` = '{$top[$i]["date"]}', `server` = '{$server}', `success`='0'");
$query = $gdb[$server]->query($gdb[$server]->_parse_query($qList[$l2db_gs]["l2top"]["getItem"], array("ownerID" => $character_data["charID"], "itemID" => $config["l2top"]["itemID"])));
if ($item = $gdb[$server]->fetch_array($query))
{
$gdb[$server]->query($gdb[$server]->_parse_query($qList[$l2db_gs]["l2top"]["setItem"], array("ownerID" => $character_data["charID"], "itemID" => $item["item_id"], "count" => $item["count"] + $config["l2top"]["item_count"])));
$success = true;
$bonus_count += $config["l2top"]["item_count"];
}
else
{
$object_id = $gdb[$server]->fetch_array($gdb[$server]->query($gdb[$server]->_parse_query($qList[$l2db_gs]["l2top"]["getMax"])));
$gdb[$server]->query($gdb[$server]->_parse_query($qList[$l2db_gs]["l2top"]["insItem"], array("charID" => $character_data["charID"], "objectID" => $object_id["max"], "itemID" => $config["l2top"]["itemID"], "count" => $config["l2top"]["item_count"])));
if ($gdb[$server]->affectedrows() > 0)
{
$success = true;
$bonus_count += $config["l2top"]["item_count"];
}
}
}
}
if ($success == true)
{
$ldb->query("UPDATE `l2top` SET `success`='1' WHERE `nick` = '{$top[$i]["nick"]}' AND `date` = '{$top[$i]["date"]}'");
}
}
}
if ($status == false)
{
$_vote_error .= "<div class='error'>Вы уже получали призы. <a href='index.php?f=vote'>Назад</a></div>";
}
else
{
$_vote_error .= "<div class='noerror'>Вам зачислено {$bonus_name}: {$bonus_count}</div>";
}
}
}
if (!empty($_vote_error))
{
$tpl->set_block("'\\[check\\](.*?)\\[/check\\]'si", "");
$tpl->set_block("'\\[vote\\](.*?)\\[/vote\\]'si", "");
$tpl->set_block("'\\[error\\](.*?)\\[/error\\]'si", "\\1");
$tpl->set_var("{error}", $_vote_error);
}
/**************************
* Top voters
**************************/
if ($config["l2top"]["top"] == "1")
{
$tpl->set_block("'\\[topVoters\\](.*?)\\[/topVoters\\]'si", "\\1");
$tpl->set_var("{top_count}", $config["l2top"]["top_count"]);
if (cache_get("l2vote_time") > $_TIME && $config["cache"]["allow"])
{
$votersList = cache_get("l2vote");
}
else
{
$votersList = "
<table cellpadding='3' cellspacing='3' width='90%' id='voteTab'>
<tr>
<th width='35'>#</th>
<th width=''>Персонаж</th>
<th width='70'>Голосов</th>
</tr>";
$month = date("m", time());
$sel_voters = $ldb->query($ldb->_parse_query($qList[$l2db_ls]["l2top"]["getVotersList"], array("time" => $month, "limit" => $config["l2top"]["top_count"])));
$n = 1;
while ($voters_data = $ldb->fetch_array($sel_voters))
{
$votersList .= "
<tr>
<td>{$n}</td>
<td>{$voters_data["nick"]}</td>
<td>{$voters_data["votes"]}</td>
</tr>";
$n++;
}
$votersList .= "</table>";
if ($config["cache"]["allow"])
{
cache_set("l2vote_time", $_TIME + 60 * $config["cache"]["vote"]);
cache_set("l2vote", $votersList);
}
}
$tpl->set_var("{votersList}", $votersList);
}
else
{
$tpl->set_block("'\\[topVoters\\](.*?)\\[/topVoters\\]'si", "");
}
$tpl->parse("content");
$tpl->clear();
}
else
{
$tpl->result["content"] = "<div class='error'>Система получения призов L2Top отключена!</div>";
}
?>
/**
* STRESS WEB
* @author Alexandr Yuschenko (S.T.R.E.S.S.)
* @copyright 2008 - 2009 STRESS WEB
* @version 8.0
* @web http://stressweb.ru
*/
if (!defined("STRESSWEB"))
die("Hacking!!!");
$_act = (isset($_POST["act"])) ? phpInjection(sqlInjection($_POST["act"])) : "";
if ($config["l2top"]["enable"] == "1")
{
$_vote_error = "";
$tpl->get_template("vote.tpl");
$tpl->set_var('{voteID}', $config["l2top"]["id"]);
if ($_act == "")
{
for ($i = 0; $i < $l2db["gameserver"]["count"]; $i++)
{
if ($l2db["gameserver"][$i]["on"] == "1")
{
$tmpServerList[$i] = $l2db["gameserver"][$i]["title"];
}
}
$tpl->set_block("'\\[check\\](.*?)\\[/check\\]'si", "\\1");
$tpl->set_block("'\\[vote\\](.*?)\\[/vote\\]'si", "");
$tpl->set_block("'\\[error\\](.*?)\\[/error\\]'si", "");
$tpl->set_var('{message}', $config["l2top"]["message"]);
$tpl->set_var('{selectServer}', select("server", $tmpServerList, $_serv_id, "style='width: 125px;'"));
$tpl->set_var("{l2sec_code}", "<span id=\"sw-captcha\"><img src=\"/inc/captcha/antibot.php\" alt=\"Код безопасности\" border=\"0\" /> <br /><a onclick=\"reload(); return false;\" href=\"#\">Обновить код</a></span>");
}
/**************************
* Vote
**************************/
if ($_act == "check")
{
$_vote_nick = $ldb->safe($_POST["character"]);
$_vote_sec_code = $ldb->safe($_POST["l2sec_code"]);
$_sess_sec_code = $_SESSION["sw_captcha"];
//Розкомментировать для отключения каптчи
//$_vote_sec_code = 1;
//$_sess_sec_code = 1;
if (empty($_vote_error) && ($_vote_nick == "" || $_vote_sec_code == ""))
{
$_vote_error = "<div class='error'>Вы не ввели ник персонажа или код с картинки. <a href='index.php?f=vote'>Назад</a></div>";
}
if (empty($_vote_error) && ($_vote_sec_code != $_sess_sec_code || !$_sess_sec_code))
{
$_vote_error = "<div class='error'>Введенный код не совпадает с указанным на картинке! <a href='index.php?f=vote'>Назад</a></div>";
}
if (empty($_vote_error) and (eregi('[^a-zA-Z0-9\(\)\|\_\-]', $_vote_nick) || is_numeric($_vote_nick)))
{
$_vote_error = "<div class='error'>Имя вашего игрока содержит запрещенные символы. <a href='index.php?f=vote'>Назад</a></div>";
}
if (empty($_vote_error))
{
$query = $gdb[$_serv_id]->query($gdb[$_serv_id]->_parse_query($qList[$l2db_gs]["l2top"]["getChar"], array("name" => $_vote_nick)));
if ($gdb[$_serv_id]->numrows($query) == 1)
{
$prefixList = array_map("trim", explode(",", $config["l2top"]["prefixList"]));
$server = (trim($config["l2top"]["prefixList"]) != "" && isset($prefixList[$_serv_id])) ? $prefixList[$_serv_id] : $_serv_id;
if ($config["l2top"]["prefixLink"])
{
$url = "http://l2top.ru/vote/{$config["l2top"]["id"]}/?prefix={$server}";
$_vote_name = $_vote_nick;
}
else
{
$url = "http://l2top.ru/vote/{$config["l2top"]["id"]}/";
$_vote_name = $server . "-" . $_vote_nick;
}
$tpl->set_block("'\\[check\\](.*?)\\[/check\\]'si", "");
$tpl->set_block("'\\[vote\\](.*?)\\[/vote\\]'si", "\\1");
$tpl->set_block("'\\[error\\](.*?)\\[/error\\]'si", "");
$tpl->set_var('{url}', $url);
$tpl->set_var('{name}', $_vote_name);
$tpl->set_var('{character}', $_vote_nick);
}
else
{
$_vote_error = "<div class='error'>Такой игрок на нашем сервере не существует. <a href='index.php?f=vote'>Назад</a></div>";
}
}
}
if ($_act == "get")
{
$name = $ldb->safe($_POST["name"]);
$prefixList = array_map("trim", explode(",", $config["l2top"]["prefixList"]));
print_r($prefixList);
$lines = file($config["l2top"]["url"]);
$top = array();
$n = 0;
foreach ($lines as $line)
{
$date = substr($line, 0, 19);
$char = rtrim(substr($line, 20), "\n");
if (preg_match("#([a-zA-Z0-9]+)\-([a-zA-Z0-9 -]*)#", $char, $char_matches))
{
$server = array_search($char_matches[1], $prefixList);
if ($server === false)
{
$server = false;
$character = "";
}
else
{
$character = $char_matches[2];
$server = $server;
}
}
else
{
$server = $config["l2top"]["server"];
$character = $char;
}
if (isset($gdb[$server]) == false)
{
$server = $config["l2top"]["server"];
$character = "";
}
if (strtolower($name) == strtolower($character))
{
$top[$n]['nick'] = $character;
$top[$n]['server'] = $server;
$top[$n]['date'] = $date;
$n++;
}
}
if (empty($top))
{
$_vote_error = "<div class='error'>Ваш голос в L2Top.ru не найден. <a href='index.php?f=vote'>Назад</a></div>";
}
else
{
$bonus_count = 0;
$bonus_name = "";
$status = false;
for ($i = 0; $i < count($top); $i++)
{
$query = $ldb->query("SELECT `id` FROM `l2top` WHERE `nick`='{$top[$i]["nick"]}' AND `date` = '{$top[$i]["date"]}'");
if ($ldb->numrows($query) == 0)
{
$status = true;
$server = $top[$i]["server"];
$success = false;
$l2db_gs = $versionList[$l2db["gameserver"][$server]["version"]];
include_once INC_DIR . '/l2db/l2j_' . $l2db_gs . '.php';
$character_data = $gdb[$server]->fetch_array($gdb[$server]->query($gdb[$server]->_parse_query($qList[$l2db_gs]["l2top"]["getChar"], array("name" => $top[$i]["nick"]))));
if ($config["l2top"]["bonus"] == "l2money")
{
$ldb->query("INSERT INTO `l2top` SET `nick` = '{$top[$i]["nick"]}', `date` = '{$top[$i]["date"]}', `server` = '{$server}', `success`='0'");
$bonus_name = $config["wm"]["money"];
$money = floatval($config["l2top"]["l2money_count"]);
$bonus_count += $money;
$query = $ldb->query("SELECT `money` FROM `stress_donate_money` WHERE `account`='{$character_data["account_name"]}'");
if ($ldb->numrows($query) == 1)
{
$ldb->query("UPDATE `stress_donate_money` SET `money` = `money` + {$money} WHERE `account` = '{$character_data["account_name"]}'");
}
else
{
$ldb->query("INSERT INTO `stress_donate_money` SET `account`='{$character_data["account_name"]}', `money` = '{$money}'");
}
$success = true;
}
else
{
$bonus_name = "бонусных предметов";
if ($config["l2top"]["method"] == "telnet" && $character_data["online"] != 1)
{
$_vote_error = "<div class='error'>Ваш персонаж должен быть онлайн!</div>";
} elseif ($config["l2top"]["method"] == "mysql" && $character_data["online"] == 1)
{
$_vote_error = "<div class='error'>Ваш персонаж должен быть оффлайн!</div>";
} elseif ($config["l2top"]["method"] != "telnet" && $config["l2top"]["method"] != "mysql")
{
$_vote_error = "<div class='error'>Ошибка, попробуйте еще раз!</div>";
}
if (empty($_vote_error) && $config["l2top"]["method"] == "telnet")
{
$ldb->query("INSERT INTO `l2top` SET `nick` = '{$top[$i]["nick"]}', `date` = '{$top[$i]["date"]}', `server` = '{$server}', `success`='0'");
$host = $l2db["gameserver"][$server]["server"]["host"];
$port = $l2db["gameserver"][$server]["telnet"]["port"];
$timeout = $l2db["gameserver"][$server]["telnet"]["timeout"];
$telnet = @fsockopen($host, $port, $errno, $errstr, $timeout);
if ($telnet)
{
@fputs($telnet, $l2db["gameserver"][$server]["telnet"]["pass"]);
@fputs($telnet, "\r\n");
if (!empty($l2db["gameserver"][$server]["telnet"]["gmname"]))
{
@fputs($telnet, $l2db["gameserver"][$server]["telnet"]["gmname"]);
@fputs($telnet, "\r\n");
}
fputs($telnet, "give {$top[$i]["nick"]} {$config["l2top"]["itemID"]} {$config["l2top"]["item_count"]}");
$success = true;
$bonus_count += $config["l2top"]["item_count"];
}
@fclose($telnet);
}
if (empty($_vote_error) && $config["l2top"]["method"] == "mysql")
{
$ldb->query("INSERT INTO `l2top` SET `nick` = '{$top[$i]["nick"]}', `date` = '{$top[$i]["date"]}', `server` = '{$server}', `success`='0'");
$query = $gdb[$server]->query($gdb[$server]->_parse_query($qList[$l2db_gs]["l2top"]["getItem"], array("ownerID" => $character_data["charID"], "itemID" => $config["l2top"]["itemID"])));
if ($item = $gdb[$server]->fetch_array($query))
{
$gdb[$server]->query($gdb[$server]->_parse_query($qList[$l2db_gs]["l2top"]["setItem"], array("ownerID" => $character_data["charID"], "itemID" => $item["item_id"], "count" => $item["count"] + $config["l2top"]["item_count"])));
$success = true;
$bonus_count += $config["l2top"]["item_count"];
}
else
{
$object_id = $gdb[$server]->fetch_array($gdb[$server]->query($gdb[$server]->_parse_query($qList[$l2db_gs]["l2top"]["getMax"])));
$gdb[$server]->query($gdb[$server]->_parse_query($qList[$l2db_gs]["l2top"]["insItem"], array("charID" => $character_data["charID"], "objectID" => $object_id["max"], "itemID" => $config["l2top"]["itemID"], "count" => $config["l2top"]["item_count"])));
if ($gdb[$server]->affectedrows() > 0)
{
$success = true;
$bonus_count += $config["l2top"]["item_count"];
}
}
}
}
if ($success == true)
{
$ldb->query("UPDATE `l2top` SET `success`='1' WHERE `nick` = '{$top[$i]["nick"]}' AND `date` = '{$top[$i]["date"]}'");
}
}
}
if ($status == false)
{
$_vote_error .= "<div class='error'>Вы уже получали призы. <a href='index.php?f=vote'>Назад</a></div>";
}
else
{
$_vote_error .= "<div class='noerror'>Вам зачислено {$bonus_name}: {$bonus_count}</div>";
}
}
}
if (!empty($_vote_error))
{
$tpl->set_block("'\\[check\\](.*?)\\[/check\\]'si", "");
$tpl->set_block("'\\[vote\\](.*?)\\[/vote\\]'si", "");
$tpl->set_block("'\\[error\\](.*?)\\[/error\\]'si", "\\1");
$tpl->set_var("{error}", $_vote_error);
}
/**************************
* Top voters
**************************/
if ($config["l2top"]["top"] == "1")
{
$tpl->set_block("'\\[topVoters\\](.*?)\\[/topVoters\\]'si", "\\1");
$tpl->set_var("{top_count}", $config["l2top"]["top_count"]);
if (cache_get("l2vote_time") > $_TIME && $config["cache"]["allow"])
{
$votersList = cache_get("l2vote");
}
else
{
$votersList = "
<table cellpadding='3' cellspacing='3' width='90%' id='voteTab'>
<tr>
<th width='35'>#</th>
<th width=''>Персонаж</th>
<th width='70'>Голосов</th>
</tr>";
$month = date("m", time());
$sel_voters = $ldb->query($ldb->_parse_query($qList[$l2db_ls]["l2top"]["getVotersList"], array("time" => $month, "limit" => $config["l2top"]["top_count"])));
$n = 1;
while ($voters_data = $ldb->fetch_array($sel_voters))
{
$votersList .= "
<tr>
<td>{$n}</td>
<td>{$voters_data["nick"]}</td>
<td>{$voters_data["votes"]}</td>
</tr>";
$n++;
}
$votersList .= "</table>";
if ($config["cache"]["allow"])
{
cache_set("l2vote_time", $_TIME + 60 * $config["cache"]["vote"]);
cache_set("l2vote", $votersList);
}
}
$tpl->set_var("{votersList}", $votersList);
}
else
{
$tpl->set_block("'\\[topVoters\\](.*?)\\[/topVoters\\]'si", "");
}
$tpl->parse("content");
$tpl->clear();
}
else
{
$tpl->result["content"] = "<div class='error'>Система получения призов L2Top отключена!</div>";
}
?>
0
Войдите или зарегистрируйтесь чтобы ответить
