Ajax Who's Online

Edits:
1 Template to edit (FORUMHOME)
1 File to edit (index.php)

First the File Edit:
Open your index.php file in your forum directory.
Find:

PHP:
                       // ### ALL DONE! SPIT OUT THE HTML AND LET'S GET OUTTA HERE... ###

Above add:

PHP:
                       if ($_GET['do'] == 'online') 
{ 
    echo $activeusers; 
    exit; 
}

Save, close, then upload index.php file to your forum directory.

Next, open your FORUMHOME template.
Find:

HTML:
                  <div class="smallfont">
                <div style="white-space: nowrap"><phrase 1="$recordusers" 2="$recorddate" 3="$recordtime">$vbphrase[most_users_ever_online_was_x_y_at_z]</phrase>

Above that, add:

HTML:
      <script type='text/javascript'>
<!--
function requestWhoOnline()
{
    doReqOnline = new vB_AJAX_Handler(true)
    doReqOnline.onreadystatechange(ReqOnlineDone)
    doReqOnline.send('index.php?do=online')
}
function ReqOnlineDone()
{
    if (doReqOnline.handler.readyState == 4 && doReqOnline.handler.status == 200)
    {
        fetch_object('whoisonline').innerHTML = doReqOnline.handler.responseText
        setTimeout("requestWhoOnline()", 60000)
    }
}
setTimeout("requestWhoOnline()", 20000)
-->
</script>

Now Find:

HTML:
      <div>$activeusers</div>
Replace with:

HTML:
<div id="whoisonline">$activeusers</div>
 
you can also add

Code:
<div id="whoisonline">$activeusers</div>

anywhere on the index.


I have it incorperated into my shoutbox
 
you dont can make any screenshot for it...the who is online display new users without reload the site...
 
Back
Top