Hi, I put this together for you. first, create a folder called "ips". chmod it to 0777. Here is the code I re-did for you: [code] <?php $winner1 = 234; $winner2 = 630; $winner3 = 550; $check = file_get_contents("ips/".$_SERVER[REMOTE_ADDR].".txt"); if($check<30000){ srand ((double) microtime( )*1000000); $random_number = rand(0,10000); echo "Your Number: $random_number<br>"; if ( $random_number == "$winner1" ) { echo "Congratulations, you're a winner!"; } elseif($random_number == $winner2){ echo "Congratulations, you're a winner!"; } elseif($random_number == $winner3){ echo "Congratulations, you're a winner!"; } else { echo "Sorry ,you're not a winner!"; } $f0 = fopen("ips/".$_SERVER[REMOTE_ADDR].".txt","w+"); $f1 = fwrite($f0,$check+1); if(!is_writable('ips/'.$_SERVER[REMOTE_ADDR].'.txt')){ chmod("ips/".$_SERVER[REMOTE_ADDR], 777); } $f2 = file_get_contents('ips/all.txt'); if(!ereg($_SERVER['REMOTE_ADDR'],$f2) OR (!file_exists('ips/all.txt'))){ $f3 = fopen("ips/all.txt","w+"); $f4 = fwrite($f3,$f2."+".$_SERVER[REMOTE_ADDR]); if(!is_writable('ips/all.txt')){ chmod("ips/all.txt", 777); } } } else { echo "Sorry, you have used your 30000 chances."; } ?> <?php #cron.php $f0 = explode('+',substr(file_get_contents('all.txt'),'1')); for($i=0;$i<$f0;$i++){ unlink($f0[$i].'.txt'); } unlink('all.txt'); ?> [/code] Now, you are going to need to create a cron tab: 0 0 * * * php /path/to/ips/cron.php The cron tab will run every morning at 12am. Here is the code for cron.php: [code] <?php #cron.php $f0 = explode('+',substr(file_get_contents('all.txt'),'1')); for($i=0;$i<$f0;$i++){ unlink($f0[$i].'.txt'); } unlink('all.txt'); ?> [/code] Please note that I haven't tested it yet, but I am sure if there are any errors, you can work it out ;)