Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Tools

Development::Tools 3rd Party Tools for EQEMu (DB management tools, front ends, etc...)

Reply
 
Thread Tools Display Modes
  #1  
Old 08-27-2008, 11:00 AM
cubber
Discordant
 
Join Date: Apr 2006
Posts: 374
Default Server Status Web Page

I am looking for a simple script that I can put on a web page that will display the server's status (ie. UP or DOWN) and maybe include an uptime report.

I would also like it to display a list of currently logged in characters with level/race/class and zone info.

Does anyone have something like this currently in the works?

Thanks!
Reply With Quote
  #2  
Old 08-27-2008, 11:23 AM
cybernine186
Sarnak
 
Join Date: Feb 2008
Posts: 87
Default

You can use a PHP Telnet script to get that information. However you will need telnet functions turned on the eq server.

If you are familiar with PHP scripting I will post a section of code for you to use. However you will need to edit the code for what suites you. If you are not familiar with PHP I would try and find someone that is.
Reply With Quote
  #3  
Old 08-27-2008, 11:28 AM
cubber
Discordant
 
Join Date: Apr 2006
Posts: 374
Default

Thanks for the reply, I am working on learning php, and currently have a basic understanding of it. I would not mind checking out the code and seeing if I can make sense of it.

To turn on the telnet function I just edit the server's xml file correct?

Thanks.
Reply With Quote
  #4  
Old 08-27-2008, 12:23 PM
Flare83
Sarnak
 
Join Date: Aug 2008
Location: usa
Posts: 43
Default

i would be interested in the php code also, if it's not too much trouble that is =).
__________________
thenameless.site88.net
Reply With Quote
  #5  
Old 08-27-2008, 04:58 PM
cybernine186
Sarnak
 
Join Date: Feb 2008
Posts: 87
Default

This is a partial code from my new EQ Editor release fixing to come out. This is built in a class, have fun. Feel free to ask questions.


Also some of the telnet code I copied from someone else, I have changed most of it but the majority is still intact.

