[Release] Very simple PHP module for server stats

05/07/2012 19:43 Getzabelz#1
Hello, this is my first 'release' in a very long time at EPVP. As you know I gave up long ago trying to participate actively and showing my stuff because of the community actitude. I am not that faithful anymore.

However, here I bring a very little script that I think will be useful. Having a look at all server's websites which has been released and those who I got access by other ways I have realized all of them are using the socket connections, along with handshake drama.

The main reason of this little release is that to make it that way, everytime you are running any request to the website you are managing sockets, opcodes, using external libraries, plus are running few hundreds (or thousands) of code lines. Also with this you don't need any external libraries or any further installation than changing the SQL data in the config.php

This will run a very little script which will take no resources at all and give back the number of users connected at your server in the exact time. I will look forward the response of the community and see if I should keep releasing some of my stuff or not.

I hope some of the website coders find this useful for their project althought is a very little help It may be a beginning of more releases:).

This script is coded in PHP since I see is the language chosen by the majority of sro web coders, if you want me to port it to any other language I don't mind to do it.

Download link:
[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]

And attached to the thread

Notes: If you need anything just tell me.

The usage is very easy, just go to /config/ and get into config.php and change the SQL data. Then you can run capacity.php and It will prompt the users online. You don't need any installation or any external library, just having PHP engine, no sro api's, odbc connection or stuff like that is needed.

Apart of this, if you have any request or petition in case you are learning or something I don't mind making more stuff if people requests something. Maybe what is hard for you or a crackhead, is easy for me

EDIT1: Checking and cleaning my old PHP stuff I found this database master class. Can be achieved with more optimization but won't make much diff. Pretty useful to code things fast without using a framework:
PHP Code:
<?php
/*
Script made by Getzabelz
for Class Online ([url=http://www.classgame.net]Class Online[/url]).
You can use this file as long as you don't take any personal benefit.
*/
class useDB {
    
    
/*Lists any table, complete or with filters. It will show all the content you filter
     *@param Fields of the table you want to show and the table you want to show off
     */
    
function listar($campos$tabla)
    {
        
$row=0;
        
$datos mysql_query("select ".$campos." from ".$tabla);
        while(
$data=mysql_fetch_row($datos))
        {
            print 
"<tr>";
            while(
$data[$row]!="")
            {
                print 
"<td>".$data[$row]."</td>";
                
$row++;
            }
            print 
"</tr>";
            
$row=0;
        }
        return 
mysql_affected_rows();
    }

    
/*Looks for the fields and values you want in the desired table
     *@param Table, Field, value, you can use SQL filters and OPs
     *@return Prints the data and returns the number of entries found with desired filter
     */
    
function buscar($tabla$campo$valor)
    {
        
$datos mysql_query("select * from ".$tabla." where ".$campo."='".$valor."'");
        while(
$data=mysql_fetch_row($datos))
        {
            print 
"FirstData ".$data['0']." SecondData: ".$data['1']."<br>";
        }
        return 
mysql_affected_rows();
    }
    
    
/*Counts entries from a desired table
     *@param Table you want to use
     *@return Number of rows in the table
     */
    
function contar($tabla)
    {
        
$num mysql_query("select * from ".$tabla);
        return 
mysql_num_rows($num);
    }
    
/*Deletes the desired data from a table
     *@param Table, field, value (filters allowed)
     *@return Returns the number of deleted rows
     */
    
function borrar($tabla$campo$valor)
    {
        
$num mysql_query("DELETE FROM ".$tabla." where ".$campo."='".$valor."'");
        return 
mysql_affected_rows();
    }

    
/*Modifies the data of a table
     *@param Table, Field, Old value, New value (Allows filter)
     *@return Returns the number of rows updated
     */
    
function modificar($tabla$campo$oldvalue$newvalue)
    {
        
$num mysql_query("UPDATE ".$tabla." SET ".$campo."='".$newvalue."' WHERE ".$campo."='".$oldvalue."'");
        return 
mysql_affected_rows();
    }
    
}
?>
05/07/2012 20:22 Biboja#2
How about a demo!? I think it would be more attractive :D But Thanks :D
05/07/2012 20:25 Getzabelz#3
Quote:
Originally Posted by Biboja View Post
How about a demo!? I think it would be more attractive :D But Thanks :D
I don't have any server online except Class, anyway it will just show the players online so you can embed it wherever you want just like:

675

That's all It shows so you can embed it.

I am adding more resources to #1. If anybody wants to test it out and writes here a 'demo' as you said I'd appreciate it:)
05/07/2012 23:25 •ᵔBeGodOfWarᵔ•#4
Quote:
Originally Posted by Getzabelz View Post
I don't have any server online except Class, anyway it will just show the players online so you can embed it wherever you want just like:

675

That's all It shows so you can embed it.

I am adding more resources to #1. If anybody wants to test it out and writes here a 'demo' as you said I'd appreciate it:)
why wouldn't you put the script into your website? maybe it will help who will come into your site to know the population of server.
anyway deserve a kebab!
05/07/2012 23:49 Biboja#5
Quote:
Originally Posted by Getzabelz View Post
I don't have any server online except Class, anyway it will just show the players online so you can embed it wherever you want just like:

675

That's all It shows so you can embed it.

I am adding more resources to #1. If anybody wants to test it out and writes here a 'demo' as you said I'd appreciate it:)
Thanks :)) Well the most important is the function ... :D It is very easy to design it with images or what ever :D
05/08/2012 00:57 Getzabelz#6
Quote:
Originally Posted by Biboja View Post
Thanks :)) Well the most important is the function ... :D It is very easy to design it with images or what ever :D
Yea, that's the idea, just include it somewhere with style and that's all:).

