#!/usr/local/bin/php 0) { $points = $points * ($dayDiff * SCALAR); } // Other forum activity is scaled exponentially based on the recency of the posts. } else { $sql = "SELECT * FROM post WHERE thread = " . $thread['id']; $result2 = mysql_query($sql); $points = 0; while ($post = mysql_fetch_assoc($result2)) { $timeDiff = $currentTime - $post['timestamp']; $dayDiff = floor($timeDiff / 86400); $points += (MAX_REWARD / pow(2, $dayDiff)); } } $sql = "UPDATE thread SET activity = " . ceil($points) . " WHERE id = " . $thread['id']; mysql_query($sql); } ?>