vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Community Lounge (https://vborg.vbsupport.ru/forumdisplay.php?f=13)
-   -   Theory of how Who's Online Feature Works (https://vborg.vbsupport.ru/showthread.php?t=39941)

06-16-2002 09:23 PM

Theory of how Who's Online Feature Works
 
Hi Peeps.

I am interested in adding a feature like who's online to my website. I am fairly confident in coding with PHP. What I need is basically the theory of how the Who's Online Feature works and more importantly how it realises a user is not looking at the board no more etc.

Thanks for any help which can be offered.

Mark Hensler 06-17-2002 02:50 AM

ascii flow chart (sort of)
Code:


updating session table..
--
ENTER

sql: DELETE FROM session_table WHERE timestamp>(now()-$session_timeout)

sql: UPDATE INTO session_table SET timestamp=now() AND session_id=$your_session_id

RETURN
--

reading sessions table..
--
ENTER

sql: SELECT * FROM session_table
php: print all returned records

RETURN
--

You'll have to define $session_timeout as an integer constant. This will signify how long to keep a session before killing it.

You'll also have to generate a unique $your_session_id and use it to track users.

06-17-2002 07:29 AM

Ahhh cool m8ty that helps a lot. One final question tho. When does the function to delete from the session table get executed and in which script? For Eg. Is that run everytime the forumlist is loaded?

Admin 06-17-2002 11:20 AM

There was a script for this at EvilWalrus.com (http://evilwalrus.com/) but the they have seem to delete all the snippets.

Mark Hensler 06-17-2002 04:05 PM

Depending on your traffic, you may run it everytime a page is hit, or once every X times. Or you could put it in a cron job and set it off every 5 minutes.


All times are GMT. The time now is 12:35 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01042 seconds
  • Memory Usage 1,713KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete