PonchoDDH
09-25-2008, 04:10 PM
Hello, I am trying to create a new module using a php file, however when I add the module to my homepage I get a page not found error. Here is a link to the php file. http://www.the-darkhand.com/vb/modules/serverstatus.php and here is the contents of the file. Thanks!
<tr>
<td align="left" class="alt1" valign="top">
<hr size="1"/>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td><b>Badlands Server Status</b></td></tr>
<tr><td>
<?php
##
## WAR Server Status
## Version 0.1
## Copyright 2008 Nick Schaffner
## http://53x11.com
##
function war_ss($server = 0) {
/*
## Here you can preset all of the default variables for the script.
*/
$default_server = 'badlands';
$status_url = 'http://realmwar.warhammeronline.com/realmwar/ServerStatus.war';
$update_timer = 10; // minutes
################################
################################ PHP Magic Below, Avoid editing if you don't know what you are doing :)
################################
if(!$server)
$server = $default_server;
## Check if we need to update DATA cache
clearstatcache();
if(file_exists('war_ss.cache')) {
if(time()-($update_timer*60) > filemtime('war_ss.cache'))
$update = true;
}
else
$update = true;
## Fetch DATA as $xml
if($update) {
$data = @file_get_contents($status_url);
if(strlen($data) > 300) {
## Don't write data unless it is there
$handle = fopen('war_ss.cache',"w");
fwrite($handle,$data);
fclose($handle);
} else
$error = 'Unable to access remote XML file.';
}
$xml = @strtolower(@file_get_contents('war_ss.cache'));
## Parse $xml
if($xml and !$error) {
if(strpos($xml,strtolower($server))) {
$status = substr($xml,strpos($xml,strtolower($server))-300,350);
preg_match('/title="status: (\w+)"/i',$status,$status_array);
## 0 = match, 1 = status
if($status_array[1] == 'online' or $status_array[1] == 'offline') {
return $status_array[1];
} else
$error = 'Unable to determine Server Status';
}
}
if($error)
return $error;
}
if(basename(__FILE__) == basename($_SERVER['SCRIPT_NAME']))
echo war_ss();
?>
</td></tr>
</table>
</td>
</tr>
<tr>
<td align="left" class="alt1" valign="top">
<hr size="1"/>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td><b>Badlands Server Status</b></td></tr>
<tr><td>
<?php
##
## WAR Server Status
## Version 0.1
## Copyright 2008 Nick Schaffner
## http://53x11.com
##
function war_ss($server = 0) {
/*
## Here you can preset all of the default variables for the script.
*/
$default_server = 'badlands';
$status_url = 'http://realmwar.warhammeronline.com/realmwar/ServerStatus.war';
$update_timer = 10; // minutes
################################
################################ PHP Magic Below, Avoid editing if you don't know what you are doing :)
################################
if(!$server)
$server = $default_server;
## Check if we need to update DATA cache
clearstatcache();
if(file_exists('war_ss.cache')) {
if(time()-($update_timer*60) > filemtime('war_ss.cache'))
$update = true;
}
else
$update = true;
## Fetch DATA as $xml
if($update) {
$data = @file_get_contents($status_url);
if(strlen($data) > 300) {
## Don't write data unless it is there
$handle = fopen('war_ss.cache',"w");
fwrite($handle,$data);
fclose($handle);
} else
$error = 'Unable to access remote XML file.';
}
$xml = @strtolower(@file_get_contents('war_ss.cache'));
## Parse $xml
if($xml and !$error) {
if(strpos($xml,strtolower($server))) {
$status = substr($xml,strpos($xml,strtolower($server))-300,350);
preg_match('/title="status: (\w+)"/i',$status,$status_array);
## 0 = match, 1 = status
if($status_array[1] == 'online' or $status_array[1] == 'offline') {
return $status_array[1];
} else
$error = 'Unable to determine Server Status';
}
}
if($error)
return $error;
}
if(basename(__FILE__) == basename($_SERVER['SCRIPT_NAME']))
echo war_ss();
?>
</td></tr>
</table>
</td>
</tr>