Online Count

Results 1 to 6 of 6
  1. #1
    Valued Member Vinute is offline
    MemberRank
    Jul 2014 Join Date
    110Posts

    Online Count

    Hello guys,
    I wanted a script that shows how many are online(Not who is online) Just the count. And a server time script. Thanks in advance


  2. #2
    Proficient Member Soulia is offline
    MemberRank
    Apr 2011 Join Date
    167Posts

    Re: Online Count

    Code:
    	mysql_select_db('pw');
    	$countonline = mysql_query("SELECT COUNT(*) AS nb_player FROM point WHERE uid NOT IN (SELECT userid FROM pw.auth) and zoneid IS NOT NULL");
    	$onlinecount = mysql_fetch_array($countonline);
    
    	<?php echo $onlinecount; ?>

  3. #3
    Valued Member Vinute is offline
    MemberRank
    Jul 2014 Join Date
    110Posts

    Re: Online Count

    Any guide on installing it? I installed it on port 80 and here is what it shows: Blank page saying
    mysql_select_db('pw'); $countonline = mysql_query("SELECT COUNT(*) AS nb_player FROM point WHERE uid NOT IN (SELECT userid FROM pw.auth) and zoneid IS NOT NULL"); $onlinecount = mysql_fetch_array($countonline);
    - - - Updated - - -

    I also wanted to know why is this script not working, Shows blank page only


    <?php

    $host="localhost";
    $username="root";
    $password="done";
    $database="pw";
    $table="online";




    mysql_connect("$host", "$username", "$password") or die (mysql_error());
    mysql_select_db("$database") or die (mysql_error());




    session_start();


    $session = session_id();
    $time = time();


    mysql = ''SELECT * FROM $table WHERE session='$session'";


    $result = mysql_query($mysql);


    $count = mysql_num_rows($result);


    if($count == NULL)
    mysql_query("INSERT INTO $table (session, time) VALUES ('$session','$time')");
    else
    mysql_query(UPDATE $table SET time='$time' WHERE session = 'session'");


    $count_user = mysql_query("SELECT * FROM $table");
    $count_user = mysql_num_rows($count_user);




    echo"$count_user";




    mysql_query("DELETE FROM #table WHERE time < $time-10");


    mysql_close();

  4. #4
    SON OF MARFEL hrace009 is offline
    MemberRank
    Apr 2009 Join Date
    Pekanbaru, IndoLocation
    1,035Posts

    Re: Online Count

    Code:
    <?php
    #Author: Ben Noitov (Romulan)
    
    $DB_Host = "DBSERVER:3306";  // localhost or your IP
        $DB_User = "DBUSER";  // Database user
        $DB_Password = "DBPASSWORD";  // Database password
        $DB_Name = "DBNAME";  // Database name
        $ServerIP = "SVRIP";  // IP your PW Server  or 127.0.0.1
        $ServerPort = "PWPORT";  // Port your PW Server     
    
        $db_link = mysql_connect($DB_Host, $DB_User, $DB_Password);
        $db = mysql_select_db("$DB_Name", $db_link);
    	
            $online = mysql_query("SELECT zoneid FROM point WHERE zoneid IS NOT NULL");
            $countonline = @Mysql_num_rows($online);
    
            $sockres = @fsockopen($ServerIP, $ServerPort, $errno, $errstr, 1);
                
           if (!$sockres)  
           {
            mysql_query("DELETE FROM online");
           $online = 0;
    	   $ServerStatus = "<font color=red><b>Under Maintance</b></font>";
    	   $ServerPlayer = "<font color=red><b>0</b></font>";    
           }  
    		else
    		{
            @FClose($sockres);
    		$ServerStatus = "<font color=green><b>Online</b></font>";
    		$ServerPlayer = "<font color=green><b>$countonline</b></font>"; 
    		}
    
    ?>
    
    <table width="300" border="0" cellspacing="2" cellpadding="2">
      <tr>
        <th scope="col"><strong>Server</strong></th>
        <th scope="col"><strong>:</strong></th>
        <th scope="col"><strong><?php print $ServerStatus; ?></strong></th>
      </tr>
      <tr>
        <th scope="col"><strong>Player Online</strong></th>
        <th scope="col"><strong>:</strong></th>
        <th scope="col"><strong><?php print $ServerPlayer; ?></strong></th>
      </tr>
    </table>

  5. #5
    Valued Member Vinute is offline
    MemberRank
    Jul 2014 Join Date
    110Posts

    Re: Online Count

    Quote Originally Posted by hrace009 View Post
    Code:
    <?php
    #Author: Ben Noitov (Romulan)
    
    $DB_Host = "DBSERVER:3306";  // localhost or your IP
        $DB_User = "DBUSER";  // Database user
        $DB_Password = "DBPASSWORD";  // Database password
        $DB_Name = "DBNAME";  // Database name
        $ServerIP = "SVRIP";  // IP your PW Server  or 127.0.0.1
        $ServerPort = "PWPORT";  // Port your PW Server     
    
        $db_link = mysql_connect($DB_Host, $DB_User, $DB_Password);
        $db = mysql_select_db("$DB_Name", $db_link);
        
            $online = mysql_query("SELECT zoneid FROM point WHERE zoneid IS NOT NULL");
            $countonline = @Mysql_num_rows($online);
    
            $sockres = @fsockopen($ServerIP, $ServerPort, $errno, $errstr, 1);
                
           if (!$sockres)  
           {
            mysql_query("DELETE FROM online");
           $online = 0;
           $ServerStatus = "<font color=red><b>Under Maintance</b></font>";
           $ServerPlayer = "<font color=red><b>0</b></font>";    
           }  
            else
            {
            @FClose($sockres);
            $ServerStatus = "<font color=green><b>Online</b></font>";
            $ServerPlayer = "<font color=green><b>$countonline</b></font>"; 
            }
    
    ?>
    
    <table width="300" border="0" cellspacing="2" cellpadding="2">
      <tr>
        <th scope="col"><strong>Server</strong></th>
        <th scope="col"><strong>:</strong></th>
        <th scope="col"><strong><?php print $ServerStatus; ?></strong></th>
      </tr>
      <tr>
        <th scope="col"><strong>Player Online</strong></th>
        <th scope="col"><strong>:</strong></th>
        <th scope="col"><strong><?php print $ServerPlayer; ?></strong></th>
      </tr>
    </table>
    Working:33, Thank you alot

    - - - Updated - - -

    Quote Originally Posted by hrace009 View Post
    Code:
    <?php
    #Author: Ben Noitov (Romulan)
    
    $DB_Host = "DBSERVER:3306";  // localhost or your IP
        $DB_User = "DBUSER";  // Database user
        $DB_Password = "DBPASSWORD";  // Database password
        $DB_Name = "DBNAME";  // Database name
        $ServerIP = "SVRIP";  // IP your PW Server  or 127.0.0.1
        $ServerPort = "PWPORT";  // Port your PW Server     
    
        $db_link = mysql_connect($DB_Host, $DB_User, $DB_Password);
        $db = mysql_select_db("$DB_Name", $db_link);
        
            $online = mysql_query("SELECT zoneid FROM point WHERE zoneid IS NOT NULL");
            $countonline = @Mysql_num_rows($online);
    
            $sockres = @fsockopen($ServerIP, $ServerPort, $errno, $errstr, 1);
                
           if (!$sockres)  
           {
            mysql_query("DELETE FROM online");
           $online = 0;
           $ServerStatus = "<font color=red><b>Under Maintance</b></font>";
           $ServerPlayer = "<font color=red><b>0</b></font>";    
           }  
            else
            {
            @FClose($sockres);
            $ServerStatus = "<font color=green><b>Online</b></font>";
            $ServerPlayer = "<font color=green><b>$countonline</b></font>"; 
            }
    
    ?>
    
    <table width="300" border="0" cellspacing="2" cellpadding="2">
      <tr>
        <th scope="col"><strong>Server</strong></th>
        <th scope="col"><strong>:</strong></th>
        <th scope="col"><strong><?php print $ServerStatus; ?></strong></th>
      </tr>
      <tr>
        <th scope="col"><strong>Player Online</strong></th>
        <th scope="col"><strong>:</strong></th>
        <th scope="col"><strong><?php print $ServerPlayer; ?></strong></th>
      </tr>
    </table>
    Working:33, Thank you alot

    - - - Updated - - -
    @hrace009 , Do you mind giving me a hand installing
    http://forum.ragezone.com/f751/release-universal-mysql-top-100-a-877885/
    I did put everything in the right place and added the table to phpmyadmin and it actully works when I manually edit it from phpmyadmin.

    What I need help with is how to let phpmyadmin conifgure it automatically.

  6. #6
    SON OF MARFEL hrace009 is offline
    MemberRank
    Apr 2009 Join Date
    Pekanbaru, IndoLocation
    1,035Posts

    Re: Online Count

    Quote Originally Posted by vinute View Post
    @hrace009 , do you mind giving me a hand installing
    no!!!



Advertisement