Idk who the original author was but I revised it so it would be better for my website, rspserver.com (serverstatus.rspserver.com).
Give credits if you use this.
Config.php
PHP Code:
<?php
$Host = "localhost";
$User = ""; //Your database user
$Password = ""; //Your database password
$DBName = "serverstatus"; //Your database name
$TableName = "serverstatus"; //leave this as it is or it wont work
?>
Index.php
PHP Code:
<?php
include('config.php');
$Link = mysql_connect ($Host, $User, $Password);
$Query = "SELECT * from $TableName";
$Result = mysql_db_query ($DBName, $Query, $Link);
$_get[1];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title>Server Status - RSPServer.com</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link rel="stylesheet" type="text/css" href="default.css" />
</head>
<body>
<div id="header">
<div id="header_inner">
<h1><a href="http://www.rspserver.com"><span>RSPS</span>erver.com</a></h1>
<div id="slogan"><a href="index.php">Home</a> - <a href="http://www.rspserver.com">Forums</a></div>
</div>
</div>
<div id="main">
<?
$action = $_GET["action"];
$server = $_GET["server"];
if ($_GET[server]) {
$query=mysql_query("SELECT * FROM serverstatus WHERE IP='$server'");
while($_results=mysql_fetch_array($query)) {
$_name=$_results["Name"];
$_port=$_results["Port"];
$_info=$_results["comm"];
}
$checkCurr = @fsockopen("$server", "$_port", $ERRNO, $ERRSTR, 1);
if($checkCurr) {
$echoo = '<font color="blue"><b>Online</b></font>';
}
else {
$echoo = '<font color="red"><b>Offline<b></b>';
}
$dp = '<tr><td>Server Name:</td></tr><tr><td> <b>'.$_name.'</b></td></tr><br />
<tr><td>Server IP:</td></tr><tr><td> <b>'.$server.'</b></td></tr><br />
<tr><td>Port:</td></tr><tr><td> <b>'.$_port.'</b></td></tr><br />
<tr><td>Information:</td></tr><tr><td> <b>'.$_info.'</b></td></tr><br />
<tr><td>Status:</td></tr><tr><td> '.$echoo.'</td></tr><br />
<br />Decided to change your mind? Head on back to the <a href="index.php">Main Page</a>!</a>
<br />Or if you want, you can add your own server <a href="index.php?action=register">here</a>!
<br />
<br />
<div id="footer">
© 2008 RSPServer.com
</div>';
die($dp);
}
if ($action == "register") {
$dp = '<form action=index.php method=register>
<table>You can only add online servers to this list.
<tr><td><br /></td></tr>
<tr><td>Server Name:</td></tr><tr><td><input type=text name=name></td></tr>
<tr><td>Server IP:</td></tr><tr><td><input type=text name=ip></td></tr>
<tr><td>Port:</td></tr><tr><td><input type=text name=port></td></tr>
<tr><td>Information:</td></tr><tr><td><input type=text name=comm></td></tr>
<tr><td><input type=submit name=n></td></tr></table>
</tbody>
<br />Decided to change your mind? Head on back to the <a href="index.php">Main Page</a>!</a>
<br />
<br />
<div id="footer">
© 2008 RSPServer.com
</div>';
die($dp);
}
elseif($action == "register2") {
echo ('<br />');
echo ("Your Server has been successfully added to the list!");
echo ('<br />');
}
elseif($action =="fail") {
echo ('<br />');
echo ('Your server has not been added because it is offline!');
echo ('<br />');
}
?>
<table>
<tbody>
<td class="header" width=150><b><u>Server Name</u></b></td> <td class="header" width=50><b><u>Status</u></b></td> <td class="header" width=160><b><u>IP Address</u></b></td> <td class="header" width= 50><b><u>Port</u></b></td> <td class="header" width=30><b><u>Uptime</u></b></td>
</thead>
<?
if ($Result) {
while ($Row = mysql_fetch_array ($Result)) {
@mysql_connect($Host, $User, $Password) or die(mysql_error());
@mysql_select_db ($DBName) or die(mysql_error());
$checkCurr = @fsockopen("$Row[IP]", "$Row[Port]", $ERRNO, $ERRSTR, 1);
$total = "$Row[Total] + 1";
echo ('<tr>');
echo ('<td class="lista">');
echo ("<a href=index.php?server=$Row[IP]>$Row[Name]</a>");
echo ('</td>');
echo ('<td class="lista">');
if($checkCurr) {
$uptime = "$Row[Uptime] + 1";
echo ('<font color="blue"><b>Online</b></font>');
$UpdateDB = mysql_query("UPDATE `serverstatus` SET Uptime = $uptime WHERE Uptime = $Row[Uptime]");
}
else {
echo ('<font color="red"><b>Offline<b></b>');
}
$UpdateDB2 = mysql_query("UPDATE `serverstatus` SET Total = $total WHERE Total = $Row[Total]");
echo ('</td>');
echo ('<td class="lista">');
print ("$Row[IP]");
echo ('</td>');
echo ('<td class="lista">');
print ("$Row[Port]");
echo ('</td>');
echo ('<td class="lista">');
$accuracy = $uptime/$total;
if ($accuracy == 1) {
$accuracy = $accuracy * 100;
}
else {
$accuracy = 100 - $uptime/$total;
}
print ("<b>$accuracy%</b>");
echo ('</tr>');
}
}
else {
$create = 'CREATE TABLE `serverstatus` (
`Name` VARCHAR (20) NOT NULL,
`IP` VARCHAR (50) NOT NULL,
`Port` VARCHAR (6) NOT NULL,
`comm` TEXT (50) NOT NULL,
`Uptime` VARCHAR (999999) NOT NULL,
`Total` VARCHAR (999999) NOT NULL,
PRIMARY KEY (`Name`)
)';
$query3 = mysql_query($create);
mysql_close();
}
$ip = $_REQUEST['ip'];
$port = $_REQUEST['port'];
$comm = $_REQUEST['comm'];
function refresh ($time, $topage) {
echo "<meta http-equiv=\"refresh\" content=\"{$time}; url={$topage}\"
/> ";
}
$checkReg = @fsockopen("$ip", "$port", $ERRNO, $ERRSTR, 1);
if($checkReg) {
$chicken = 'true';
} else {
$chicken = 'false';
}
if($chicken == 'true') {
$name = $_REQUEST['name'];
@mysql_connect($Host, $User, $Password) or die(mysql_error());
@mysql_select_db ($DBName) or die(mysql_error());
$Query2 = mysql_query("INSERT INTO `serverstatus` (`Name`, `IP`, `Port`, `Uptime`, `Total`, `comm`) VALUES ('$name', '$ip', '$port', '1', '1', '$comm')");
mysql_close();
refresh(0,"index.php?action=register2");
}
elseif($chicken == 'false') {
}
else {
refresh(0,"index.php?action=fail");
}
?>
</table>
<br />Want to add your server in the above list? Click <a href="index.php?action=register">here</a> to.<br> It must be online before you enter it, if it is offline, it will not work.</a>
<br />
</div>
<div id="footer">
© 2008 RSPServer.com | © 2008-2009 SupahFly.net
</div>
</body>
</html>
Again: I have no idea who made this. I just added a template and shit.
DOWNLOAD FILES (you're gonna need these):