All pastes #940553 Raw Edit

Someone

public text v1 · immutable
·published 2008-03-13 01:33 UTC
rendered paste body
<?php
	global $sql;
	if(isset($_GET['id'])) {
		$newsid=security_clean($_GET['id']);
		$arrNews = $sql->sqlarr("SELECT * FROM news where id = '".$newsid."' LIMIT 1");
		if($arrNews) {
			print '<h3>News</h3>';
			for ($i=0;$i<count($arrNews);$i++) {
				print "<b><a href='?page=news&id=".$arrNews[$i][0]."'>".$arrNews[$i][1]."</a></b><br />";
				print "".$arrNews[$i][2]."<br />";
				print "posted on <b>".$arrNews[$i][4]."</b> by<b> ".$arrNews[$i][3]."</b><br /><br />";
			}
		}else {
			print '<h3>Error</h3>';
			print mysql_error();
		}
	}else {
		$arrNews = $sql->sqlarr("SELECT * FROM news ORDER BY id DESC LIMIT 5");
		if($arrNews) {
			print '<h3>News</h3>';
			for ($i=0;$i<count($arrNews);$i++) {
				print "&nbsp;&nbsp;&nbsp;";
				print "<b><a href='?page=news&id=".$arrNews[$i][0]."'>".$arrNews[$i][1]."</a></b><br />\n";
				print "&nbsp;&nbsp;&nbsp;";
				print "&nbsp;&nbsp;&nbsp;";
				print "".$arrNews[$i][2]."<br />\n";
				print "&nbsp;&nbsp;&nbsp;";
				print "&nbsp;&nbsp;&nbsp;";
				print "posted on <b>".$arrNews[$i][4]."</b> by<b> ".$arrNews[$i][3]."</b><br /><br />\n";
			}
		}else {
			print '<h3>Error</h3>';
			print mysql_error();
		}
	}
?>