Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Online Status

Newbie Spellweaver
Joined
Sep 22, 2017
Messages
5
Reaction score
0
Hey, I've added this:
HoldUp - Online Status - RaGEZONE Forums
HoldUp - Online Status - RaGEZONE Forums
into my client and it doesn't auto reload when another user comes online
Can someone help?
 
Junior Spellweaver
Joined
May 21, 2011
Messages
154
Reaction score
47
You can achieve this by either using websockets or an AJAX request and an interval.
 
Upvote 0
Initiate Mage
Joined
Aug 23, 2014
Messages
3
Reaction score
0
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
 
Upvote 0
Newbie Spellweaver
Joined
Sep 22, 2017
Messages
5
Reaction score
0
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?
 
Upvote 0
Elite Diviner
Joined
Apr 5, 2014
Messages
464
Reaction score
223
Assuming you have a php file online_count.php that spits out the amount of users online

Jquery & Ajax

Code:
[COLOR=#303336]$[/COLOR][COLOR=#303336]([/COLOR][COLOR=#303336]document[/COLOR][COLOR=#303336]).[/COLOR][COLOR=#303336]ready[/COLOR][COLOR=#303336]([/COLOR][COLOR=#101094]function[/COLOR][COLOR=#303336](){[/COLOR][COLOR=#303336]
    setInterval[/COLOR][COLOR=#303336]([/COLOR][COLOR=#101094]function[/COLOR][COLOR=#303336](){[/COLOR][COLOR=#303336]
        $[/COLOR][COLOR=#303336].[/COLOR][COLOR=#303336]ajax[/COLOR][COLOR=#303336]({[/COLOR][COLOR=#303336]
            url[/COLOR][COLOR=#303336]:[/COLOR][COLOR=#7D2727]'/online_count.php'[/COLOR][COLOR=#303336],[/COLOR][COLOR=#303336]
            dataType[/COLOR][COLOR=#303336]:[/COLOR][COLOR=#7D2727]'json'[/COLOR][COLOR=#303336],[/COLOR][COLOR=#303336]
            success[/COLOR][COLOR=#303336]:[/COLOR][COLOR=#101094]function[/COLOR][COLOR=#303336]([/COLOR][COLOR=#303336]response[/COLOR][COLOR=#303336])[/COLOR][COLOR=#303336]{[/COLOR][COLOR=#303336]
                [/COLOR][COLOR=#858C93]// Update the online counter value with the response data[/COLOR][COLOR=#303336]
            [/COLOR][COLOR=#303336]}[/COLOR][COLOR=#303336]
        [/COLOR][COLOR=#303336]});[/COLOR][COLOR=#303336]
    [/COLOR][COLOR=#303336]},[/COLOR][COLOR=#7D2727]5000[/COLOR][COLOR=#303336]);[/COLOR][COLOR=#303336]
[/COLOR][COLOR=#303336]});
[/COLOR]
 
Upvote 0
Back
Top