[Request Help] Website counting how many player online

03/06/2020 15:52 TimeToLove#1
How can i add to my website counting player like 8/1000 something like this ,
any help ? thanks
03/09/2020 11:53 ^Nitro^#2
Quote:
Originally Posted by TimeToLove View Post
How can i add to my website counting player like 8/1000 something like this ,
any help ? thanks
Code:
use sro_vt_shard
SELECT top 1 * FROM _ShardCurrentUser WHERE nShardID = 64 ORDER BY nID desc
03/09/2020 16:01 TimeToLove#3
Quote:
Originally Posted by ^Nitro^ View Post
Code:
use sro_vt_shard
SELECT top 1 * FROM _ShardCurrentUser WHERE nShardID = 64 ORDER BY nID desc
this is in sql.. i need the php .. can you help me on discord or TW or AnyDesk? thanks.
03/09/2020 16:42 ^Nitro^#4
Quote:
Originally Posted by TimeToLove View Post
this is in sql.. i need the php .. can you help me on discord or TW or AnyDesk? thanks.
send me im PM your discord I help u
03/09/2020 16:43 Devsome#5
Why not helping here? That's what a forum is for
03/10/2020 14:22 ^Nitro^#6
Quote:
Originally Posted by Devsome View Post
Why not helping here? That's what a forum is for
I will
03/10/2020 14:24 Devsome#7
Quote:
Originally Posted by ^Nitro^ View Post
I will
Here not discord. You told him to write in discord.
03/10/2020 14:32 ^Nitro^#8
Quote:
Originally Posted by TimeToLove View Post
this is in sql.. i need the php .. can you help me on discord or TW or AnyDesk? thanks.
If you use old php mssql_connect
use this:
Code:
<?php
            $sql_host = "YourIP";
            $sql_user = "YourUsername";
            $sql_pass = "YourPassword";
            $sql_db = "SRO_VT_ACCOUNT";
            $sqlLink = mssql_connect($sql_host,$sql_user,$sql_pass);
            if(!$sqlLink) die("MSSQL server is not accessable, why should we try to select database ?");
                else {
                    mssql_select_db($sql_db,$sqlLink);
                }
            $query = mssql_query("SELECT top 1 * FROM _ShardCurrentUser WHERE nShardID = 64 ORDER BY nID desc") or die("Can't connect to database!");
            while ($row = mssql_fetch_array($query)) {
                echo "
                    <b>Server: <span style='color:red'><i>YourServerName</i></span> - <span style='color:#fff'>$row[nUserCount]</span><span style='color:green'> of maximum</span> <span style='color:#fff'>2000</span> <span style='color:green'>are currently online!</span></b>    
                    ";
            }
?>
If You Use New PHP PDO
use this:
Code:
<?PHP
try {
        $user = "YourUsername"; 
	$pass = "YourPassword";
	$conexao= new PDO("sqlsrv:Server=YourIP,1433;Database=SRO_VT_ACCOUNT", $user, $pass);;
        $srdID = 64;
        $sql = "SELECT top 1 * FROM _ShardCurrentUser WHERE nShardID = ? ORDER BY nID desc";

        $stmt = $conexao->prepare($sql);
        $stmt->bindValue(1, $srdID);
        $stmt->execute();

        $linha = $stmt->fetchAll();
        $result = array_shift($linha);
        $onlineNow = $result['nUserCount'];
        

        echo "
                    <b>Server: <span style='color:red'><i>YourServerName</i></span> - <span style='color:#fff'>$onlineNow</span><span style='color:green'> of maximum</span> <span style='color:#fff'>2000</span> <span style='color:green'>are currently online!</span></b>    
                    ";
} catch (Exception $ex) {
        echo 'erro: ' . $ex->getCode();
    }
?>
Quote:
Originally Posted by Devsome View Post
Here not discord. You told him to write in discord.
yea I done here already take it easy bro don't do a storm inside a glass of water..

enjoy your life :)
03/11/2020 19:20 TimeToLove#9
Quote:
Originally Posted by ^Nitro^ View Post
If you use old php mssql_connect
use this:
Code:
<?php
            $sql_host = "YourIP";
            $sql_user = "YourUsername";
            $sql_pass = "YourPassword";
            $sql_db = "SRO_VT_ACCOUNT";
            $sqlLink = mssql_connect($sql_host,$sql_user,$sql_pass);
            if(!$sqlLink) die("MSSQL server is not accessable, why should we try to select database ?");
                else {
                    mssql_select_db($sql_db,$sqlLink);
                }
            $query = mssql_query("SELECT top 1 * FROM _ShardCurrentUser WHERE nShardID = 64 ORDER BY nID desc") or die("Can't connect to database!");
            while ($row = mssql_fetch_array($query)) {
                echo "
                    <b>Server: <span style='color:red'><i>YourServerName</i></span> - <span style='color:#fff'>$row[nUserCount]</span><span style='color:green'> of maximum</span> <span style='color:#fff'>2000</span> <span style='color:green'>are currently online!</span></b>    
                    ";
            }
?>
If You Use New PHP PDO
use this:
Code:
<?PHP
try {
        $user = "YourUsername"; 
	$pass = "YourPassword";
	$conexao= new PDO("sqlsrv:Server=YourIP,1433;Database=SRO_VT_ACCOUNT", $user, $pass);;
        $srdID = 64;
        $sql = "SELECT top 1 * FROM _ShardCurrentUser WHERE nShardID = ? ORDER BY nID desc";

        $stmt = $conexao->prepare($sql);
        $stmt->bindValue(1, $srdID);
        $stmt->execute();

        $linha = $stmt->fetchAll();
        $result = array_shift($linha);
        $onlineNow = $result['nUserCount'];
        

        echo "
                    <b>Server: <span style='color:red'><i>YourServerName</i></span> - <span style='color:#fff'>$onlineNow</span><span style='color:green'> of maximum</span> <span style='color:#fff'>2000</span> <span style='color:green'>are currently online!</span></b>    
                    ";
} catch (Exception $ex) {
        echo 'erro: ' . $ex->getCode();
    }
?>


yea I done here already take it easy bro don't do a storm inside a glass of water..

enjoy your life :)


work like a charm , thanks,

also did you know how to add vote for silks? :handsdown:
03/11/2020 23:53 ^Nitro^#10
Quote:
Originally Posted by TimeToLove View Post
work like a charm , thanks,

also did you know how to add vote for silks? :handsdown:
just Google vsro vote for silk

you will get some for sure.