All pastes #71817 Raw Edit

Miscellany

public php v1 · immutable
#71817 ·published 2006-06-26 05:22 UTC
rendered paste body
<?phpfunction parseNews($newsid) {	include "mysqlsettings.php";		global $idnum;	global $title;	global $author;	global $date;	global $avatar;	global $newstext;		global $year;	global $month;	global $day;		$query = "SELECT id FROM $mysql_newstbl";	$result = mysql_query($query) or die('n1 Query failed: ' . mysql_error());	while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {		$highest = 0;		foreach ($line as $col_value) {			if ($col_value > $highest) {				$highest = $col_value;			}		}	}		if ($newsid == "newest") {		$newsid = $highest;	}	elseif ($newsid > $highest) {		die("There's no news that high!");	}	elseif (!$newsid) {		return 0;	}		$query = "SELECT * FROM $mysql_newstbl WHERE id = $newsid";	$result = mysql_query($query) or die('n2 Query failed: ' . mysql_error());	$newsdata = mysql_fetch_array($result, MYSQL_NUM);		$idnum = $newsdata[0];	$title = $newsdata[1];	$author = $newsdata[2];	$date = $newsdata[3];	$avatar = $newsdata[4];	$newstext = $newsdata[5];		$year = substr($date, 0, 4);	$month = substr($date, 4, 2);	$day = substr($date, 6, 2);		while(str_replace("\'","'",$author) > 0);	$newstext = htmlentities($autho);		while(str_replace("\'","'",$title) > 0);	$newstext = htmlentities($title);		while(($newstext = (str_replace("\\'","'",$articletext))) > 0);	$newstext = htmlentities($newstext);}?>