User online ! Wo kann ich es ändern

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

Post Reply
kj187
Posts: 4
Joined: Fri Jun 20, 2003 10:53 pm

User online ! Wo kann ich es ändern

Post by kj187 »

Hi, ich will bei mir nicht

1 User Online

stehen haben sondern

User Online: 1

ich habe alle Dateien durchsucht und die DB aber ich finde es einfach nicht. Wo kann ich das ändern ?
Thorsten
Posts: 15744
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

suche mal in der functions.php die Funkltion userOnline(). Ändere dort die Zeile

Code: Select all

return $alles.$msgUserOnline;
in das hier:

Code: Select all

return $msgUserOnline.": ".$alles;
bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
AndrewB
Posts: 171
Joined: Fri Aug 22, 2003 11:15 pm
Contact:

Post by AndrewB »

Hi,

I am changing this function to show me how many people have been in the FAQ today. I am new to php and have no idea it the "(time() - 3600)" is correct or not! How many minutes/hours is this?

Also, it would be very cool if I could do a real "Today" count - where I would go back to midnight today and count all the new session IDs. Is this possible?
Right now - The Today count goes up and down during the day :(

this is what I have:

Code: Select all

function userOnline() {
  global $db, $sqltblpre, $tracking, $msgUserOnline;
  if ($tracking) {
    $timeToday = (time() - 3600);
    $resultToday = $db->query("SELECT count(sid) FROM ".$sqltblpre."faqsessions WHERE time > '".$timeToday."' GROUP BY ip");
    $timeNow = (time() - 300);
    $result = $db->query("SELECT count(sid) FROM ".$sqltblpre."faqsessions WHERE time > '".$timeNow."' GROUP BY ip");
    if (isset($result)) {
      return $msgUserOnline.". Now: ".$db->num_rows($result)." Today: ".$db->num_rows($resultToday);
       }
    }
}
Any help is very much appreciated :)
Thorsten
Posts: 15744
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi Andrew,

your $timeToday gives you the visits from the last hour.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
AndrewB
Posts: 171
Joined: Fri Aug 22, 2003 11:15 pm
Contact:

Post by AndrewB »

thanks Thorsten - I will change it to 86400

I will try to learn some more php to see if it is possible to count all the new session IDs since midnight..
Thorsten
Posts: 15744
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi Andrew,
AndrewB wrote:I will try to learn some more php to see if it is possible to count all the new session IDs since midnight..
this should be possible. :)

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
AndrewB
Posts: 171
Joined: Fri Aug 22, 2003 11:15 pm
Contact:

Post by AndrewB »

I did a little "teach myself" PHP...

I changed it to

Code: Select all

$timeToday = mktime(0, 0, 0);
this seems to work. Not tested it fully but the number is at least increasing so far.
Thorsten
Posts: 15744
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hiho,

mktime() should a possible result. :)

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Post Reply