you need somekind of if statment to swap the INSERT querys around for example:
<?php $title = "Click"; ?>
<?php
include("config.php");
ob_start();
$dbip = "";
$ip = $_SERVER['REMOTE_ADDR'];
$id = $_GET['id'];
$result = mysql_query("SELECT * FROM clicks WHERE user_id='$id'");
while($rs = mysql_fetch_array($result)) {
$dbip = $rs['ip'];
}
if($dbip == $ip) {
echo "You have already clicked this link today!";
}
else {
mysql_query("INSERT INTO clicks(ip, user_id) VALUES('$ip','$id')");
$result = mysql_query("SELECT * FROM players WHERE id='$id'");
while($rs = mysql_fetch_array($result)) {
$username = $rs['user'];
$clicks = $rs['clicks'];
}
$clicks_today = $rs['clicks_today'];
$money_available = $rs['money_available'];
if("$clicks_today >=750)
{
//This is applied if $clicks_today is 750 or more
mysql_query("UPDATE players SET total_clicks='+1' WHERE id='$id'");
mysql_query("UPDATE players SET clicks_today='750' WHERE id='$id'");
print"This $username just attempted to recruit you, but he already has 750 clicks today. <br><Br> You should register, become more powerfull than him, and teach him a lesson.";
}
else
{
//This is applied if $clicks_today is less than 750
$total_clicks = mysql_query("UPDATE players SET total_clicks='+1' WHERE id='$id'");
echo "
<center><font size='-1'><B>" . $username . " </B>now has <b>" . number_format(($clicks + 1)) . " </b> recruits.</center>";
$new_clicks_today = $clicks_today + 1;
$new_clicks = $clicks + 1;
mysql_query("update players set clicks_today='$new_clicks_today' WHERE id = '$id'");
mysql_query("update players set clicks='$new_clicks' WHERE id = '$id'");
}
}
?>
i think thats right my knowledge of php aint amazing but give it a shot
you simply need to make a php file that resets clicks_today in the database to 0 when the php file is parsed so you make a cron job on your server to run the script at midnight?
should work right?