<?
include_once("req.php");

array_walk($_REQUEST,"format_string");   
array_walk($_POST,"format_string");   
array_walk($_GET,"format_string");   

include_once("config.php");
include_once("session_class.php");
include_once("persinfo_class.php");
error_reporting(E_ALL ^ E_NOTICE);
session_start();
$session = new Sessions;

if ($session->is_session(session_id())) {

$myinfo =new Persinfo($session->id_person);
$myinfo->get_chat_params();
		$res=db_use('array',"select roomtype from room where id_room='".$myinfo->id_room."'");
		$roomtype=$res['roomtype'];
		#header("Location: znahar.php");
		#die;
	if ($roomtype!=18) {
		header("Location: main.php"); 
		die;
	}else{
	
if ($_REQUEST['pojer']){
$_REQUEST['money']=(0+$_REQUEST['money']);
	if ($_REQUEST['money']>$myinfo->money) {$mess="У вас нет столько денег";}
	elseif ($_REQUEST['money']>=0.01) {
		db_use('query',"insert into pojer (id_person,id_room,money,`timestamp`) values ('".$myinfo->id_person."','18','".($_REQUEST['money']+0)."','".time()."')");
		db_use('query',"update person set money=money-'".($_REQUEST['money']+0)."' where id_person='".$myinfo->id_person."'");$mess='Вы пожертвовали '.(0+$_REQUEST['money']).' кр. Строители выражают вам благодарность!';
	}
}
$res=db_use('array',"select id_person from atop18 where id_person='".$myinfo->id_person."';");
$imtop=($res['id_person']?true:false);
if ($_REQUEST['dropmastery']){
	#if ($imtop) {
	if (1000>$myinfo->money) {$mess="У вас нет столько денег";}else{
		$m=db_use('array',"select 	
		masw1,masw2,masw3,masw4,masw5,m_magic1,m_magic2,m_magic3,m_magic4,m_magic5,m_magic6,m_magic7
		from person where id_person='".$myinfo->id_person."'");
	
#		$points=$m['masw1']+$m['masw2']+$m['masw3']+$m['masw4']+$m['masw5']+$m['m_magic1']+$m['m_magic2']+$m['m_magic3']+$m['m_magic4']+$m['m_magic5']+$m['m_magic6']+$m['m_magic7'];
		db_use('query',"update person set money=money-1000,mast_points=level+1,		masw1=0,masw2=0,masw3=0,masw4=0,masw5=0,m_magic1=0,m_magic2=0,m_magic3=0,m_magic4=0,m_magic5=0,m_magic6=0,m_magic7=0 where id_person='".$myinfo->id_person."';");
		$mess='Удачно скинуты умения';
	}
	#}else{
	#	$mess='Вы не находитесь в списке топ-10';
	#}
}
if ($_REQUEST['heal']){
	#if ($imtop) {
	if (40>$myinfo->money) {$mess="У вас нет столько денег";}else{
		db_use('query',"update person set money=money-40,travma_time=0,travma_id=0,travma_type=0 where id_person='".$myinfo->id_person."';");
		$mess='Персонаж излечен от травм';
	}
	#}else{
	#	$mess='Вы не находитесь в списке топ-5';
	#}
}

	
	function thecost($mf,$val) {
	global $a;
$a[1]=array(0,
	-1,-1,-1,10,10,10,10,10,10,10,
	10,10,10,11,11,12,12,13,14,15,
	16,17,19,20,22,23,25,27,29,31,
	33,35,37,40,41,45,47,50,53,56,
	59,62,66,69,73,76,80,84,88,92,
	96,100,104,113,118,122,127,132,137,
	141,147,153,158,164,169,175,181,187,193,
	199,205,211,218,224,231,237,244,251,258,
	265,272,280,287,295,302,310,318,326,334,
	342,350,358,367,375,384,392,401,410,419);
	$a[2]=array(0,
	-1,-1,-1,10,10,10,10,10,10,10,10,10,10,11,12,13,14,15,16,18,19,21,23,25,28,30,32,35,38,41,44,47,51,55,58,62,66,70,75,79,84,89,94,99,104,109,115,121,127,133,139,145,151,158,165,172,179,186,193,201,208,216,224,232,241,249,257,266,275,284,293,302,312,322,331,341,351,361,372,382,393,404,415,426,437,448,460,472,484,496,508,520,532,545,558,571,584,597,610,624);
	$a[3]=array(0,-1,-1,-1,10,10,10,10,10,10,10,10,10,10,11,12,13,14,15,16,18,19,21,23,25,28,30,32,35,38,41,44,47,51,55,58,62,66,70,75,79,84,89,94,99,104,109,115,121,127,133,139,145,151,158,165,172,179,186,193,201,208,216,224,232,241,249,257,266,275,284,293,302,312,322,331,341,351,361,372,382,393,404,415,426,437,448,460,472,484,496,508,520,532,545,558,571,584,597,610,624);
	$a[4]=array(0,-1,-1,-1,10,10,10,10,10,10,10,10,10,10,11,12,13,14,15,16,18,19,21,23,25,28,30,32,35,38,41,44,47,51,55,58,62,66,70,75,79,84,89,94,99,104,109,115,121,127,133,139,145,151,158,165,172,179,186,193,201,208,216,224,232,241,249,257,266,275,284,293,302,312,322,331,341,351,361,372,382,393,404,415,426,437,448,460,472,484,496,508,520,532,545,558,571,584,597,610,624);
	$a[5]=array(0,10,10,10,10,10,10,10,10,10,10,10,11,13,15,17,20,24,28,32,37,43,49,55,62,70,78,86,95,105,115,125,136,148,160,172,185,199,213,227,242,258,274,290,307,325,343,361,380,400,420,440,461,483,505,527,550,574,598,622,647,673,699,725,752,780,808,836,865,895,925,955,986,1018,1050,1082,1115,1149,1183,1217,1252,1288,1324,1360,1397,1435,1473,1511,1550,1590,1630,1670,1711,1753,1795,1837,1880,1924,1968,2012,2057);
	$a[6]=array(0,10,10,10,10,10,10,10,10,10,10,10,11,13,15,19,22,26,31,37,43,49,56,64,73,82,91,101,112,124,136,148,161,175,190,205,220,236,253,271,289,307,326,346,367,388,409,431,454,478,502,526,551,577,604,631,658,686,715,745,775,805,836,868,901,934,967,1001,1036,1072,1108,1144,1181,1219,1258,1297,1336,1376,1417,1459,1501,1543,1586,1630,1675,1720,1765,1811,1858,1906,1954,2002,2051,2101,2152,2203,2254,2306,2359,2413,2467);
	$a[7]=array(0,10,10,10,10,10,10,10,10,10,10,10,11,13,15,19,22,26,31,37,43,49,56,64,73,82,91,101,112,124,136,148,161,175,190,205,220,236,253,271,289,307,326,346,367,388,409,431,454,478,502,526,551,577,604,631,658,686,715,745,775,805,836,868,901,934,967,1001,1036,1072,1108,1144,1181,1219,1258,1297,1336,1376,1417,1459,1501,1543,1586,1630,1675,1720,1765,1811,1858,1906,1954,2002,2051,2101,2152,2203,2254,2306,2359,2413,2467);
	foreach ($a[7] as $key=>$value) $a[7][$key]=(int)($value/1.5);
	$a[8]=array(0,10,10,10,10,10,10,10,10,10,10,10,11,13,15,19,22,26,31,37,43,49,56,64,73,82,91,101,112,124,136,148,161,175,190,205,220,236,253,271,289,307,326,346,367,388,409,431,454,478,502,526,551,577,604,631,658,686,715,745,775,805,836,868,901,934,967,1001,1036,1072,1108,1144,1181,1219,1258,1297,1336,1376,1417,1459,1501,1543,1586,1630,1675,1720,1765,1811,1858,1906,1954,2002,2051,2101,2152,2203,2254,2306,2359,2413,2467);
	foreach ($a[8] as $key=>$value) $a[8][$key]=(int)($value/1.6);
			$cost=$a[$mf][$val];
		$cost=($cost<=0?100:$cost);
		return $cost;
	}
if ($_REQUEST['movestat']) {

	$mf1=(0+$_REQUEST['mf1']);	$mf2=(0+$_REQUEST['mf2']);
	if ($mf1<1 OR $mf1>8 OR $mf2<1 OR $mf2>8) {$mess='Неверные параметры';}
	elseif($mf1==$mf2) {$mess=='Стат нельзя перекинуть в самого себя';} else{
		$hars=array('','sil','lov','intu','vyn','intel','mudr','duh','vol');
		# 1 -> 3
		# vyn(mf2) + lvl (2) <=3
		#echo $myinfo->hars[1][$hars[$mf1]].'+'.$myinfo->level.'ff'.$hars[$mf1];
		#echo $mf1.' '.$mf2.' '.$myinfo->hars[1][$hars[$mf1]].' '.$myinfo->hars[1]['intel'];
		if ($myinfo->hars[1][$hars[$mf2]]>100) {	$mess='Нельзя больше перебросить сюда стат';
		}elseif ($myinfo->hars[1][$hars[$mf1]]<=3 && $mf1<=4) { $mess='Нет свободного стата';
		}elseif ($myinfo->hars[1][$hars[$mf1]]- $myinfo->level <=3 && $mf1==4) { $mess='Нет свободного стата выносливости';
		}elseif ($myinfo->hars[1][$hars[$mf1]]==0 && $mf1>=5 && $mf1<=6 ) { $mess='Нет свободного стата';
		}elseif ($myinfo->level<4 && $mf2>=5) { $mess='Вы не доросли до интеллекта';
		}elseif ($myinfo->level<7 && $mf2>=6) { $mess='Вы не доросли до мудрости';
		}elseif ($myinfo->level<9 && $mf2>=7) { $mess='Вы не доросли до духовности';
		}elseif ($myinfo->level<12 && $mf2>=8) { $mess='Вы не доросли до воли';
		}else{	# проверить есть ли деньги
			$cost=thecost($mf2,$myinfo->hars[1][$hars[$mf2]]+1);
			if ($myinfo->money<$cost) {$mess='';}else{
			
			db_use('query',"update person set `".$hars[$mf1]."`=`".$hars[$mf1]."`-1 where id_person='".$myinfo->id_person."'");
			db_use('query',"update person set `".$hars[$mf2]."`=`".$hars[$mf2]."`+1,money=money-'".$cost."' where id_person='".$myinfo->id_person."'");
			$mess='Удачно переброшен стат. Вам это стоило '.$cost.' кр.';
			}
		}
	}
}
	echo "
<HTML><HEAD>
<link rel=stylesheet type=\"text/css\" href=\"../i/main.css\">
<meta content=\"text/html; charset=windows-1251\" 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>
<SCRIPT>
function closehint3(){document.all(\"hint3\").style.visibility=\"hidden\";}
</SCRIPT>
<SCRIPT src='../i/commoninf.js'></SCRIPT>
</HEAD>
<body leftmargin=5 topmargin=5 marginwidth=5 marginheight=5 bgcolor=e2e0e0>

<TABLE width=100% cellspacing=0 cellpadding=0>
<FORM action=\"city.php\" method=POST>
<tr><td width=100%><h3>Комната Знахаря</td><td>
<link href=\"../i/move/design4.css\" rel=\"stylesheet\" type=\"text/css\">
<script language=\"javascript\" type=\"text/javascript\">
function fastshow2 (content) {
	var el = document.getElementById(\"mmoves\");
	var o = window.event.srcElement;
	if (content!='' && el.style.visibility != \"visible\") {el.innerHTML = '<small>'+content+'</small>';}
	var x = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft - el.offsetWidth + 5;
	var y = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop+20;
	el.style.left = x + \"px\";
	el.style.top  = y + \"px\";
	if (el.style.visibility != \"visible\") {
		el.style.visibility = \"visible\";
	}
}
function hideshow () {
	document.getElementById(\"mmoves\").style.visibility = 'hidden';
}
</script>
<font color=red>".$mess24324234."</font>
<table  border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
	<tr align=\"right\" valign=\"top\">
		<td>

			</td>
		<td>
			
			<table width=\"80\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
            	<tr>
            		<td width=\"0\" valign=\"bottom\" align=\"left\"><a href=\"?rnd=0.122974956635421\"><img src=\"../i/move/rel_1.gif\" width=\"15\" height=\"16\" alt=\"Обновить\" border=\"0\" /></a></td>
					<td><table width=\"80\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
                    	<tr>
                    		<td colspan=\"3\" align=\"center\"><img src=\"../i/move/navigatin_462.gif\" width=\"80\" height=\"4\" /></td>
                    		</tr>
                    	<tr>
                    		<td colspan=\"3\" align=\"center\"><table width=\"80\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
                    				<tr>
                    					<td><img src=\"../i/move/navigatin_481.gif\" width=\"9\" height=\"8\" /></td>
                    					<td width=\"100%\" bgcolor=\"#000000\"><table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
                    							<tr>
                    								<td nowrap=\"nowrap\" align=\"center\"><div align=\"center\" style=\"font-size:4px;padding:0px;border:solid black 0px; text-align:center\" id=\"prcont\"></div>
                        									<script language=\"javascript\" type=\"text/javascript\">
												var s=\"\";for (i=1; i<=32; i++) {s+='<span id=\"progress'+i+'\">&nbsp;</span>';if (i<32) {s+='&nbsp;'};}document.getElementById('prcont').innerHTML=s;
								  				</script>
                    									</td>
                    								</tr>
                    							</table></td>
                    					<td><img src=\"../i/move/navigatin_50.gif\" width=\"7\" height=\"8\" /></td>
                    					</tr>
                    				</table></td>
                    		</tr>
	
	<tr>
		<td colspan=\"3\"><img src=\"../i/move/navigatin_tt1_532.gif\" width=\"80\" height=\"5\" /></td>
	</tr>
	
                   	</table></td>
           		</tr>
          	</table>
			
			<table  border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
				<tr>
					<td nowrap=\"nowrap\" id=\"moveto\">
						<table width=\"100%\"  border=\"0\" cellpadding=\"0\" cellspacing=\"1\" bgcolor=\"#DEDEDE\">
							";
					echo"
							<tr>
								<td bgcolor=\"#D3D3D3\"><img src=\"../i/move/links.gif\" width=\"9\" height=\"7\" /></td>";#print_r($_REQUEST);
$in_r[19]=getinroom($room,$myinfo->id_city); $r_name[19]="Торговый зал";
$num=19;echo"<td bgcolor=\"#D3D3D3\" nowrap><a href=\"main.php?rnd=0.122974956635421&pathbkbk=1.100&path=19\" onclick=\"return check_access();\" class=\"menutop\" title=\"Время перехода: 15 сек.
Сейчас в комнате ".$in_r[$num]." чел.\">".$r_name[$num]."</a></td></tr>";
echo"
							<tr>
								<td bgcolor=\"#D3D3D3\"><img src=\"../i/move/links.gif\" width=\"9\" height=\"7\" /></td>";
$in_r[6]=getinroom($room,$myinfo->id_city); $r_name[6]="2 этаж";
$num=6;echo"<td bgcolor=\"#D3D3D3\" nowrap><a href=\"main.php?rnd=0.122974956635421&pathbkbk=1.100&path=6\" onclick=\"return check_access();\" class=\"menutop\" title=\"Время перехода: 15 сек.
Сейчас в комнате ".$in_r[$num]." чел.\">".$r_name[$num]."</a></td></tr>";

echo"
						</table>
					</td>
				</tr>
			</table>
			
			<!-- <br /><span class=\"menutop\"><nobr>Комната Знахаря</nobr></span>-->
			</td>
	</tr>
</table>
<div id=\"mmoves\" style=\"background-color:#FFFFCC; visibility:hidden; overflow:visible; position:absolute; border-color:#666666; border-style:solid; border-width: 1px; padding: 2px; white-space: nowrap;\"></div>
<script language=\"javascript\" type=\"text/javascript\">
var progressEnd = 32;		// set to number of progress <span>'s.
var progressColor = '#00CC00';	// set to progress bar color
var mtime = parseInt('-15');
if (!mtime || mtime<=0) {mtime=0;}
var progressInterval = Math.round(mtime*1000/progressEnd);	// set to time between updates (milli-seconds)
var is_accessible = true;
var progressAt = progressEnd;
var progressTimer;
function progress_clear() {
	for (var i = 1; i <= progressEnd; i++) document.getElementById('progress'+i).style.backgroundColor = 'transparent';
	progressAt = 0;
	
	is_accessible = false;
	set_moveto(true);
}
function progress_update() {
	progressAt++;
	//if (progressAt > progressEnd) progress_clear();
	if (progressAt > progressEnd) {
		
		is_accessible = true;
		if (window.solo_store && solo_store) { solo(solo_store); } // go to stored
		set_moveto(false);
	} else {document.getElementById('progress'+progressAt).style.backgroundColor = progressColor;
		progressTimer = setTimeout('progress_update()',progressInterval);
	}
}
function set_moveto (val) {
	document.getElementById('moveto').disabled = val;
	if (document.getElementById('bmoveto')) {
		document.getElementById('bmoveto').disabled = val;
	}
}
function progress_stop() {
	clearTimeout(progressTimer);
	progress_clear();
}
function check(it) {
	return is_accessible;
}
function check_access () {
	return is_accessible;
}
function ch_counter_color (color) {
	progressColor = color;
	for (var i = 1; i <= progressAt; i++) {
		document.getElementById('progress'+i).style.backgroundColor = progressColor;
	}
}
// brrr
if (mtime>0) {
	progress_clear();
	progress_update();
} else {
	for (var i = 1; i <= progressEnd; i++) {
		document.getElementById('progress'+i).style.backgroundColor = progressColor;
	}
}
</script>

</td></tr>
</FORM>
</table>






<TABLE width=100% cellspacing=0 cellpadding=4>
<TR>
    <FORM METHOD=POST ACTION=\"znahar.php\">
	<INPUT TYPE=hidden name=sid value=\"\">
	<INPUT TYPE=hidden name=id value=\"1\">
	<INPUT TYPE=hidden name=sd4 value=\"1152918974\">
	<TD valign=top align=left>
<!--Магазин-->
<TABLE width=100% cellspacing=0 cellpadding=0 bgcolor=A5A5A5>
<TR>
	<TD align=center><B>Знахарская</B>


	</TD>
</TR>
<TR><TD>

<!--Рюкзак-->
<TABLE WIDTH=100% CELLSPACING=1 CELLPADDING=2 BGCOLOR=A5A5A5>";


$res=db_use('array',"select sum(money) as sum1 from pojer where id_room=18");
$money=(((int)((350000-$res['sum1'])*100))/100);
echo "<TR><td valign=top><img src=\"http://im4-tub.yandex.ru/i?id=17302070&tov=4\"></td><TD bgcolor=e2e0e0 align=center>";
/*Идет стройка... Всего осталось собрать <B>".$money." кр.</B><br />"; */

#echo "<TR><td valign=top><img src=\"http://im4-tub.yandex.ru/i?id=17302070&tov=4\"></td><TD bgcolor=e2e0e0 align=center>Итак, деньги собраны, строительство началось. Ура!!!<br />";
echo"<br />
    <FORM METHOD=POST ACTION=\"znahar.php\">
	Сложить в общак (забрать будет нельзя): <INPUT TYPE=TEXT name=money> кр<br />
	<input type=submit name=pojer value='Вложить'>
	</FORM>Вами вложено: ";
$res1=db_use('array',"SELECT sum(money) as sum1 from pojer where id_room=18 and id_person='".$myinfo->id_person."';");
echo ((((int)((0+$res1['sum1'])*100))/100)+0);	echo" кр.<br />
Всего накоплено: ".(((int)((0+$res['sum1'])*100))/100)." кр";
echo "<br /><br />".($mess?"<font color=red><b>".$mess."</b></font><br />":'');

echo"<br />
<br />
<BR>
<FORM>
<FIELDSET><LEGEND><H4>&nbsp;Навыки владения оружием и магией&nbsp;</H4> </LEGEND>
<TABLE width=98% align=center>
<TD>
<INPUT type=hidden name=sd4 value=403629609>
У вас есть шанс  забыть старое ради нового (1000 кр): <INPUT type=submit name='dropmastery' value='Отпустить умения' onclick=\"return confirm('Вы действительно хотите отпустить умения?')\"><BR><BR>
</TABLE>
</FIELDSET>
</FORM>
<FORM>
<FIELDSET><LEGEND><H4>&nbsp;Параметры&nbsp;</H4> </LEGEND>
<TABLE width=98% align=center>
<TD>
<INPUT type=hidden name=sd4 value=403629609>
Вы можете стать иным - более ловким, сильным или мудрым... но лишь за счет других параметров<BR>
<small>(бесплатных перераспределений: 0)<BR></small>";
$harnames=getharnames();
foreach ($myinfo->hars[1] as $key => $value) {
echo $harnames[$key].": ".$value."<BR>\n";
}
echo"
<BR>
Перенести&nbsp;
<SELECT name='mf1'>";
foreach ($myinfo->hars[1] as $key => $value) {
if ($key=='sil') {$v=1; }
if ($key=='lov') {$v=2; }
if ($key=='intu') {$v=3; }
if ($key=='vyn') {$v=4; }
if ($key=='intel' && $myinfo->level>=4) {$v=5; }
if ($key=='mudr' && $myinfo->level>=7) {$v=6; }
if ($key=='duh' && $myinfo->level>=9) {$v=7; }
if ($key=='vol' && $myinfo->level>=12) {$v=8; }
echo ($value>0?"<OPTION value=".$v.">".$harnames[$key]."</OPTION>\n":'');
}
echo"
</SELECT>
&nbsp;в&nbsp;
<SELECT name='mf2'>";
foreach ($myinfo->hars[1] as $key => $value) {
if ($key=='sil') {$v=1; }
if ($key=='lov') {$v=2; }
if ($key=='intu') {$v=3; }
if ($key=='vyn') {$v=4; }
if ($key=='intel' && $myinfo->level>=4) {$v=5; }
if ($key=='mudr' && $myinfo->level>=7) {$v=6; }
if ($key=='duh' && $myinfo->level>=9) {$v=7; }
if ($key=='vol' && $myinfo->level>=12) {$v=8; }
			$cost=thecost($v,$value+1);
			
echo (true?"<OPTION value=".$v.">".$harnames[$key].' '.($cost<1?'бесплатно':$cost.' кр')."</OPTION>\n":'');
}
echo"</SELECT><BR>
Роспись:
<INPUT type=submit name='movestat' value='Согласен' onclick=\"return confirm('Вы уверены в своем выборе?')\">
</TABLE>
</FIELDSET>
<BR><BR>
</TABLE>
</FIELDSET>




Знахарь предлагает скинуть умения, излечиться от травм. ".(!$imddtop?"<FORM METHOD=POST ACTION=\"znahar.php\">
	<input type=submit name=heal value='Излечиться от травм (40 кр)'>
	</FORM>":'Вам, к сожалению, эта возможность недоступна.').(!$imddtop?"<FORM METHOD=POST ACTION=\"znahar.php\"><br />
":'');
	
echo"</TD></TR>
</TABLE>

";
echo"
Самые большие вложения: <br />
";
$res=db_use('query',"select * from atop18 limit 10;");
unset($i);while($i<mysql_num_rows($res)){
	$i++;$s=mysql_fetch_array($res);
	echo "<FONT CLASS=sysdate>".date("d.m.Y H:i",$s['timestamp'])."</font>  <SCRIPT>drwfl(\"".$s['login']."\",".$s['id_person'].",\"".$s['level']."\",'".$s['align']."',\"".$s['clanname']."\")</SCRIPT></font> ".(((int)(($s['summ']+0)*100))/100)." кр. ".($i==1?str_repeat('<img src=../i/smile/mol.gif>',20):'').($i==2?'<img src=../i/smile/smoke.gif>':'').($i==3?'<img src=../i/smile/king.gif>':'').($i==4?'<img src=../i/smile/super.gif>':'').($i==5?'<img src=../i/smile/shuffle.gif>':'')."<br />";
}

/*echo"<br />
<br />
<hr> <br />
";
$res=db_use('query',"select pj.*,u.login,p.align,p.id_clan,p.level,c.clanname from pojer pj left join person p on p.id_person=pj.id_person left join users u on u.id_person=p.id_person left join clans c on c.id_clan=p.id_clan where pj.id_room=18 order by pj.timestamp desc limit 21,100;");
unset($i);while($i<mysql_num_rows($res)){
	$i++;$s=mysql_fetch_array($res);
	echo "<FONT CLASS=sysdate>".date("d.m.Y H:i",$s['timestamp'])."</font>  <SCRIPT>drwfl(\"".$s['login']."\",".$s['id_person'].",\"".$s['level']."\",'".$s['align']."',\"".$s['clanname']."\")</SCRIPT></font> ".$s['money']." кр.<br />";
}*/
echo"

";
echo"<br />
Последние 20 пожертвований: <br />
";
$res=db_use('query',"select pj.*,u.login,p.align,p.id_clan,p.level,c.clanname from pojer pj left join person p on p.id_person=pj.id_person left join users u on u.id_person=p.id_person left join clans c on c.id_clan=p.id_clan where pj.id_room=18 order by pj.timestamp desc limit 20;");
unset($i);while($i<mysql_num_rows($res)){
	$i++;$s=mysql_fetch_array($res);
	echo "<FONT CLASS=sysdate>".date("d.m H:i",$s['timestamp'])."</font>  <SCRIPT>drwfl(\"".$s['login']."\",".$s['id_person'].",\"".$s['level']."\",'".$s['align']."',\"".$s['clanname']."\")</SCRIPT></font> ".$s['money']." кр.<br />";
}

echo"

	</div>
<div id=hint3 class=ahint></div>
    </TD>
    </FORM>
</TR>
</TABLE>



</BODY>
</HTML>	";	
		die;
	}
}else {

header("Location: totop.htm"); die;
}
?>