And I am not going to use it at Class Online because I hadn't got time to make an entire new website... When I get time I will use that and more stuff.

If anybody thinks something is too difficult I don't mind making an explained snippet to help and release it, maybe what is hard for you is easy for me :).
05/08/2012 10:06 ÑõÑ_Ŝŧóp#7
eh,wait
this uses sockets and opcodes? so why do you need sql data?
Edit: or maybe it uses _ShardCurrentUser ?
05/08/2012 10:29 Getzabelz#8
Quote:
Originally Posted by ÑõÑ_Ŝŧóp View Post
eh,wait
this uses sockets and opcodes? so why do you need sql data?
Edit: or maybe it uses _ShardCurrentUser ?
Check it by yourself. It is not using sockets. thats the idea.
05/08/2012 10:36 ÑõÑ_Ŝŧóp#9
actually,2lazy to deobfuscate
05/08/2012 11:28 ﷲFightZﷲ#10
wow how many times u encoded that crap ._.

definetly not gonna use anything thats encoded and needs my db informatiomns mhm
05/08/2012 17:50 LastThief*#11
You're damn pro !

class.php
PHP Code:
<?php

function listSlots($hostname,$username,$password,$dbName)
{
    
connBD($hostname$username$password$dbName);
     
     
     
$query mssql_query("SELECT top 1 nUserCount FROM _ShardCurrentUser WHERE nShardID = 64 ORDER BY nId desc");

     while(
$row=mssql_fetch_array($query))
     { 
        echo 
$row[0]; 
     }
}
 function 
connBD ($hostname$username$password$dbName
 {
    
$dbConn=mssql_connect($hostname,$username,$password) or die ("Database connection failed. Script made by Getzabelz/melkorz123 (www.classgame.net)");
    
mssql_select_db($dbName) or die ("Failed selecting the desired database. Please check that you chose the right account database name. pwned by chernobyl*  ");
 }

 
?>
showCapacity.php

PHP Code:
<?php
//_ -> global vars
require_once('class.php');
listSlots("PWND""sa""1234""SRO_VT_ACCOUNT"); 
?>
and seriously you called me noob in php and writing query with sub query and people calling me awesome ? look at yourself please first

now that's final message

[Only registered and activated users can see links. Click Here To Register...]
05/08/2012 17:54 Getzabelz#12
Quote:
Originally Posted by LastThief* View Post
You're damn pro !

class.php
PHP Code:
<?php

function listSlots($hostname,$username,$password,$dbName)
{
    
connBD($hostname$username$password$dbName);
     
     
     
$query mssql_query("SELECT top 1 nUserCount FROM _ShardCurrentUser WHERE nShardID = 64 ORDER BY nId desc");

     while(
$row=mssql_fetch_array($query))
     { 
        echo 
$row[0]; 
     }
}
 function 
connBD ($hostname$username$password$dbName
 {
    
$dbConn=mssql_connect($hostname,$username,$password) or die ("Database connection failed. Script made by Getzabelz/melkorz123 (www.classgame.net)");
    
mssql_select_db($dbName) or die ("Failed selecting the desired database. Please check that you chose the right account database name. pwned by chernobyl*  ");
 }

 
?>
showCapacity.php

PHP Code:
<?php
//_ -> global vars
require_once('class.php');
listSlots("PWND""sa""1234""SRO_VT_ACCOUNT"); 
?>
and seriously you called me noob in php and writing query with sub query and people calling me awesome ? look at yourself please first

now that's final message

[Only registered and activated users can see links. Click Here To Register...]
I made it fast, just copy&pasted from another class. Anyway you showed that I was wrong trying to help. Won't try again dont worry.
05/08/2012 17:57 ღ ∂ Ropp#13
Actually, you were wrong... this is the silkroad section, not php module or css/html sections..
try the coders section
05/08/2012 18:02 Getzabelz#14
Quote:
Originally Posted by LastThief* View Post
You're damn pro !

class.php
PHP Code:
<?php

function listSlots($hostname,$username,$password,$dbName)
{
    
connBD($hostname$username$password$dbName);
     
     
     
$query mssql_query("SELECT top 1 nUserCount FROM _ShardCurrentUser WHERE nShardID = 64 ORDER BY nId desc");

     while(
$row=mssql_fetch_array($query))
     { 
        echo 
$row[0]; 
     }
}
 function 
connBD ($hostname$username$password$dbName
 {
    
$dbConn=mssql_connect($hostname,$username,$password) or die ("Database connection failed. Script made by Getzabelz/melkorz123 (www.classgame.net)");
    
mssql_select_db($dbName) or die ("Failed selecting the desired database. Please check that you chose the right account database name. pwned by chernobyl*  ");
 }

 
?>
showCapacity.php

PHP Code:
<?php
//_ -> global vars
require_once('class.php');
listSlots("PWND""sa""1234""SRO_VT_ACCOUNT"); 
?>
and seriously you called me noob in php and writing query with sub query and people calling me awesome ? look at yourself please first

now that's final message

[Only registered and activated users can see links. Click Here To Register...]
Oh btw, professionals coders would deobfuscate my code, instead of asking Chernobyl to make your work, weren't you so pro? That was really sad haha
05/08/2012 18:04 LastThief*#15
Quote:
Originally Posted by Getzabelz View Post
I made it fast, just copy&pasted from another class. Anyway you showed that I was wrong trying to help. Won't try again dont worry.
ya sure please tell me why would you encrypt single query ? And also tell me why you was refusing when some one said I'm awesome you were acting like an ass "show me his work because query and sub query aint professioal" and it wasn't evn query with sub query it was rev6 system now tell me who is the noob now ? I can't just stop laughing my ass off in you looping in 1 row and encrypting one query LOL