offset; $result = mysql_query( " SELECT * FROM rating LIMIT $offset, 1" ); return mysql_fetch_array($result); } if($_GET["id"]) { if ($_GET['id']<0 || is_whole_number($_GET['id']) == false) { print "ERROR: The URL contains a malformed ID.

"; $row = randrate(); } else if(is_whole_number($_GET['id']) == true) { $result = mysql_query( " SELECT * FROM rating WHERE id= " . $_GET['id'] ); $row = mysql_fetch_array($result); } } else { $offset_result = mysql_query( " SELECT FLOOR(RAND() * COUNT(*)) AS offset FROM rating "); $offset_row = mysql_fetch_object( $offset_result ); $offset = $offset_row->offset; $result = mysql_query( " SELECT * FROM rating LIMIT $offset, 1 " ); $row = randrate(); } if($row['overallrating'] == 0 || $row['ratingcount'] == 0) { $neatrating = 0; $ratingcount = 0; print "This has not been rated yet.
"; } else { $rawrating = $row['overallrating']/$row['ratingcount']; $ratingcount = $row['ratingcount']; $neatrating = round($rawrating, 1); print "Current rating is: $neatrating (based on " . $row['ratingcount'] . " vote(s))
"; } echo '
'; echo 'URL:
'; if($session->isAdmin()) { echo "IP Address of Submitter: " . $row['submitterip'] . "
"; } echo 'Uploaded by: ' . $row['username'] . "
"; echo $row['comment']; echo '
'; echo ''; ?> Rating: Rubbish 1 2 3 4 5 6 7 8 9 10 Amazing