PHP Code:
class telnet {

    
// Variables
    
var $message = array();
    var 
$connection;

    
// Connects to the World Telnet Server
    
function connect(){
        global 
$cfg;
        
        
// Open Socket Connection
        
$this->connection fsockopen($cfg['telnet']['address'], $cfg['telnet']['port']);

        if(!
$this->connection){
            
$this->message[] = "Error connecting to World Telnet Server";
            return 
false;
        }else{
            
fputs($this->connectionsprintf("%s\r"unserialize($_SESSION['EQ_EDT_USR'])));
            
usleep(125000);   
              
fputs($this->connectionsprintf("%s\r"unserialize($_SESSION['EQ_EDT_PWD'])));
            
usleep(125000);
            return 
true;
        }
    }
    
    
    
// Close the Telnet Connection
    
function close(){
        
fclose($this->connection);
    }
    
    
    
// Server Uptime
    
function uptime(){
        
fputs ($this->connection"uptime\r"); 
        
usleep(125000);
            
        while (!
feof($this->connection)){
            
$ret fgets($this->connection);
            if (
ereg("Uptime"$ret)) {
                
$ret str_replace("$user"""$ret);
                return 
str_replace(">"""$ret);
                break;
            }
        }
    }
    
    
    
// Zone Status
    
function zonestatus($zone=''){
        
fputs ($this->connectionsprintf("zonestatus %s\r"$zone)); 
        
usleep(125000);
        
        while(!
feof($this->connection)){
            
$ret fgets($this->connection);
            
            if (
ereg("$Server:"$ret)){
                echo 
"$ret \n <br>";
            }
            
            if(
ereg("avail"$ret)){
                echo 
"$ret \n <br>";
                break;
            }                
        }
    }
    
    
// Kick Character from World Server
    
function kick($character$message='YOU ARE BEING KICKED FROM THE SERVER IN 4 SECONDS'){
        
fputs($this->connectionsprintf("tell %s %s\r"$character$message));
        
sleep(4); 
        
fputs($this->connectionsprintf("kick %s\r"$character));
        
$this->message[] = "Character has been kicked from server";
        
sleep(1);
    }
    
    
    
// Send Character a Tell
    
function tell($character$message){
        
fputs($this->connectionsprintf("tell %s %s\r"$character$message));
        
sleep(1);
        
$this->message[] = sprintf("Message Sent to Character: %s"$character);
    }
    
    
    
// Send Server a OOC Message
    
function ooc($message){
        
fputs($this->connectionsprintf("ooc %s\r"$message));
        
sleep(1);
        
$this->message[] = "Message sent to OOC";
    }
    
    
    
// Broadcast Message Server Wide
    
function broadcast($message){
        
fputs($this->connectionsprintf("broadcast %s\r"$message));
        
sleep(1);
        
$this->message[] = "Broadcast Message Sent to World Server";
    }
    
    
    
// Who/Who All
    
function whoall($who=''){
    
        
fputs ($this->connectionsprintf("who%s\r"$who)); 
        
usleep(125000);

        while (!
feof($this->connection)) {
            
$ret_tmp fgets($this->connection);

            if(
ereg("zone"$ret_tmp)){ 
                
$ret[++$x] = $ret_tmp;
            }
            
            if(
ereg("online"$ret_tmp)){
                break;
            }
        }

        
// Process each line of the returned results
        
foreach ($ret as $key => $value) {
        
            
// Original Return
            
$players[$key]['original'] = $value;

            
// GM Status
            
if (preg_match("/\*.*\*/"$value$matches)) {
                
$players[$key]['GM'] = trim($matches[0], "* ");
            }
        
            
// Role/Anon, Level & Class
            
if (preg_match("/\[.*\]/"$value$matches)) {
                
$tmp explode(" "trim($matches[0], "[] "));
                if (!
is_numeric($tmp[0])) {
                    
$players[$key]['Visible'] = $tmp[0];
                    
$players[$key]['Level'] = $tmp[1];
                    
$players[$key]['Class'] = rtrim($tmp[2] . " " $tmp[3], " ");
                } else {
                    
$players[$key]['Level'] = $tmp[0];
                    
$players[$key]['Class'] = rtrim($tmp[1] . " " $tmp[2], " ");
                }
            }
        
            
// Character's Name
            
if(preg_match("/\].*\(/"$value$matches)){
                
$players[$key]['Name'] = trim($matches[0], "] (");
            }
        
            
// Race
            
if(preg_match("/\(.*\)/"$value$matches)){
                
$players[$key]['Race'] = trim($matches[0], "( )");
            }
        
            
// Zone
            
if(preg_match("/zone:.*AccID:/"$value$matches)){
                
$players[$key]['ZoneLong'] = substr($matches[0], 6, -7);
            }
        
            
// Account ID
            
if(preg_match("/AccID:.*AccName:/"$value$matches)){
                
$players[$key]['AcctID'] = substr($matches[0], 7, -9);
            }
        
            
// Account Name
            
if(preg_match("/AccName:.*LSID:/"$value$matches)){
                
$players[$key]['AcctName'] = substr($matches[0], 9, -6);
            }
        
            
// Login Server ID
            
if(preg_match("/LSID:.*Status:/"$value$matches)){
                
$players[$key]['LSID'] = substr($matches[0], 6, -8);
            }
        
            
// Status
            
if(preg_match("/Status:.*/"$value$matches)){
                
$players[$key]['Status'] = substr($matches[0], 83);
            }
        }
        
        
// Return Player Array
        
return $players;
    }


Reply With Quote
  #6  
Old 08-29-2008, 08:55 AM
cubber
Discordant
 
Join Date: Apr 2006
Posts: 374
Default

Thanks for posting the code, seems I just get a blank page though when I load it. Currently the only things I changed were I added the php code tags, and I changed the 'address' to my eqemu server's local IP address and 'port' to '9000'. I enabled telnet in the eqemu xml config file and restarted the server. When I telnet to the server using a command prompt in windows I am able to connect and issue commands like status and who all.

I must be missing something... any ideas?
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 07:57 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3