SEA EMU - Easy to mod server status page

05/12/2010 21:57 psrobot#1
Okay credits goes to the [Only registered and activated users can see links. Click Here To Register...].

This one lists all account names, (still with .ini but they are trying to fix that)
PHP Code:
<b>Total Number of Accounts:</b>
<?php
$directory 
opendir("ENTER SEA ACCOUNT DIRECTORY HERE");
while(
$item readdir($directory)){
if((
$item != ".") && ($item != "..")){
$files[] = $item;
echo 
"";
}
}
$sizeofarray count($files);
echo 
$sizeofarray;
?>
<br>
Next one shows in numbers how many accounts there are
PHP Code:
<br>
<b>List of accounts:</b></br>
<?php
// directory path can be either absolute or relative
$dirPath 'ENTER SEA ACCOUNT DIRECTORY HERE';

// open the specified directory and check if it's opened successfully
if ($handle opendir($dirPath)) {

   
// keep reading the directory entries 'til the end
   
while (false !== ($file readdir($handle))) {

      
// just skip the reference to current and parent directory
      
if ($file != "." && $file != "..") {
         if (
is_dir("$dirPath/$file")) {
            
// found a directory, do something with it?
            
echo "[$file]<br>";
         } else {
            
// found an ordinary file
            
echo "$file<br>";
         }
      }
   }

   
// ALWAYS remember to close what you opened
   
closedir($handle);
}
?>
Just fill in "ENTER SEA ACCOUNT DIRECTORY HERE" and remember not to add "\" in the end. like:
Code:
C:\Storage\
if you do, it will not work

Next one show if the server is online or not:

Just mod the: $fp = fsockopen("SERVER IP", 80, $errno, $errstr, 2);
where "Server ip", port (could also be 15779 if you only wanna show the sro server status), $errno, $errstr, default timeout in sec.)"
PHP Code:
<?php
error_reporting
(0); 
$fp fsockopen("SERVER IP"80$errno$errstr2);
if (!
$fp
{
    echo 
'<FONT COLOR=red>Offline</FONT>';

else 
{
    echo 
'<FONT COLOR=green>Online</FONT>';
}
    
fclose($fp);

?>
05/12/2010 22:02 sargentgunner#2
Looks good, I dont have a server though so i dont know if it works
05/12/2010 23:26 DaRealMadafaka#3
looks like u took the php code of [Only registered and activated users can see links. Click Here To Register...]
05/12/2010 23:27 DaRealMadafaka#4
Quote:
Originally Posted by psrobot View Post
Okay credits goes to the [Only registered and activated users can see links. Click Here To Register...].

This one lists all account names, (still with .ini but they are trying to fix that)
PHP Code:
<b>Total Number of Accounts:</b>
<?php
$directory 
opendir("ENTER SEA ACCOUNT DIRECTORY HERE");
while(
$item readdir($directory)){
if((
$item != ".") && ($item != "..")){
$files[] = $item;
echo 
"";
}
}
$sizeofarray count($files);
echo 
$sizeofarray;
?>
<br>
Next one shows in numbers how many accounts there are
PHP Code:
<br>
<b>List of accounts:</b></br>
<?php
// directory path can be either absolute or relative
$dirPath 'ENTER SEA ACCOUNT DIRECTORY HERE';

// open the specified directory and check if it's opened successfully
if ($handle opendir($dirPath)) {

   
// keep reading the directory entries 'til the end
   
while (false !== ($file readdir($handle))) {

      
// just skip the reference to current and parent directory
      
if ($file != "." && $file != "..") {
         if (
is_dir("$dirPath/$file")) {
            
// found a directory, do something with it?
            
echo "[$file]<br>";
         } else {
            
// found an ordinary file
            
echo "$file<br>";
         }
      }
   }

   
// ALWAYS remember to close what you opened
   
closedir($handle);
}
?>
Just fill in "ENTER SEA ACCOUNT DIRECTORY HERE" and remember not to add "\" in the end. like:
Code:
C:\Storage\
if you do, it will not work

Next one show if the server is online or not:

Just mod the: $fp = fsockopen("SERVER IP", 80, $errno, $errstr, 2);
where "Server ip", port (could also be 15779 if you only wanna show the sro server status), $errno, $errstr, default timeout in sec.)"
PHP Code:
<?php
error_reporting
(0); 
$fp fsockopen("SERVER IP"80$errno$errstr2);
if (!
$fp
{
    echo 
'<FONT COLOR=red>Offline</FONT>';

else 
{
    echo 
'<FONT COLOR=green>Online</FONT>';
}
    
fclose($fp);

?>
PHP Code:
$fp = @fsockopen("Hier eure Root Server oder Hamachi IP!",15779,&$errno,&$errstr,2);
if(!
$fp)
   {
   echo 
'<img src="off.png" width="250" height="80" border="0"';
   }
else
   {
   echo 
'<img src="on.png" width="250" height="80" border="0"';

Yep, u changed just , how the website should looks , if the server is off or on.