Jump to content
MakeWebGames

Updating of online and profile status


modernmafia
 Share

Recommended Posts

The problem,when you logout of the game it takes roughly 15 mins to update the online page im not sure if thats normal but some people i have spoke to says it fine, also that is like that with viewprofile i don know if its cause of my interval or what but ill post my problem files below also any suggestion on this problem and is it caused by the below files also when your not clicking on the game ( idle ) it takes you off the online page too ?

 

any help is appreciated and suggestion are welcome thanks for your time on looking :

 

 

players online :

<?
require("safe.php");
?>


<table width="90%" align="center" border="0">
 <tr>
   <td valign="top" width="50%">
     <table width='95%' border="1" align="center" cellpadding="0" cellspacing="1" bordercolor='#000000' bgcolor='#FFFFFF' class="table">
       <tr>
         <td align="center" bordercolor="#000000" bgcolor='#133337' class='style2' colspan="2"><label>Players Online</label></td>
       </tr>
       <tr>
         <?
         $query = mysql_query("SELECT name,state,sitestate,power FROM login WHERE hide='0' AND DATE_SUB(NOW(),INTERVAL 30 MINUTE) <= lastactive OR alltime='1' ORDER BY power DESC, id ASC");
         $count = mysql_num_rows($query);
         $counter = 0;

           echo '<tr><td width="10%" align="center" class="info_row" colspan="2">Total Users Online: '.$count.'</td></tr>';
           echo "<td width='70%' align='left' bordercolor='#000000' bgcolor='#333333' class='style1' valign='top'>";

           while($fetch = mysql_fetch_assoc($query)){
             $class = "normal_online";
             if($fetch['power'] == 4){ $class = "admin_online"; }
             if($fetch['power'] == 3){ $class = "mod_online"; }
             if($fetch['power'] == 2){ $class = "hdo_online"; }
               echo "<a href=\"home.php?pageid=900&studentname=".$fetch['name']."\"><span class = ".$class.">".$fetch['name']."</span></a>";
               $counter++;

             if($counter != $count) {
               echo "<label> - </label>";
             }
           }
         ?>
         </td>

         <td width="30%" align="left" class="style1" valign="top">
            <font color="red"><b>Adminstrators</b></font><BR>
            <font color="green"><b>Moderators</b></font><BR>
            <font color="yellow"><b>Help Desk Operators</b></font><br><br>
       </tr>
     </table>
   </td>
   <td valign="top" width="50%">
     <table width='95%' border="1" align="center" cellpadding="0" cellspacing="1" bordercolor='#000000' bgcolor='#FFFFFF' class="table">
       <tr>
         <td align="center" bordercolor="#000000" bgcolor='#133337' class='style2' colspan="4"><label>Gang Domination</label></td>
       </tr>
       <tr>
         <td width="10%" align="left" class="info_row"> </td>
         <td width="50%" align="left" class="info_row"> Gang name</td>
         <td width="20%" align="left" class="info_row"> Online</td>
         <td width="20%" align="left" class="info_row"> %</td>
       </tr>
         <?
         // Get the total amount of online players with a gang
         $gang_query1 = mysql_query("SELECT id FROM login WHERE gang != '' AND DATE_SUB(NOW(),INTERVAL 30 MINUTE) <= lastactive");
         $total_online = mysql_num_rows($gang_query1);

         $query = mysql_query("SELECT name,color,suspended FROM gangs ORDER by id ASC");
         while($fetch = mysql_fetch_assoc($query)){
           // Get the amount of players in this gang:
           $gang_query2 = mysql_query("SELECT id FROM login WHERE gang = '".$fetch['name']."' AND hide='0' AND DATE_SUB(NOW(),INTERVAL 15 MINUTE) <= lastactive");
           $online = mysql_num_rows($gang_query2);
           // Calculate percent:
           $percent = (($online/$total_online)*100);
           // Check if the gang is suspended:
           $nametwo = '';
           $suspended = $fetch['suspended'];
           if($suspended != 0){
             $nametwo = '<i>(suspended)</i>';
           }
           echo "<tr>                  
                   <td width='10%' class = ".$fetch['color'].">
                      
                   </td>
                   <td width='50%' bordercolor='#000000' bgcolor='#333333' class='style1'>
                     <a href=\"home.php?pageid=901&gangname=".$fetch['name']."\"> ".$fetch['name']." ".$nametwo."</a>
                   </td>
                   <td width='20%' bordercolor='#000000' bgcolor='#333333' class='style1'>
                      ".$online."
                   </td>
                   <td width='20%' bordercolor='#000000' bgcolor='#333333' class='style1'>
                      ".round($percent,1)."%
                   </td>
                 </tr>
                 ";
           }
         ?>
         <tr>
           <td align="center" bordercolor="#000000" bgcolor='#133337' class='style2' colspan="4"><label> </label></td>
        </tr>
        <tr>
           <td colspan="4" align="center" class="style1"><img src="onlineimg.php"></img></td>
       </tr>
     </table>
    </td>  
 </tr>
</table>



Link to comment
Share on other sites

If you really want to stop this, when you log out, you need to set it to set the last online time to:

 

time() - 900

 

That is 15 minutes before the time you click log out.

For it to work any other way, would require changing how the script works, which I have doubts on your ability to do.

i have some skills but i am new to this hence why im asking but thank you

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...