Просмотр файла include/top.php

Размер файла: 3.58Kb
<?
if($version == "wml")
		{
			header("Content-type: text/vnd.wap.wml; charset=utf-8");
			echo(doctype("Топ-20").$tag);
			echo("Имя - Тем/Сообщений<br />\r\n");
			$ka = mysql_num_rows(mysql_query("SELECT * FROM `users` WHERE `status`='admin'"));
			$km = mysql_num_rows(mysql_query("SELECT * FROM `users` WHERE `status`='moderator'"));
			$limit = 20+$ka+$km;
			$query = mysql_query("SELECT users.username, users.id, COUNT( posts.name ) AS cnt
								FROM posts, users
								WHERE users.username = posts.name
								GROUP BY users.id
								ORDER BY cnt DESC
								LIMIT ".$limit);
			$queryes = mysql_query("SELECT users.username, users.id, COUNT( themes.name ) AS cnts
								FROM themes, users
								WHERE users.username = themes.name
								GROUP BY users.id
								ORDER BY cnts DESC
								LIMIT ".$limit);
			$n = 1;
			while(($rows = mysql_fetch_assoc($query)) && ($rowss = mysql_fetch_assoc($queryes)))
			{
				$to = mysql_fetch_assoc(mysql_query("SELECT * FROM users WHERE username='".$rows['username']."'"));
				$tostatus = $to['status'];
				if($authorize && !in_array($tostatus, array('admin', 'moderator')))
				{
					echo("<b>".$n.")</b> <a href=\"./?p=6&amp;v=".$version."&amp;sid=".$sid."&amp;id=".$rows['id']."\">".$rows['username']."</a> ");
				echo("<b>(".$rowss['cnts']."/".$rows['cnt'].")</b><br />\r\n");
				$n++;
				}
			}
			echo
			"<a href=\"./?p=0&amp;v=wml&amp;sid=".$sid."\">Форумы</a>\r\n",
			$tagC."</p></card></wml>";
		}
		elseif($version == "xhtml")
		{
			header("Content-type: text/html; charset=utf-8");
			echo('<html>
<head>
<title>Топ-20</title>
</head>
<body bgcolor="'.$style['background'].'" link="'.$style['link'].'" vlink="'.$style['link'].'" text="#000000">
<table align="center" border="0" cellspacing="1" cellpadding="5" width="350">
<tr align="center" bgcolor="'.$style['title'].'"><td colspan="2">
<font color="#FFFFFF"><b>Топ-20</b></font>
</td></tr>
<tr bgcolor="'.$style['bottom'].'"><td colspan="2"></td></tr>
<tr bgcolor="'.$style['text'].'"><td>'.$tag.'Имя'.$tagC.'</td><td>'.$tag.'Тем/Сообщений'.$tagC.'</td></tr>');

			$ka = mysql_num_rows(mysql_query("SELECT * FROM `users` WHERE `status`='admin'"));
			$km = mysql_num_rows(mysql_query("SELECT * FROM `users` WHERE `status`='moderator'"));
			$limit = 20+$ka+$km;
			$query = mysql_query("SELECT users.username, users.id, COUNT( posts.name ) AS cnt
								FROM posts, users
								WHERE users.username = posts.name
								GROUP BY users.id
								ORDER BY cnt DESC
								LIMIT ".$limit);
			$queryes = mysql_query("SELECT users.username, users.id, COUNT( themes.name ) AS cnts
								FROM themes, users
								WHERE users.username = themes.name
								GROUP BY users.id
								ORDER BY cnts DESC
								LIMIT ".$limit);
			$n = 1;
			while(($rows = mysql_fetch_assoc($query)) && ($rowss = mysql_fetch_assoc($queryes)))
			{
				$to = mysql_fetch_assoc(mysql_query("SELECT * FROM users WHERE username='".$rows['username']."'"));
				$tostatus = $to['status'];
				if($authorize && !in_array($tostatus, array('admin', 'moderator')))
				{
				echo("<tr bgcolor=\"".$style['text']."\">\r\n");
				echo("<td>".$tag."<b>".$n.")</b> <a href=\"./?p=6&amp;v=".$version."&amp;sid=".$sid."&amp;id=".$rows['id']."\">".$rows['username']."</a>".$tagC."</td>\r\n");
				echo("<td><b>(".$tag.$rowss['cnts']."/".$rows['cnt'].$tagC.")</b></td>");
				echo("</tr>");
				$n++;
				}
			}
			echo('<tr bgcolor="'.$style['bottom'].'"><td colspan="2">
'.$tag.'<a href="./?p=0&amp;v=xhtml&amp;sid='.$sid.'">В форум</a> '.$tagC.'
</td></tr></table>
</body></html>');
		}
?>