function Profile($username) { global $db, $config; $this->username = $username; $array = $db->getInfo($this->username); // Gets the information on the logged in username //>>> Assigns the information of the logged in user to the member data <<<<< $this->rank = $db->getRankName($this->username); $this->rank_num = $array['rank']; $this->email = $array['email']; $this->aim = $array['aim']; $this->title = $db->getRankName($this->username) . ' ' . $array['displayname']; $this->recruiter = $array['recruiter']; $this->recruits = mysql_num_rows($db->getRecruits($this->username)); $this->ip = $array['ip']; $this->joined = $array['joined']; $this->last_login = $array['last_login']; $this->status = $db->isActive($this->username, $config->getSetting('active_timeout')); $this->dsl = daysSinceTimestamp($this->last_login); $this->image = '<img src="images/' . $this->rank_num . '.jpg" alt="' . $this->rank . '" />'; $this->location = $array['location']; $this->quote = $array['quote']; $this->maingame = $array['maingame']; $this->image_path = $array['image_path']; }
function getAverageDsl() { $sql = 'select last_login from users where disabled = 0 and ia = 0;'; $result = mysql_query($sql); $total = 0; while ($row = mysql_fetch_array($result)) { $total = $total + daysSinceTimestamp($row['last_login']); } $average = $total / mysql_num_rows($result); return $average; }
function checkAutoPromotion() { global $db, $config, $notification; $sql = 'select username, joined from users where rank = 1;'; $result = mysql_query('select username, joined from users where rank = 1;'); while ($row = @mysql_fetch_array($result)) { if (daysSinceTimestamp($row['joined']) >= 2) { $sql = 'update users set rank = 2 where username = "******" limit 1;'; $result = mysql_query($sql); $event = $row['username'] . ' was promoted for having 2 days in the clan.'; $notification->setNot($array['username'], 0, 'You have been Promoted', $event); } } $sql = 'select username, joined from users where rank = 2;'; $result = mysql_query($sql); while ($row = @mysql_fetch_array($result)) { if (daysSinceTimestamp($row['joined']) >= 5) { $sql = 'update users set rank = 3 where username = "******" limit 1;'; $result = mysql_query($sql); $event = $row['username'] . ' was promoted for having 5 days in the clan.'; $notification->setNot($array['username'], 0, 'You have been Promoted', $event); } } $sql = 'select username, joined from users where rank = 3;'; $result = mysql_query($sql); while ($row = @mysql_fetch_array($result)) { if (daysSinceTimestamp($row['joined']) >= 10) { $sql = 'update users set rank = 4 where username = "******" limit 1;'; $result = mysql_query($sql); $event = $row['username'] . ' was promoted for having 10 days in the clan.'; $notification->setNot($array['username'], 0, 'You have been Promoted', $event); } } $sql = 'select username, joined from users where rank = 4;'; $result = mysql_query($sql); while ($row = @mysql_fetch_array($result)) { if (daysSinceTimestamp($row['joined']) >= 15) { $sql = 'update users set rank = 5 where username = "******" limit 1;'; $result = mysql_query($sql); $event = $row['username'] . ' was promoted for having 15 days in the clan.'; $notification->setNot($array['username'], 0, 'You have been Promoted', $event); } } }