View file include/top.php

File size: 2.13Kb
<?
if($version == "wml")
		{
			header("Content-type: text/vnd.wap.wml; charset=utf-8");
			echo(doctype("Топ-20").$tag);
			echo("Имя - сообщений<br />\r\n");
			$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 20");
			while($rows = mysql_fetch_assoc($query))
			{
				if($authorize)
				{
					echo("<a href=\"./?p=6&amp;v=".$version."&amp;sid=".$sid."&amp;id=".$rows['id']."\">".$rows['username']."</a> ");
				echo("<b>(".$rows['cnt'].")</b><br />\r\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>');


			$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 20");
			while($rows = mysql_fetch_assoc($query))
			{
				echo("<tr bgcolor=\"".$style['text']."\">\r\n");
				if($authorize)
				{
					echo("<td>".$tag."<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.$rows['cnt'].$tagC.")</b></td>");
				echo("</tr>");
				}
			}
			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>');
		}
?>