2012-06-15, 08:30 PM
Hey guys, so i'm using the dark fusion theme.
What i'm trying to do is add a server status checker that can ping to an ip and port and return a value of online or offline etc.
I have the script.
It works 100% perfect if i just put it in a php file and then have just a white page etc.
I want to create a page that blends into my template.
however, when i do this, the html part works fine...but the second i add php to the globaltemplates it gives me an error.
Here is a link to the plane php file that works perfect.
http://RuneCentre.com/test.php
Works perfect, but the file doesn't have the template background, header, footer etc.
Now, when you go here:
http://RuneCentre.com/statuschecker.php
You receive an error.
Why? It works fine if i remove the php, but as soon as i add it, that error occurs.
Here is what the statuschecker.php file looks like.
here is the contents of that.
The page will look just like the theme and it will display the html, but no function will work of course.
I hope I have explained this well enough.
If anyone can help, I'de greatly appreciate it!
Thanks in advance.
p.s
incase i fool around, here is the error.
What i'm trying to do is add a server status checker that can ping to an ip and port and return a value of online or offline etc.
I have the script.
It works 100% perfect if i just put it in a php file and then have just a white page etc.
I want to create a page that blends into my template.
however, when i do this, the html part works fine...but the second i add php to the globaltemplates it gives me an error.
Here is a link to the plane php file that works perfect.
http://RuneCentre.com/test.php
Works perfect, but the file doesn't have the template background, header, footer etc.
Now, when you go here:
http://RuneCentre.com/statuschecker.php
You receive an error.
Why? It works fine if i remove the php, but as soon as i add it, that error occurs.
Here is what the statuschecker.php file looks like.
<?php
define('IN_MYBB', 1); require "./global.php";
add_breadcrumb("Status Checker", "statuschecker.php");
eval("\$html = \"".$templates->get("status_checker")."\";");
output_page($html);
?>
And then in globaltemplates, i have a template titled status_checkerhere is the contents of that.
<head>
<title align="center">Status Checker</title>
{$headerinclude}
</head>
<body align = "center">
{$header}
<table border="0" cellspacing="1" cellpadding="4" class="tborder">
<tr>
<td class="thead"><span class="smalltext"><strong><center>Status Checker</center></strong></span></td>
</tr>
<form action="" method="get"><center>
<title>Rune-Core - Status Checker</title>
<table border="0">
<tr>
<td>
IP:
</td>
</tr>
<tr>
<td>
<input type="text" name="address" />
</td>
</tr>
<tr>
<td>
Port:
</td>
</tr>
<tr>
<td>
<select name="port">
<option>43594</option>
<option>5555</option>
<option>80</option>
</select>
</td>
</tr>
<tr>
<td align="right">
<input type="submit" name="submit" value="Check" />
</td>
</tr>
</table>
</form>
</center>
<?php
$IP = $_GET['address'];
$Port = $_GET['port'];
$Check = fsockopen($IP, $Port, $errno, $errstr, .5);
if(isset($_GET['submit'])) {
if($Check) {
echo "<b>IP:</b> " . $IP . "<br>";
echo "<b>Port:</b> " . $Port . "<br>";
echo "<b>Status:</b> <font color='green'>Online!</font>" . "<br>";
} else {
echo "<b>IP:</b> " . $IP . "<br>";
echo "<b>Port:</b> " . $Port . "<br>";
echo "<b>Status:</b> <font color='red'>Offline.</font>" . "<br>";
}
}
?>
{$footer}
</body>
</html>
If i remove this code in the template file
<?php
$IP = $_GET['address'];
$Port = $_GET['port'];
$Check = fsockopen($IP, $Port, $errno, $errstr, .5);
if(isset($_GET['submit'])) {
if($Check) {
echo "<b>IP:</b> " . $IP . "<br>";
echo "<b>Port:</b> " . $Port . "<br>";
echo "<b>Status:</b> <font color='green'>Online!</font>" . "<br>";
} else {
echo "<b>IP:</b> " . $IP . "<br>";
echo "<b>Port:</b> " . $Port . "<br>";
echo "<b>Status:</b> <font color='red'>Offline.</font>" . "<br>";
}
}
?>
The page will look just like the theme and it will display the html, but no function will work of course.
I hope I have explained this well enough.
If anyone can help, I'de greatly appreciate it!
Thanks in advance.
p.s
incase i fool around, here is the error.
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/pronyma/public_html/statuschecker.php(7) : eval()'d code on line 51