All pastes #70381 Raw Edit

Miscellany

public text v1 · immutable
#70381 ·published 2006-06-24 04:43 UTC
rendered paste body
<?php


	if(isset($_GET['sort'])) $page = $_GET['sort'];
	else $page = "title";


	$query = mysql_query("SELECT threadid, title, postusername, views  FROM vb_thread WHERE forumid = ".FORUM_ID." ORDER BY ".$page." ASC");
	
	if(!$query) die( mysql_error() );

	while($row = mysql_fetch_array($query) )
	{
		$username = $row['postusername'];

		$toptitle = $row['title'];
		$hero = 0;
		$author = 0;

		if (preg_match("/(.+)\s*\(\s*(.+)\s*\/\s*(.+)\s*\)/", $toptitle, $matches))
		{
   			$hero = $matches[1];
   			$author = $matches[2] . ' / ' . $matches[3];
		}
		else
		{
			$heroname = $toptitle;
			$author = $username;
		}


		echo "         <tr><td> <div id=\"hero\">".$heroname."</div></td>\n";
		echo "         <td> <div id=\"hero\">".$author."</div></td>\n";
		echo "         <td> <div id=\"hero\"><a href=\"http://forums.alliedmods.net/showthread.php?t=".$row['threadid']."\" target=\"_blank\">".$row['views']."</a></div></td>\n";
		//echo "         <td> <div id=\"hero\"><a href=\"http://forums.alliedmods.net/attachment.php?attachmentid=".$down_id."\">".$downcount."</a></div></td></tr>\n";
	}
?>