Hi again,
Using a web script to show the servers I have, which are working here: http://www.bradlyspicer.net/ServerStatus-master/index.php
Trying to add it into wordpress. And this is happening:
http://www.bradlyspicer.net/server-status/
Saying it is down and saying N/A etc.
If I go to http://www.bradlyspicer.net/wp-content/themes/twentyeleven/index_server.php it works.
If I go to http://www.bradlyspicer.net/server-status/ it doesn't.
These are the two files:
Both located in /wp-content/themes/twentyeleven/
index_server.php :
<?php
include('includes/config.php');
global $sJavascript, $sTable;
$query = mysql_query("SELECT * FROM servers ORDER BY id") or die(mysql_error());
$sJavascript .= '<script type="text/javascript">
function uptime() {
$(function() {';
while($result = mysql_fetch_array($query)){
$sJavascript .= '$.getJSON("pull/index.php?url='.$result["id"].'",function(result){
$("#online'.$result["id"].'").html(result.online);
$("#uptime'.$result["id"].'").html(result.uptime);
$("#load'.$result["id"].'").html(result.load);
$("#memory'.$result["id"].'").html(result.memory);
$("#hdd'.$result["id"].'").html(result.hdd);
});';
$sTable .= '
<tr>
<td id="online'.$result["id"].'">
<div class="progress">
<div class="bar bar-danger" style="width: 100%;"><small>Down</small></div>
</div>
</td>
<td>'.$result["name"].'</td>
<td>'.$result["type"].'</td>
<td>'.$result["host"].'</td>
<td>'.$result["location"].'</td>
<td id="uptime'.$result["id"].'">n/a</td>
<td id="load'.$result["id"].'">n/a</td>
<td id="memory'.$result["id"].'">
<div class="progress progress-striped active">
<div class="bar bar-danger" style="width: 100%;"><small>n/a</small></div>
</div>
</td>
<td id="hdd'.$result["id"].'">
<div class="progress progress-striped active">
<div class="bar bar-danger" style="width: 100%;"><small>n/a</small></div>
</div>
</td>
</tr>
';
}
$sJavascript .= '});
}
uptime();
setInterval(uptime, '.$sSetting['refresh'].');
</script>';
include($index);
?>
Vps.php (Which is the page that doesn't work):
<?php
/*
Template Name: VPS page
*/
get_header(); ?>
<div id="primary">
<div id="content" role="main">
<!-- VPS Details -->
<?php
include('includes/config.php');
global $sJavascript, $sTable;
$query = mysql_query("SELECT * FROM servers ORDER BY id") or die(mysql_error());
$sJavascript .= '<script type="text/javascript">
function uptime() {
$(function() {';
while($result = mysql_fetch_array($query)){
$sJavascript .= '$.getJSON("pull/index.php?url='.$result["id"].'",function(result){
$("#online'.$result["id"].'").html(result.online);
$("#uptime'.$result["id"].'").html(result.uptime);
$("#load'.$result["id"].'").html(result.load);
$("#memory'.$result["id"].'").html(result.memory);
$("#hdd'.$result["id"].'").html(result.hdd);
});';
$sTable .= '
<tr>
<td id="online'.$result["id"].'">
<div class="progress">
<div class="bar bar-danger" style="width: 100%;"><small>Down</small></div>
</div>
</td>
<td>'.$result["name"].'</td>
<td>'.$result["type"].'</td>
<td>'.$result["host"].'</td>
<td>'.$result["location"].'</td>
<td id="uptime'.$result["id"].'">n/a</td>
<td id="load'.$result["id"].'">n/a</td>
<td id="memory'.$result["id"].'">
<div class="progress progress-striped active">
<div class="bar bar-danger" style="width: 100%;"><small>n/a</small></div>
</div>
</td>
<td id="hdd'.$result["id"].'">
<div class="progress progress-striped active">
<div class="bar bar-danger" style="width: 100%;"><small>n/a</small></div>
</div>
</td>
</tr>
';
}
$sJavascript .= '});
}
uptime();
setInterval(uptime, '.$sSetting['refresh'].');
</script>';
include($index);
?>
</div><!-- #content -->
</div><!-- #primary -->
<?php get_footer(); ?>