Players Online

Results 1 to 9 of 9
  1. #1
    Account Upgraded | Title Enabled! EpikBaby is offline
    MemberRank
    Aug 2009 Join Date
    New YorkLocation
    486Posts

    Players Online

    Anyone have a simple script that shows how much players are online? Because I made this crappy ass web and I just wanted everything to look nice

    Anyone have a simple script for how much players are online O_O?!

    Thanks?

    Mind posting it down?


  2. #2

    Re: Players Online

    staus.php

    PHP Code:
    <?php
    require_once("config.php");

    mssql_select_db("GunzDB"$con);
    $getcurp mssql_query("SELECT CurrPlayer,MaxPlayer FROM ServerStatus");
    $getcur mssql_fetch_array($getcurp);
    Echo 
    "Users online: ";
    echo 
    $getcur['CurrPlayer'];
    echo 
    "/";
    echo 
    $getcur['MaxPlayer'];
    ?>
    Config.php

    PHP Code:
    <?
    // Configuration Server connection
    $host 'host\SQLEXPRESS';
    $user 'sa';
    $pass 'pasword';
    $con mssql_connect($host,$user,$pass);
    ?>
    Last edited by death4u2; 04-10-09 at 04:53 PM.

  3. #3
    mikethemak is offline
    MemberRank
    Apr 2008 Join Date
    Ragezone Spam SectionLocation
    1,019Posts

    Re: Players Online

    Code:
    <?Php
    //MSSQL Connection Information
    $con = mssql_connect("????????\SQLEXPRESS","sa","SA PASSWORD HERE");
    if (!$con)
        {
        die('Couldnt not connect: ' . mssql_error());
        }
        
    mssql_select_db("GunzDB");
    
    
    
    
    
    
    //Server status
    
    $_host_name = 'WAN IP HERE'; $_servers = Array(
    
    "Clan/Quest Server"=> 6000,
    //"Clan Server"=> 6010,
    );
    
    
    foreach($_servers as $_servername => $_port)
    {
        $_connection = @fsockopen($_host_name, $_port, $errno, $errstr, 0.003);
    
        if(!$_connection)
        {
            $_status = '<span class="OFFLINE"><font color="Red">Offline</font></span>';
        }
        else
        {
            $_status = '<span class="ONLINE"><font color="Green">Online</font></span>';
        }
    
        print '<span class="style1">';
    
        print $_servername . ' - ' . $_status . '<br />';
    
        print '</style>';
    }
    
    
    
    
    
    
    //Users Online Script
    $getcurp = mssql_query("SELECT CurrPlayer,MaxPlayer FROM ServerStatus");
    $getcur = mssql_fetch_array($getcurp);
    Echo "<span style=\"color:#76130C\">Users online: </span>";
    echo $getcur['CurrPlayer'];
    echo "/";
    echo $getcur['MaxPlayer'];
    ?>


    Edit:

    -MSSQL Connection Info

    -WAN IP

    -"Clan/Quest Server"=> 6000," Change to whatever type of server you have, for example: "Quest Server"=> 6000,". If you have 2 servers, un-comment the line below that.








    Will have a server status like the one on the left at: http://innovationgunz.tk/

  4. #4

    Re: Players Online

    if you would know those lines are mine.

    $_connection = @fsockopen($_host_name, $_port, $errno, $errstr, 0.003);

    if(!$_connection)
    {
    $_status = '<span class="OFFLINE"><font color="Red">Offline</font></span>';
    }
    else
    {
    $_status = '<span class="ONLINE"><font color="Green">Online</font></span>';
    }

    and this

    $getcurp = mssql_query("SELECT CurrPlayer,MaxPlayer FROM ServerStatus");
    $getcur = mssql_fetch_array($getcurp);
    Echo "<span style=\"color:#76130C\">Users online: </span>";
    echo $getcur['CurrPlayer'];
    echo "/";
    echo $getcur['MaxPlayer'];
    ?>

    those are my lines.
    Last edited by death4u2; 04-10-09 at 05:21 PM.

  5. #5
    Account Upgraded | Title Enabled! EpikBaby is offline
    MemberRank
    Aug 2009 Join Date
    New YorkLocation
    486Posts

    Re: Players Online

    Quote Originally Posted by mikethemak View Post
    Code:
    <?Php
    //MSSQL Connection Information
    $con = mssql_connect("????????\SQLEXPRESS","sa","SA PASSWORD HERE");
    if (!$con)
        {
        die('Couldnt not connect: ' . mssql_error());
        }
        
    mssql_select_db("GunzDB");
    
    
    
    
    
    
    //Server status
    
    $_host_name = 'WAN IP HERE'; $_servers = Array(
    
    "Clan/Quest Server"=> 6000,
    //"Clan Server"=> 6010,
    );
    
    
    foreach($_servers as $_servername => $_port)
    {
        $_connection = @fsockopen($_host_name, $_port, $errno, $errstr, 0.003);
    
        if(!$_connection)
        {
            $_status = '<span class="OFFLINE"><font color="Red">Offline</font></span>';
        }
        else
        {
            $_status = '<span class="ONLINE"><font color="Green">Online</font></span>';
        }
    
        print '<span class="style1">';
    
        print $_servername . ' - ' . $_status . '<br />';
    
        print '</style>';
    }
    
    
    
    
    
    
    //Users Online Script
    $getcurp = mssql_query("SELECT CurrPlayer,MaxPlayer FROM ServerStatus");
    $getcur = mssql_fetch_array($getcurp);
    Echo "<span style=\"color:#76130C\">Users online: </span>";
    echo $getcur['CurrPlayer'];
    echo "/";
    echo $getcur['MaxPlayer'];
    ?>


    Edit:

    -MSSQL Connection Info

    -WAN IP

    -"Clan/Quest Server"=> 6000," Change to whatever type of server you have, for example: "Quest Server"=> 6000,". If you have 2 servers, un-comment the line below that.








    Will have a server status like the one on the left at: http://innovationgunz.tk/
    Fatal error: Call to undefined function mssql_connect() in C:\xampp\htdocs\status.php on line 3

    I dont know what is the problem but I got this.

  6. #6

    Re: Players Online

    php.ini search for mssql remove ;

  7. #7
    Account Upgraded | Title Enabled! EpikBaby is offline
    MemberRank
    Aug 2009 Join Date
    New YorkLocation
    486Posts

    Re: Players Online

    Quote Originally Posted by death4u2 View Post
    php.ini search for mssql remove ;
    what you mean o_O

    ---------- Post added at 11:36 AM ---------- Previous post was at 11:24 AM ----------

    Both of them gave me errors anyone help O_O?

  8. #8
    mikethemak is offline
    MemberRank
    Apr 2008 Join Date
    Ragezone Spam SectionLocation
    1,019Posts

    Re: Players Online

    I combined 2 server status scripts, and fixed the errors in em. I dunno whos they were, but they are easy to make.




    Open php.ini
    Search for "MSSQL" (Without the quotes)
    Remove the ";"

  9. #9
    DRGunZ 2 Creator wesman2232 is offline
    MemberRank
    Jan 2007 Join Date
    Erie, PALocation
    4,872Posts

    Re: Players Online

    search for "undefined function mssql_connect()" in the GunZ section. that might help you ;)



Advertisement