I am in need of a quick php code that I can insert into my vote.php so that it will clear a database every 24 hours. I have tried to rip from other releases, but I cannot figure out how, I am offering a bit of money for this, but would prefer it free.
Here is the vote.php code.

Code:
<?php


$vote_checking = false;

$host = "localhost";
$user = "militusn_vots";
$pass = "vots";
$name = "militusn_vots";
define("VOTE_HOURS", 24);

$vote1 = array("name" => "Runelocus", "url" => "http://www.runelocus.com/toplist/vote-5585.html");
$vote2 = array("name" => "TopG", "url" => "http://topg.org/in-352938");
$vote3 = array("name" => "Top100Arena", "url" => "http://www.top100arena.com/in.asp?id=75797");
$vote4 = array("name" => "GTop100", "url" => "http://www.gtop100.com/in.php?site=70169");

if(!@mysql_connect($host, $user, $pass))  {
	die("error connecting to mysql server - " . mysql_error());	
}
if(!@mysql_select_db($name))  {
	die("error selecting mysql database - " . mysql_error());	
}

if($vote_checking) {
	$sql = mysql_query("SELECT * FROM `tempvotes`");
	if (mysql_num_rows($sql) > 0) {
		while ($row = mysql_fetch_array($sql)) {
			if((time() - $row['time']) > 3600)  
				mysql_query("DELETE FROM `tempvotes` WHERE `id` = '" . $row['id'] . "'");
		}
	}
}

$sql = mysql_query("SELECT * FROM `votes`");
if (mysql_num_rows($sql) > 0) {
	while ($row = mysql_fetch_array($sql)) {
		if ((time() - $row['time']) > strtotime("+1 day", $row['time'])) {
			mysql_query("DELETE FROM `votes` WHERE `authcode` = '" . $row['authcode'] . "'");
		}
	}
}

if($vote_checking) {
	if(isset($_GET['postback'])) {
		$id = anti_sql($_GET['postback']);
		mysql_query("UPDATE `tempvotes` SET `voted`='1' WHERE `id` = '" . $id . "'") or die("error running query - " . mysql_error());
	}
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Militus - Vote</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="vote.js"></script>
</head>
<body>
<table width="75%" border="0" cellpadding="1" align="center" id="box">
  <tr>
<p align="center"><img src="http://i42.tinypic.com/zugt3k.png">
	<td class="contents">
	  <h3><font color="purple">Vote for us</font></h3>
	  <p>Voting for us each day helps us become more popular each day. How you may think? The more votes we get the higher ranked we are on RuneScape private server lists. The higher we are the more times people may want to click on us and join. So to becomming a great server we need votes to make us stand out from the rest.</p>
	  <p>We offer an reward for voting us, now we only offer this reward when you vote at all 3 sites below. To do so click each button fill the recaptcha image and vote. Then come back and wait for the timer and then you will be given an Auth code. Use this auth code in-game by doing ::auth authcode to receive your reward.</p>
	  <noscript><div style="text-align: center; color:red; font-weight: bold;">YOU DO NOT HAVE JAVASCRIPT ENABLED YOU MAY NOT VOTE.</div></noscript> 
				  <?php 
			if(@fsockopen($_SERVER['REMOTE_ADDR'], 80, $errno, $errstr, 1)) {
                        	echo "<div style=\"text-align:center; color:red;\">Proxy ban. ;-)</div>";
                        } else if(mysql_num_rows(mysql_query("SELECT * FROM `votes` WHERE `ipaddress` = '" . $_SERVER['REMOTE_ADDR'] . "' LIMIT 1;")) > 0) {
				echo "<div style=\"text-align:center; color:red;\"><p>You have already voted in the last 24 hours. But you can get your friends to vote for you, just remember to ask them for the auth code.</div>";
				echo "<div align=\"center\"><textarea readonly=\"readonly\" onClick=\"this.focus();this.select();\" style=\"width:315px; height:15px;\">http://www.wemodyou.com/Forums/vote.php</textarea></div>";
			} else if(isset($_POST['confirm'])) {
				$voteid = anti_sql($_POST['voteid']);
				$give_auth = true;
				if($vote_checking) {
					$query = mysql_query("SELECT * FROM `tempvotes` WHERE `id` = '".$voteid."'");
					if(mysql_num_rows($query) > 0) {
						$row = mysql_fetch_array($query);
						if($row['voted'] == 1) {
							mysql_query("DELETE FROM `tempvotes` WHERE `id`='".$voteid."'");
						} else {
							$give_auth = false;
							echo "<div style=\"text-align:center; color:red;\">It has been detected that you have not actually voted at the websites. Go back and actually vote at the sites. ;-)</div>";
						}
					}
				}
				if($give_auth) {
					$auth = random_auth();
					mysql_query("INSERT INTO `votes` (`time`, `authcode`, `ipaddress`) VALUES('".time()."', '".$auth."', '".$_SERVER['REMOTE_ADDR']."')");
					echo "<div style=\"text-align:center; color:yellow;\">Your auth code is ".$auth." type ::auth ".$auth." to receive your reward in-game.</div>";
				}
			} else {
				if($vote_checking) {
					$randomid = rand(10000, 20000);
					mysql_query("INSERT INTO `tempvotes` (`id`, `time`, `ipaddress`) VALUES('".$randomid."', '".time()."', '".$_SERVER['REMOTE_ADDR']."')");
				}
			?>
			<p>
			<div id="vote" align="center">
				<form>
					<input type="button" value="Vote: <?php echo $vote1['name']; ?>" onclick="window.open('<?php echo $vote1['url']; ?>'); setStatus(1);"/>
					<input type="button" value="Vote: <?php echo $vote2['name']; ?>" onclick="window.open('<?php echo $vote2['url']; ?>'); setStatus(2);"/>
					<input type="button" value="Vote: <?php echo $vote3['name']; ?>" onclick="window.open('<?php echo $vote3['url'] . ($vote_checking ? "&incentive=" . $randomid : "") ?>'); setStatus(3);"/>
				        <input type="button" value="Vote: <?php echo $vote4['name']; ?>" onclick="window.open('<?php echo $vote4['url']; ?>'); setStatus(4);"/>
</form>
			</p>
			<div id="votewarning"></div>
				<div id="votestatus">
					<form method="post" name="voted">
						<input type="hidden" name="confirm" value="true"/>
              			<?php if($vote_checking) { ?>
						<input type="hidden" name="voteid" value="<?php echo $randomid; ?>"/>
                        <?php } ?>
						<input type="button" name="reward" value="Reward" onclick="javascript:checkStatus()"/>
					</form>
				</div>
				</form>
			</div>
			<?php } ?>
	</td>
  </tr>
</table>
<div id="footer">Copyright &copy; 2011 <!-- Please leave credits alone. ;-(-->System by Stuart Smith</a>.
</body>
</html>
<?php

function anti_sql($sql)
{
	return mysql_real_escape_string($sql);
}

function random_auth() 
{
	$random = "";
	for ($i=0; $i<6; $i++) 
	{
		$d=rand(1,30)%2;
		$random .= strtolower($d ? chr(rand(65,90)) : chr(rand(48,57)));
	}
	return $random;
}


?>