battles/church.php

424 lines
22 KiB
PHP
Raw Normal View History

2018-01-28 16:40:49 +00:00
<?php
//session_start();
ini_set("display_errors","1");
ini_set("display_startup_errors","1");
ini_set('error_reporting', E_ALL);
//if ($_SESSION['uid'] == null) header("Location: index.php");
include "config.php";
include "functions.php";
$timeStamp = time();
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;"));
$thisChurch = 'none';
if( $user['align'] == 2 ) {
$thisChurch = 'default';
}
if( $user['align'] == 3 ) {
$thisChurch = 'dark';
}
if( $user['align'] == 7 ) {
$thisChurch = 'light';
}
$getChurch = mysql_fetch_assoc(mysql_query("SELECT * FROM `church_configs` WHERE `id`='" . $thisChurch . "'"));
$resChurch = unserialize($getChurch['data']);
if(isset($_GET['info'])){
$getResource = mysql_fetch_assoc(mysql_query("SELECT * FROM `shop` WHERE `id` = '" . intval($_GET['info']) . "' AND (type=80 or type=81 or type=82 or type=83 or type=84 or type=85 or type=86 or type=87 or type=89)"));
?>
<!DOCTYPE html>
<html>
<head>
<title><? ($getResource ? 'Храм Древних - ' . $getResource['name'] : 'Ошибка ресурса' ) ?></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta http-equiv="Cache-Control" Content="No-Cache">
<meta http-equiv="Pragma" Content="No-Cache">
<meta http-equiv="Expires" Content="0">
<link type="text/css" rel="stylesheet" href="css/main.css" />
<style type="text/css">
body {
margin: 5px;
}
</style>
</head>
<body>
<?
if($getResource){
$getRating = mysql_query("SELECT `uid`, SUM(`val`) as `val` FROM `church_logs` WHERE `key`='" . $getResource['id'] . "' AND `ch`='" . $thisChurch . "' GROUP BY `uid` ORDER BY SUM(`val`) DESC LIMIT 10;");
$ratingCount = mysql_num_rows($getRating);
echo'<table width="100%" height="100%" border="0" cellspacing="1" cellpadding="0">' .
'<tr>' .
'<td align="center" colspan="3">' . ($ratingCount > 0 ? 'Топ ' . $ratingCount . ', ' : '') . 'Материал: <b>' . $getResource['name'] . '</b></td>' .
'</tr>';
if($ratingCount > 0){
$i = 1;
while($row = mysql_fetch_assoc($getRating)){
echo'<tr>' .
'<td align="center" width="25" bgcolor="#' . ($row['uid'] != $user['id'] ? 'C0C0CA' : '999999') . '"><b>' . $i++ . '</b></td>' .
'<td align="center" bgcolor="#' . ($row['uid'] != $user['id'] ? 'C0C0CA' : '999999') . '">' . nick2($row['uid'], true) . '</td>' .
'<td align="center" bgcolor="#' . ($row['uid'] != $user['id'] ? 'C0C0CA' : '999999') . '"><b>' . $row['val'] . '</b> шт.</td>' .
'</tr>';
}
echo'<tr>' .
'<td align="center" colspan="3">&nbsp;</td>' .
'</tr>' .
'<tr>' .
'<td align="center" colspan="2" bgcolor="#C0C0CA">' . nick2($user['id'], true) . '</td>' .
'<td align="center" bgcolor="#C0C0CA"><b>' . intval(mysql_result(mysql_query("SELECT SUM(`val`) as `val` FROM `church_logs` WHERE `key`='" . $getResource['id'] . "' AND `ch`='" . $thisChurch . "' AND `uid`='" . $user['id'] . "' GROUP BY `uid` ORDER BY SUM(`val`) DESC LIMIT 1;"), 0)) . '</b> шт.</td>' .
'</tr>';
}else{
echo '<tr>' .
'<td align="center" colspan="3">Нет данных</td>' .
'</tr>';
}
echo'</table>';
} else {
echo'<center>Ошибка ресурса</center>';
}
echo'</body>' .
'</html>';
exit;
}
?><HTML>
<HEAD>
<link rel="stylesheet" href="css/newstyle_loc4.css" type="text/css">
<link rel="stylesheet" type="text/css" href="css/main.css">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="expires" content="0">
<META HTTP-EQUIV="imagetoolbar" CONTENT="no">
<style>
.aFilter:hover{
-webkit-filter:drop-shadow(0px 0px 2px rgb(255,255,255));
filter:url(#drop-shadow);
-ms-filter:"progid:DXImageTransform.Microsoft.Dropshadow(OffX=0, OffY=0, Color='#FFF')";
filter:"progid:DXImageTransform.Microsoft.Dropshadow(OffX=0, OffY=0, Color='#FFF')";
cursor:pointer;
}
</style>
<style type="text/css">img,div{behavior:url(/i/city/ie/iepngfix.htc)}</style>
<script type="text/javascript" src="/js/jquery.min.js"></script>
<script type="text/javascript" src="/js/tooltip.js"></script>
<script type="text/javascript">
var timeStamp = <?php echo $timeStamp; ?>;
function selecttarget(scrollid){
var targertinput = document.getElementById('target');
targertinput.value = scrollid;
var targetform = document.getElementById('formtarget');
targetform.submit();
}
function show_table(title, script){
var choicehtml = "<form style='display:none' id='formtarget' action='" + script + "' method=POST><input type='hidden' id='target' name='target'>";
choicehtml += "</form><table width='100%' cellspacing='1' cellpadding='0' bgcolor='CCC3AA'>";
choicehtml += "<tr><td align='center'><B>" + title + "</td>";
choicehtml += "<td width='20' align='right' valign='top' style='cursor: pointer' onclick='closehint3(true);'>";
choicehtml += "<big><b>x</td></tr><tr><td colspan='2' id='tditemcontainer'><div id='itemcontainer' style='width:100%'>";
choicehtml += "</div></td></tr></table>";
return choicehtml;
}
function showitemschoice(title, script,al){
$.get('itemschoice.php?get=1&svecha=qq&al='+al+'',function(data) {
var choicehtml=show_table(title, script);
var el = document.getElementById("hint3");
el.innerHTML = choicehtml+data;
el.style.width = 400 + 'px';
el.style.visibility = "visible";
el.style.left = 100 + 'px';
el.style.top = 100 + 'px';
Hint3Name = "target";
});
}
function closehint3(clearstored){
if(clearstored){
var targetform = document.getElementById('formtarget');
targetform.action += "&clearstored=1";
targetform.submit();
}
document.getElementById("hint3").style.visibility="hidden";
Hint3Name='';
}
function solo(id, vcode){
top.changeroom = id;
window.location.href = '?goto=' + id + '&tStamp=' + timeStamp + '&vcode=' + vcode;
}
function moveTo(id, file, vcode){
parent.changeroom = id;
window.location.href = file + '?goto=' + id + '&tStamp=' + timeStamp + '&vcode=' + vcode;
}
function imover(im){
im.filters.Glow.Enabled=true;
// im.style.visibility="hidden";
}
function imout(im){
im.filters.Glow.Enabled=false;
// im.style.visibility="visible";
}
function returned2(s){
location.href=''+s+'&tmp='+Math.random();
}
function showRating(id){
window.open('?info=' + id,'ratings','scrollbars=no,toolbar=no,status=no,resizable=yes,width=400,height=400')
}
function Down() {top.CtrlPress = window.event.ctrlKey}
document.onmousedown = Down;
</SCRIPT>
</HEAD>
<body leftmargin="5" topmargin="5" marginwidth="5" marginheight="5" bgcolor="#D7D7D7">
<script type="text/javascript">
$(document).ready(function() {
$('img[title]').mTip();
});
</script>
<div id=hint3 class=ahint style="z-index:150;"></div><?php
switch($_GET['got']){
case'level10':
echo'<div style="float: right;">
<input TYPE="button" value="Подсказка" style="background-color:#A9AFC0" onclick="window.open(\'help/hram.html\', \'help\', \'height=300,width=500,location=no,menubar=no,status=no,toolbar=no,scrollbars=yes\')">
<input type="button" name="hram" onclick="window.location.href = \'?got=default\';" value="Вернуться">
</div><center><h1>Скоро тут все будет....</h1></center>';
break;
case'level11':
$Deposit = '';
if($_GET['wid']){
$getResource = mysql_fetch_assoc(mysql_query("SELECT * FROM `inventory` WHERE `id` = '" . intval($_GET['wid']) . "' AND `owner` = '{$_SESSION['uid']}' AND (type=80 or type=81 or type=82 or type=83 or type=84 or type=85 or type=86 or type=87 or type=89) AND `setsale` = '0'"));
if($getResource){
$userData = array();
// Выгружаем нащи данные
$getChUser = mysql_fetch_assoc(mysql_query("SELECT * FROM `church_users` WHERE `id` = '{$_SESSION['uid']}'"));
if($getChUser){
$userData = unserialize($getChUser['data']);
}
// Обновляем количество ресов в БД
$resChurch[$getResource['prototype']]['count'] += $getResource['koll'];
$userData[$getResource['prototype']] += $getResource['koll'];
mysql_query("REPLACE INTO `church_users` (`id`, `data`) VALUES ('{$_SESSION['uid']}', '" . serialize($userData) . "');");
mysql_query("UPDATE `church_configs` SET `data` = '" . serialize($resChurch) . "' WHERE `id`='" . $thisChurch . "'");
// Temp Data
$user['reputation'] += round($getResource['koll']*$getResource['repcost'], 2);
//Обнавляем нашу репу
mysql_query("UPDATE `users` SET `reputation`=`reputation`+'" . round($getResource['koll']*$getResource['repcost'], 2) . "',`doblest`=`doblest`+'" . round($getResource['koll']*$getResource['repcost'], 2) . "' WHERE `id`='{$_SESSION['uid']}'");
// Удаляем ресурсы
mysql_query("DELETE FROM `inventory` WHERE `id` = '" . $getResource['id'] . "'");
// Пишем логи
mysql_query("INSERT INTO `church_logs` (`ch`, `uid`, `key`, `val`) VALUES ('" . $thisChurch . "', '{$_SESSION['uid']}', '{$getResource['prototype']}', '{$getResource['koll']}');");
$Deposit = '<b>Вы пожертвовали на внутреннюю отделку: ' . $getResource['name'] . ' x' . $getResource['koll'] . ' </b><br>И получили ' . round($getResource['koll']*$getResource['repcost'], 2) . ' репутации.<br>';
}
}
$getResources = mysql_query("SELECT * FROM `inventory` WHERE `owner` = '{$_SESSION['uid']}' AND (type=80 or type=81 or type=82 or type=83 or type=84 or type=85 or type=86 or type=87 or type=89) AND `setsale` = 0 ORDER by `name` ASC; ");
$resources = '<b>К сожалению у Вас нет нужных ресурсов...</b>';
if (mysql_num_rows($getResources) > 0) {
$resources = '';
while($row = mysql_fetch_array($getResources)) {
$resources .= '<a href="?got=level11&wid=' . $row['id'] . ( isset($_GET['step']) ? '&step=true' : '' ) . '">Отдать ' . $row['name'] . ' x' . $row['koll'] . ' алтарю.</a><br />';
}
}
echo'<div style="float: right;">
<input TYPE="button" value="Подсказка" style="background-color:#A9AFC0" onclick="window.open(\'help/hram.html\', \'help\', \'height=300,width=500,location=no,menubar=no,status=no,toolbar=no,scrollbars=yes\')">
<input type="button" name="hram" onclick="window.location.href = \'?got=default\';" value="Вернуться">
</div>
<style>
td a img {
background-color: #e2e0e0;
}
</style>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align=center valign=top>
<div style="color:#8F0000;font-weight:bold;font-size:16px;text-align:center;float:center;">Да пребудет с тобой сила, ' . $user['login'] . ', репутация: ' . $user['reputation'] . '</div>
</td>
</tr>
<tr>
<td align=center valign=top>
<br />' . $Deposit . $resources . '
</td>
</tr>
<tr>
<td align=center valign=top>';
if(isset($_GET['step'])){
echo'<table border="0" cellpadding=0 cellspacing=0 width="710" height="489" style="background:url(/i/sh/temle/bg.jpg) center no-repeat;">
<tr>
<td width="100%" height="70" colspan="9">&nbsp;</td>
</tr>
<tr>
<td width="190" height="60">&nbsp;</td>
<td width="60" height="60"><a href="javascript:showRating(501);"><img src="/i/sh/103001.gif" title="Название ресурса: <b>Мел</b><br />Собрано: <b>' . $resChurch['501']['count'] . '</b>"></a></td>
<td width="30" height="60">&nbsp;</td>
<td width="60" height="60"><a href="javascript:showRating(502);"><img src="/i/sh/103002.gif" title="Название ресурса: <b>Горсть соли</b><br />Собрано: <b>' . $resChurch['502']['count'] . '</b>"></a></td>
<td width="39" height="60">&nbsp;</td>
<td width="60" height="60"><a href="javascript:showRating(503);"><img src="/i/sh/103004.gif" title="Название ресурса: <b>Горный хрусталь</b><br />Собрано: <b>' . $resChurch['503']['count'] . '</b>"></a></td>
<td width="30" height="60">&nbsp;</td>
<td width="60" height="60"><a href="javascript:showRating(504);"><img src="/i/sh/103005.gif" title="Название ресурса: <b>Бирюза</b><br />Собрано: <b>' . $resChurch['504']['count'] . '</b>"></a></td>
<td width="190" height="60">&nbsp;</td>
</tr>
<tr>
<td width="100%" height="10" colspan="9" >&nbsp;</td>
</tr>
<tr>
<td width="190" height="60">&nbsp;</td>
<td width="60" height="60"><a href="javascript:showRating(505);"><img src="/i/sh/103003.gif" title="Название ресурса: <b>Опал</b><br />Собрано: <b>' . $resChurch['505']['count'] . '</b>"></a></td>
<td width="30" height="60">&nbsp;</td>
<td width="60" height="60"><a href="javascript:showRating(506);"><img src="/i/sh/103007.gif" title="Название ресурса: <b>Булыжник</b><br />Собрано: <b>' . $resChurch['506']['count'] . '</b>"></a></td>
<td width="39" height="60">&nbsp;</td>
<td width="60" height="60"><a href="javascript:showRating(507);"><img src="/i/sh/103008.gif" title="Название ресурса: <b>Камень Лабиринта</b><br />Собрано: <b>' . $resChurch['507']['count'] . '</b>"></a></td>
<td width="30" height="60">&nbsp;</td>
<td width="60" height="60"><a href="javascript:showRating(508);"><img src="/i/sh/103006.gif" title="Название ресурса: <b>Гранат</b><br />Собрано: <b>' . $resChurch['508']['count'] . '</b>"></a></td>
<td width="190" height="60">&nbsp;</td>
</tr>
<tr>
<td width="100%" height="10" colspan="9" >&nbsp;</td>
</tr>
<tr>
<td width="190" height="60">&nbsp;</td>
<td width="60" height="60"><a href="javascript:showRating(509);"><img src="/i/sh/103009.gif" title="Название ресурса: <b>Янтарь</b><br />Собрано: <b>' . $resChurch['509']['count'] . '</b>"></a></td>
<td width="30" height="60">&nbsp;</td>
<td width="60" height="60"><a href="javascript:showRating(510);"><img src="/i/sh/103011.gif" title="Название ресурса: <b>Сапфир</b><br />Собрано: <b>' . $resChurch['510']['count'] . '</b>"></a></td>
<td width="39" height="60">&nbsp;</td>
<td width="60" height="60"><a href="javascript:showRating(511);"><img src="/i/sh/103010.gif" title="Название ресурса: <b>Малахит</b><br />Собрано: <b>' . $resChurch['511']['count'] . '</b>"></a></td>
<td width="30" height="60">&nbsp;</td>
<td width="60" height="60"><a href="javascript:showRating(512);"><img src="/i/sh/103012.gif" title="Название ресурса: <b>Жемчуг</b><br />Собрано: <b>' . $resChurch['512']['count'] . '</b>"></a></td>
<td width="190" height="60">&nbsp;</td>
</tr>
<tr>
<td width="100%" height="10" colspan="9">&nbsp;</td>
</tr>
<tr>
<td width="277" height="60" colspan="3" valign=center>&nbsp;</td>
<td width="159" height="173" colspan="3" align=center><img style="cursor: pointer;" onclick="document.location.href = \'?got=level11\';" src="/i/sh/temle/paper_shadow.gif" src="/i/sh/temle/paper_shadow.gif" title="Другие Ресурсы" border="0" /></td>
<td width="277" height="60" colspan="3" valign=center>&nbsp;</td>
</tr>
</table>';
} else {
echo'<table border="0" cellpadding=0 cellspacing=0 width="710" height="489" style="background:url(/i/sh/temle/bg.jpg) center no-repeat;">
<tr>
<td width="100%" height="70" colspan="9" >&nbsp;</td>
</tr>
<tr>
<td width="190" height="60">&nbsp;</td>
<td width="60" height="60"><a href="javascript:showRating(401);"><img src="/i/sh/ruda.gif" title="Название ресурса: <b>Руда</b><br />Собрано: <b>' . $resChurch['401']['count'] . '</b>"></a></td>
<td width="30" height="60">&nbsp;</td>
<td width="60" height="60"><a href="javascript:showRating(402);"><img src="/i/sh/sand.gif" title="Название ресурса: <b>Песок</b><br />Собрано: <b>' . $resChurch['402']['count'] . '</b>"></a></td>
<td width="39" height="60">&nbsp;</td>
<td width="60" height="60"><a href="javascript:showRating(403);"><img src="/i/sh/granit.gif" title="Название ресурса: <b>Гранит</b><br />Собрано: <b>' . $resChurch['403']['count'] . '</b>"></a></td>
<td width="30" height="60">&nbsp;</td>
<td width="60" height="60"><a href="javascript:showRating(404);"><img src="/i/sh/vosk.gif" title="Название ресурса: <b>Воск</b><br />Собрано: <b>' . $resChurch['404']['count'] . '</b>"></a></td>
<td width="190" height="60">&nbsp;</td>
</tr>
<tr>
<td width="100%" height="10" colspan="9" >&nbsp;</td>
</tr>
<tr>
<td width="190" height="60">&nbsp;</td>
<td width="60" height="60"><a href="javascript:showRating(405);"><img src="/i/sh/glina.gif" title="Название ресурса: <b>Глина</b><br />Собрано: <b>' . $resChurch['405']['count'] . '</b>"></a></td>
<td width="30" height="60">&nbsp;</td>
<td width="60" height="60"><a href="javascript:showRating(406);"><img src="/i/sh/temple_stone2.gif" title="Название ресурса: <b>Стенной Камень</b><br />Собрано: <b>' . $resChurch['406']['count'] . '</b>"></a></td>
<td width="39" height="60">&nbsp;</td>
<td width="60" height="60"><a href="javascript:showRating(407);"><img src="/i/sh/stone_pic.gif" title="Название ресурса: <b>Кусок Настенного Рисунка</b><br />Собрано: <b>' . $resChurch['407']['count'] . '</b>"></a></td>
<td width="30" height="60">&nbsp;</td>
<td width="60" height="60"><a href="javascript:showRating(408);"><img src="/i/sh/temple_stone1.gif" title="Название ресурса: <b>Камень Алтаря</b><br />Собрано: <b>' . $resChurch['408']['count'] . '</b>"></a></td>
<td width="190" height="60">&nbsp;</td>
</tr>
<tr>
<td width="100%" height="10" colspan="9" >&nbsp;</td>
</tr>
<tr>
<td width="190" height="60">&nbsp;</td>
<td width="60" height="60"><a href="javascript:showRating(409);"><img src="/i/sh/almaz.gif" title="Название ресурса: <b>Алмаз</b><br />Собрано: <b>' . $resChurch['409']['count'] . '</b>"></a></td>
<td width="30" height="60">&nbsp;</td>
<td width="60" height="60"><a href="javascript:showRating(410);"><img src="/i/sh/Emerald1.gif" title="Название ресурса: <b>Изумруд</b><br />Собрано: <b>' . $resChurch['410']['count'] . '</b>"></a></td>
<td width="39" height="60">&nbsp;</td>
<td width="60" height="60"><a href="javascript:showRating(411);"><img src="/i/sh/silverr.gif" title="Название ресурса: <b>Серебро</b><br />Собрано: <b>' . $resChurch['411']['count'] . '</b>"></a></td>
<td width="30" height="60">&nbsp;</td>
<td width="60" height="60"><a href="javascript:showRating(412);"><img src="/i/sh/gold1.gif" title="Название ресурса: <b>Золото</b><br />Собрано: <b>' . $resChurch['412']['count'] . '</b>"></a></td>
<td width="190" height="60">&nbsp;</td>
</tr>
<tr>
<td width="100%" height="10" colspan="9">&nbsp;</td>
</tr>
<tr>
<td width="277" height="60" colspan="3" valign=center>&nbsp;</td>
<td width="159" height="173" colspan="3" align=center><img style="cursor: pointer;" onclick="document.location.href = \'?got=level11&step=1\';" src="/i/sh/temle/paper_shadow.gif" title="Другие Ресурсы" border="0" /></td>
<td width="277" height="60" colspan="3" valign=center>&nbsp;</td>
</tr>
</table>';
}
echo'</td>
</tr>
</table>';
break;
default:
echo'<div style="float: right;">
<input TYPE="button" value="Подсказка" style="background-color:#A9AFC0" onclick="window.open(\'help/hram.html\', \'help\', \'height=300,width=500,location=no,menubar=no,status=no,toolbar=no,scrollbars=yes\')">
<input type="button" name="hram" onclick="moveTo(2601, \'/city.php\', \'' . vCode(2601, $timeStamp) . '\');" value="Вернуться">
</div>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align=center valign=top>
<div id="ione" style="position:relative;width:790px;height:430px;" align="center">
<img src="i/city/fon.jpg" border="0" />
<img style="position:absolute;cursor:pointer;left:39px;top:19px;z-index:90;" class="aFilter" src="i/city/sub/zals.png" title="Зал Свитков" id="10" onclick="window.location.href = \'?got=level10\';" />
<img style="position:absolute;cursor:pointer;left:548px;top:19px;z-index:90;" class="aFilter" src="i/city/sub/zalp.png" title="Зал Пожертвований" id="11" onclick="window.location.href = \'?got=level11\';" />
<!--
<img style="position:absolute;cursor:pointer;left:154px;top:328px;z-index:90;" class="aFilter" src="i/city/sub/svechas.png" title="Свеча света" id="6" onclick="solo(6, \'' . vCode(2601, $timeStamp) . '\');" />
<img style="position:absolute;cursor:pointer;left:372px;top:318px;z-index:90;" class="aFilter" src="i/city/sub/svechan.png" title="Свеча нейтралов" id="2" onclick="solo(2, \'' . vCode(2601, $timeStamp) . '\');" />
<img style="position:absolute;cursor:pointer;left:584px;top:330px;z-index:90;" class="aFilter" src="i/city/sub/svechad.png" title="Свеча тьмы" id="3" onclick="solo(3, \'' . vCode(2601, $timeStamp) . '\');" />
-->
</div>
</td>
</tr>
</table>';
break;
}
/*
echo serialize(
array(
401 => array('count' => 0), // Руда
402 => array('count' => 0), // Песок
403 => array('count' => 0), // Гранит
404 => array('count' => 0), // Воск
405 => array('count' => 0), // Глина
406 => array('count' => 0), // Стенной камень
407 => array('count' => 0), // Кусок настенного рисунка
408 => array('count' => 0), // Камень Алтаря
409 => array('count' => 0), // Алмаз
410 => array('count' => 0), // Изумруд
411 => array('count' => 0), // Серебро
412 => array('count' => 0), // Золото
501 => array('count' => 0), // Мел
502 => array('count' => 0), // Горсть соли
503 => array('count' => 0), // Горный хрусталь
504 => array('count' => 0), // Бирюза
505 => array('count' => 0), // Опал
506 => array('count' => 0), // Булыжник
507 => array('count' => 0), // Камень Лабиринта
508 => array('count' => 0), // Гранат
509 => array('count' => 0), // Янтарь
510 => array('count' => 0), // Сапфир
511 => array('count' => 0), // Малахит
512 => array('count' => 0), // Жемчуг
)
);
*/
?></body>
</html>