To show and increase a download count, you can have a page called "download.php", and put this code in it. Then you can the page like this: download.php?fileid=1
<?php
// connect to mysql database
$query = "UPDATE table SET downloads = downloads + 1 WHERE id='" . $_GET['fileid'] . "'";
$result = mysql_query($query) or die(mysql_error());
// send the file (hopefully you knows how to do this...)
echo "Download Link";
?>
When it comes to the rating, just add two fields to your downloads table; votes and rating... this code can be used when voting:
<?php
// connect to mysql here
// this should be the chosen value from the vote form
$vote = $_POST['vote'];
// you should also have a hidden field in the form with
// the file's id in it...
$file = $_POST['file'];
// get the file's data
$sql = "SELECT * FROM table WHERE id='" . $file . "'";
$result = mysql_query($sql) or die(mysql_error());
$data = mysql_fetch_array($result,1);
// add the vote the total one
$data['votes']++;
// figure out the new rating
$rating = (($data['rating']+$vote)/$data['votes']);
// update the db
$update = "UPDATE table SET votes='" . $data['votes'] . "' AND rating='" . $rating . "' WHERE id='" . $file . "'";
$result = mysql_query($update) or die(mysql_error());
?>
These codes may contain errors, but these are just to give you an idea of how to do... =)