10-25-2008, 02:49 PM
|
#2 (permalink)
|
|
The Prestige
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
|
Users online:
PHP Code:
public function get_users_online() { $sql = " SELECT `".$this->db->col['user_id']."`, `".$this->db->col['user_name']."`, `".$this->db->col['user_access']."` FROM `".$this->db->table['users']."` WHERE `".$this->db->col['user_session']."` != ''"; $query = $this->db->query($sql) or die(mysql_error()); if(mysql_num_rows($query)) { $i = 0; while($row = $this->db->fetch($query)) { $this->users[$i]['user_id'] = $row['user_id']; $this->users[$i]['user_name'] = $row['user_name']; $this->users[$i]['user_access'] = $row['user_access']; $i++; } return $this->users; } return false; }
Total members:
PHP Code:
public function get_users_registered() { $sql = sprintf(" SELECT * FROM `%s`", $this->db->table['users']); $query = $this->db->query($sql); if(mysql_num_rows($query)) { $users = array(); $i = 0; while($row = $this->db->fetch($query)) { $users[$i]['user_id'] = $row['user_id']; $users[$i]['user_name'] = $row['user_name']; $users[$i]['user_last_visit'] = $row['user_last_visit']; $users[$i]['user_email'] = $row['user_email']; $users[$i]['user_age'] = $row['user_age']; $users[$i]['user_country'] = $row['user_country']; $users[$i]['user_access'] = $row['user_access']; $users[$i]['user_session'] = $row['user_session']; $i++; } return $users; } return false; }
Edit: This is ofcourse using sessions.. but you should be able to "translate" this to however you would want it if you're not using sessions
I haven't a function for user visitors.. and guests I'm not sure either..
__________________
|
|
|
|