Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private function culturePoints() {
- global $database;
- $ourFileHandle = @fopen("GameEngine/Prevention/culturepoints.txt", 'w');
- @fclose($ourFileHandle);
- $time = time()-60;
- $array = array();
- $q = "SELECT id, lastupdate FROM ".TB_PREFIX."users where lastupdate < $time";
- $array = $database->query_return($q);
- foreach($array as $indi) {
- if($indi['lastupdate'] < $time){
- $dif = $time-$indi['lastupdate'];
- $cp = $database->getVSumField($indi['id'], 'cp');
- $cp = $cp/86400;
- $cp = $cp*$dif;
- $newupdate = time();
- $q = "UPDATE ".TB_PREFIX."users set cp = cp + $cp, lastupdate = $newupdate where id = '".$indi['id']."'";
- $database->query($q);
- }
- }
- if(file_exists("GameEngine/Prevention/culturepoints.txt")) {
- @unlink("GameEngine/Prevention/culturepoints.txt");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment