I hope someone here can help me

I have a hack that stopped working after upgrading to 3.5.1. I have already made the change for "db" from "DB_site", but this page seems to still be having a problem:
http://www.familycorner.com/forums/contest.php3
You will see if you scroll down to where it says "Posts Today" in a purple box that the total number of posts are missing. This is what the post count is calling from:
PHP Code:
<?php
while ($user = $db->fetch_array($users))
{
$username = $user["username"];
echo ("$username<br>");
}
echo ("<br>");
while ($user = $db->fetch_array($admin))
{
$username = $user["username"];
echo ("$username<br>");
}
?>
<br>
</font>
</td>
<td align="center">
<FONT face="verdana,verdana" size="2">
<br>
<?php
$db->data_seek(0,$users);
while ($user = $db->fetch_array($users))
{
$count = $user["count"];
echo ("$count<br>");
}
echo ("<br>");
$db->data_seek(0,$admin);
while ($user = $db->fetch_array($admin))
{
$count = $user["count"];
echo ("$count<br>");
}
?>
What else do I need to change from the old version code to update it to work on 3.5.1?
THANK YOU!
Sorry, I should have posted this as well. This code is at the top of the page, just under the body tag:
PHP Code:
<?php
$date1 = "UNIX_TIMESTAMP(\"2005-11-10\")";
$date2 = "UNIX_TIMESTAMP(\"2005-11-11\")";
$users = $db->query(
"SELECT post.userid, count(post.userid) as count, user.username from " .
"post, user WHERE post.dateline >= $date1 and post.dateline <= $date2 " .
"and post.userid = user.userid and user.username <> 'Dawn' group ".
"by post.userid order by count DESC");
$admin = $db->query(
"SELECT post.userid, count(post.userid) as count, user.username from " .
"post, user WHERE post.dateline >= $date1 and post.dateline <= $date2 " .
"and post.userid = user.userid and user.username = 'Dawn' group ".
"by post.userid order by count DESC");
?>
and this is at the very top of the page, before the HTML tag:
PHP Code:
<?php require("global.php3"); ?>