Register for your free account! | Forgot your password?

Go Back   elitepvpers > Popular Games > Silkroad Online > SRO Coding Corner
You last visited: Today at 02:36

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[PHP]Silkroad server status script

Discussion on [PHP]Silkroad server status script within the SRO Coding Corner forum part of the Silkroad Online category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Aug 2010
Posts: 198
Received Thanks: 49
[PHP]Silkroad server status script

Add this script to you functions file or somewhere where it includes.
If you want to print the status use this code:

PHP Code:
echo server_status($ip$port); 
PHP Code:
    //Server status script by: SniuurksT
    
$ip '127.0.0.1'//Server ip adress
    
$port '15779'//Server port
    
    
function server_status($ip$port)
    {
    
$status = array("<strong>Server is:</strong><span style='color:#F00;'>Offline</span>""<strong>Server is:</strong><span style='color:#0F0;'>Online </span>
"
);
    
$fp = @fsockopen($ip$port$errno$errstr2);
    if (!
$fp) {
        return 
$status[0];
    } 
    else
      
      { 
      return 
$status[1];
      }
    } 
SniuurksT is offline  
Thanks
1 User
Old 05/05/2012, 14:00   #2
 
elite*gold: 179
Join Date: Dec 2010
Posts: 931
Received Thanks: 311
already released
ermvrs is offline  
Old 05/07/2012, 15:25   #3
 
elite*gold: 0
Join Date: Aug 2010
Posts: 198
Received Thanks: 49
ermvrs,
Got many orders to make this simple script, so i just shared it.
SniuurksT is offline  
Old 07/31/2012, 00:10   #4
 
elite*gold: 0
Join Date: Mar 2008
Posts: 34
Received Thanks: 0
Can you make it so it will show the Max Client's and the current clients along with like refresh??
cjmwid is offline  
Old 07/31/2012, 20:46   #5
Chat Killer In Duty


 
PortalDark's Avatar
 
elite*gold: 5
Join Date: May 2008
Posts: 16,309
Received Thanks: 6,470
Quote:
Originally Posted by cjmwid View Post
Can you make it so it will show the Max Client's and the current clients along with like refresh??
if you mean capacity, check this thread
PortalDark is offline  
Old 08/01/2012, 09:10   #6
 
kevin_owner's Avatar
 
elite*gold: 0
Join Date: Jan 2010
Posts: 1,484
Received Thanks: 809
I wouldn't recommend this approach altough I have no idea how non_stop and lastthief's script works.

This one creates the connection in php and is actually real time. The problem is that if you have 50 users watching the server stats you would also have 50 connections to the gateway (Correct me if i'm wrong it could be that php reuses the connection or something).

A better approach would be to use drew's scripts and create a cron job which executes them like every 5 seconds. What you need to do is modify the index.php (I think) and insert/update the current stats into the database.

This way you have only one connection to the gateway and still real time data. Ofcourse you need to write a ajax script to get them into your browser from the database but that isn't too difficult.
kevin_owner is offline  
Old 08/01/2012, 09:54   #7
 
elite*gold: 0
Join Date: Sep 2010
Posts: 783
Received Thanks: 920
our package contains a c# app which connects to the gateway and gets the capacity then inserting it to the database,and the web script is to get the capacity from the database
ÑõÑ_Ŝŧóp is offline  
Old 08/02/2012, 22:45   #8
 
LastThief*'s Avatar
 
elite*gold: 60
Join Date: Feb 2012
Posts: 3,942
Received Thanks: 6,475
Quote:
Originally Posted by ÑõÑ_Ŝŧóp View Post
our package contains a c# app which connects to the gateway and gets the capacity then inserting it to the database,and the web script is to get the capacity from the database
working with ajax tho.
LastThief* is offline  
Old 08/03/2012, 06:35   #9
 
theoneofgod's Avatar
 
elite*gold: 20
Join Date: Mar 2008
Posts: 3,940
Received Thanks: 2,198
Simply cache the result somewhere and work with that.
theoneofgod is offline  
Old 04/27/2015, 20:35   #10
 
elite*gold: 0
Join Date: May 2011
Posts: 12
Received Thanks: 6
Cleaner way ^^ (Es gibt auch Object-Orientierung!)

PHP Code:

    
/**
     * Gets the server status
     *
     * @return bool
     */
    
public function getServerStatus()
    {
        
$sIp   $this->_oConfig->getVar("server_ip");      // Server IP
        
$sPort $this->_oConfig->getVar("server_port");  // Server port

        
$blFp = @fsockopen($sIp$sPort$errno$errstr2);

        if (
$blFp) {
            return 
true// Online
        
}

        return 
false// Offline
    

Quote:
Originally Posted by SniuurksT View Post
Add this script to you functions file or somewhere where it includes.
If you want to print the status use this code:

PHP Code:
echo server_status($ip$port); 
PHP Code:
    //Server status script by: SniuurksT
    
$ip '127.0.0.1'//Server ip adress
    
$port '15779'//Server port
    
    
function server_status($ip$port)
    {
    
$status = array("<strong>Server is:</strong><span style='color:#F00;'>Offline</span>""<strong>Server is:</strong><span style='color:#0F0;'>Online </span>
"
);
    
$fp = @fsockopen($ip$port$errno$errstr2);
    if (!
$fp) {
        return 
$status[0];
    } 
    else
      
      { 
      return 
$status[1];
      }
    } 
darkmaisej1 is offline  
Thanks
1 User
Reply


Similar Threads Similar Threads
[PHP]Server Status Script
12/23/2011 - Shaiya PServer Development - 4 Replies
#closed
server status script failure
11/09/2011 - Metin2 Private Server - 0 Replies
I'm using this script on a website, and only the MYSQL server is displaying as online.. but all channels and auth is actually online. The site is hosted same place as the server. The ports are correct but I can't figure out why the script shows everything as offline. <?PHP $funzocker = "localhost"; $ip = gethostbyname($funzocker); $portlist=array(3306 ,11002, 13000, 16000, 18000, 20000);
[Suche] Server Status Script.PHP
02/05/2011 - WoW Private Server - 0 Replies
Hallo Community, ich bin seid ein paar Tage auf der Suche nach einem Script was ich per PHP auf meine Seite einbinden kann was mir den Status und evlt die Uptime des WoW Pservers anzeigt. Finde aber leider nichts gutes. Hat wer so ein Script was gut funktioniert und nicht so super Serverlastig ist ? Freue mich über jede Hilfe !
Server status script
04/29/2010 - WoW Private Server - 5 Replies
Hi wollte mal fragen ob mir vllt jemand ein kleines script basteln könnte. Also php das ich es auf meine hp tun kann. Es soll Anzeigen wie lange der Server online ist, wie viele Spieler online sind aber getrennt in Horde und Ally. Und noch ne Datenbank Statistik wie viele accounts registriert worden sind. wäre echt nett wenn mir einer sowas bastenln könnte. Ich hab leider nicht die nötigen php kenntnisse. mfg Sh4nks
[RELEASE] Server Status Script...
04/30/2009 - Dekaron Private Server - 9 Replies
<html> <body> Dekaron Server: <? Error_reporting(0); $fp = @fsockopen('INSERT IP HERE', PORT # HERE, $errno, $errstr, 2); if($fp){ echo '<font color=green>Online</font>'; } else{ echo '<font color=red>Offline</font>'; } fclose($fp); ?>



All times are GMT +2. The time now is 02:36.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.