Online Status

Results 1 to 5 of 5
  1. #1
    Apprentice HoldUp is offline
    MemberRank
    Sep 2017 Join Date
    5Posts

    Online Status

    Hey, I've added this: into my client and it doesn't auto reload when another user comes online
    Can someone help?


  2. #2
    Proficient Member Boraida is offline
    MemberRank
    May 2011 Join Date
    The NetherlandsLocation
    161Posts

    Re: Online Status

    You can achieve this by either using websockets or an AJAX request and an interval.

  3. #3
    Novice Inteel is offline
    MemberRank
    Aug 2014 Join Date
    3Posts

    Re: Online Status

    Quote Originally Posted by HoldUp View Post
    Hey, I've added this:<img src="https://imgur.com/a/px4jl" border="0" alt=""> <img src="https://i.imgur.com/VskcDZy.png" border="0" alt=""> <img src="http://prntscr.com/hf9sy8" border="0" alt="">into my client and it doesn't auto reload when another user comes online<br>
    Can someone help?
    create a php file with the name onlinecount.php, and put the code in it
    Code:
    <?phprequire_once('./data_classes/server-data.php_data_classes-core.php.php');require_once('./data_classes/server-data.php_data_classes-session.php.php');$maintenance2 = mysql_num_rows(mysql_query("SELECT * FROM cms_settings WHERE mantenimiento = '1'"));$useradmin2 = mysql_query("SELECT * FROM users WHERE username = '" . $_SESSION['username'] . "'");$useradmin = mysql_fetch_array($useradmin2);$palavrasbloqueadas=file_get_contents('./Files/PalavrasBloqueadas.txt');if($maintenance2 == '1' && $useradmin['rank'] < 5){		header("Location: manutencao");}?><html><head></head><body><div class="clientOnlineBox"><div class="clientOnlineBoxTxt" id="onlinecount"><small><b><?php echo $UsersOnline; ?></b> Online!</small></div><img src="http://200.98.70.115/Externos/img/onlineiconclient.png" style="width:29px;height:28px;ht; */position: absolute;margin-left: 130px;margin-top: -19px;"></div></div></body></html>
    Change what's inside <?php in the first line, to that of your cms
    Then use this div in your client.php

    Code:
    <script type="text/javascript">  setInterval("$('#onlinecount').load('onlinecount.php');", 5000);</script>
    <div id="onlinecount"><?phpinclude ("onlinecount.php");?></div>
    5000 = 5 seconds

  4. #4
    Apprentice HoldUp is offline
    MemberRank
    Sep 2017 Join Date
    5Posts

    Re: Online Status

    I've done the first part but you put "Change what's inside <?php in the first line, to that of your cms" what do you mean by that lol?

  5. #5
    o/ Konquer is offline
    MemberRank
    Apr 2014 Join Date
    464Posts

    Re: Online Status

    Assuming you have a php file online_count.php that spits out the amount of users online

    Jquery & Ajax

    Code:
    $(document).ready(function(){
        setInterval(function(){
            $.ajax({
                url:'/online_count.php',
                dataType:'json',
                success:function(response){
                    // Update the online counter value with the response data
                }
            });
        },5000);
    });
    



Advertisement