moanz Posted June 6, 2006 Share Posted June 6, 2006 Hi Guys! Just wondering if anyone can help me.I amd the coder of a fairly large website, so for security sakes I wont mention which site, and I'm having trouble with the usersonline page. Each page has the values and constants in a .php file and the template for each of these pages is a .tpl with the same name. The file in particular is the usersonline page (usersonline.php and usersonline.tpl).Everything works fine except the guests online. The page shows all members online, their names, what they are viewing, how long since they changed page/logged in and such, and at the top of the page, it has "There are X Members online right now. (Z Members and C Guests), where Z Members is always the correct number, yet for some reason, C is always 2. It ALWAYS Says there are 2 guests online, so the total is always members + 2.This is the code I have in place in the .php file $guests = $this->count_guests(); $num_guests = count($guests); $members = $this->get_members(); $num_members = count($members); $num_total = $num_guests+$num_members; $num_invisible = 0; function count_guests() { $tbl_guests = $this->project->tblname("guests"); $tenminsago = time()-(60*10); return $this->db->row( "SELECT count(*) as count FROM $tbl_guests ". "WHERE last_on>$tenminsago" ); } function get_members() { $tbl_users = $this->project->tblname("users"); $tenminsago = time()-(60*10); $query = "SELECT u.id, u.name as username, u.last_on, u.last_request, u.temple, u.pref_invisible ". "FROM $tbl_users as u WHERE u.last_on>$tenminsago ORDER BY u.name"; return $this->db->rows($query); } in the .tpl file {total} Users Online ({num_members} Members{invisible}) ({num_guests} Guests)The Invisible function shows how many members are online that have chosen invisible, but does not show any names.Can anyone give me any ideas as to fixing this problem and getting the right number of guests? Quote Link to comment https://forums.phpfreaks.com/topic/11294-php-problem-guests-and-members/ Share on other sites More sharing options...
EKINdesigns Posted June 6, 2006 Share Posted June 6, 2006 It doesnt look like there is anything wrong with the viewing script, but what happens when the script adds a guest to the database. Is there an error returned?I had this same problem, and the solution was to add a primary field with the auto_increment value. Mine retured an error something to the effect of...duplicating primary values.If you want to contact me, I might be able to help you further. Quote Link to comment https://forums.phpfreaks.com/topic/11294-php-problem-guests-and-members/#findComment-42274 Share on other sites More sharing options...
moanz Posted June 6, 2006 Author Share Posted June 6, 2006 well i just had a sticky beak in the database, and the table in which guests go into, theres only one row. And each time i refresh it, its a new value. This could be the problem? How could i fix it. Quote Link to comment https://forums.phpfreaks.com/topic/11294-php-problem-guests-and-members/#findComment-42275 Share on other sites More sharing options...
moanz Posted June 6, 2006 Author Share Posted June 6, 2006 i tried copying the table with auto increment but that doesnt work. any ideas?!?!?!?! Quote Link to comment https://forums.phpfreaks.com/topic/11294-php-problem-guests-and-members/#findComment-42283 Share on other sites More sharing options...
EKINdesigns Posted June 6, 2006 Share Posted June 6, 2006 Whats the funtion to increase the guests? Quote Link to comment https://forums.phpfreaks.com/topic/11294-php-problem-guests-and-members/#findComment-42286 Share on other sites More sharing options...
poirot Posted June 6, 2006 Share Posted June 6, 2006 Maybe the problem is how you identify your guests...What do you do to ensure they are actually unique visitors? Quote Link to comment https://forums.phpfreaks.com/topic/11294-php-problem-guests-and-members/#findComment-42287 Share on other sites More sharing options...
moanz Posted June 6, 2006 Author Share Posted June 6, 2006 well each entry into the table for guests has 2 colums. "last_on" which is a stamp of their time, and "ip" which is their ip address. so the ip would be already there in theory and the last_on would just update. however, only one entry will stay in there from what i see which just gets over written each new person that comes in !!!!! aggrvating. how can i make it so more than one will enter at one time? Quote Link to comment https://forums.phpfreaks.com/topic/11294-php-problem-guests-and-members/#findComment-42316 Share on other sites More sharing options...
localhost Posted June 6, 2006 Share Posted June 6, 2006 its obviously a phpbb forum... Quote Link to comment https://forums.phpfreaks.com/topic/11294-php-problem-guests-and-members/#findComment-42537 Share on other sites More sharing options...
moanz Posted June 7, 2006 Author Share Posted June 7, 2006 its actually a custom forum, i didnt write it, but who ever did used phpBB tables or their names atleast. Quote Link to comment https://forums.phpfreaks.com/topic/11294-php-problem-guests-and-members/#findComment-42712 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.