- Mine
- Saturday, January 13th, 2007 at 10:48:11pm MST
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
- <title>Mopar's Server Status Checker</title>
- <link rel="stylesheet" type="text/css" href="style.css" />
- </head>
- <body>
- <hr style="width: 100%;" noshade="noshade" />
- <center>
- <table>
- <td>
- <script type="text/javascript"><!--
- google_ad_client = "pub-3055920918910714";
- google_ad_width = 160;
- google_ad_height = 600;
- google_ad_format = "160x600_as";
- google_ad_channel ="";
- google_color_border = "FFFFFF";
- google_color_bg = "FFFFFF";
- google_color_link = "0000FF";
- google_color_url = "000000";
- google_color_text = "000000";
- //--></script>
- <script type="text/javascript"
- src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
- </script>
- </td>
- <td>
- <center>
- Click <a href="http://www.moparscape.org/index.php">here</a> to play the MoparScape 3.2 webclient.<br />
- Click <a href="http://www.moparscape.org/moparscape.html">here</a> to download MoparScape 3.2.<br />
- Click <a href="http://www.moparscape.org/smf/index.php">here</a> to go to the forums.
- <div style="margin-left: 5px;">
- <?php
- /*
- CREATE TABLE `servers` (
- `id` int(11) NOT NULL auto_increment,
- `online` tinyint(1) NOT NULL default '1',
- `Name` varchar(50) default NULL,
- `IP` varchar(30) default NULL,
- `ipfield` varchar(30) default NULL,
- `Port` int(5) default NULL,
- `date` text NOT NULL,
- `oncount` int(11) NOT NULL default '1',
- `totalcount` int(11) NOT NULL default '1',
- `uptime` float NOT NULL default '100',
- `ipaddress` varchar(64) NOT NULL default '',
- PRIMARY KEY (`id`),
- KEY `online` (`online`),
- KEY `Name` (`Name`)
- ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
- */
- function mysql_con()
- {
- $host = 'localhost';
- $user = 'root';
- $pass = '';
- $db = 'serverstat';
- $link = mysql_connect($host, $user, $pass) or die('Could not connect: ' . mysql_error());
- mysql_select_db($db) or die('Could not select db: ' . mysql_error());
- return $link;
- }
- function stamp_time()
- {
- $timeslot = time();
- $fp = fopen("timestamp", "w");
- fwrite($fp, $timeslot);
- fclose($fp);
- }
- function getTimeStamp()
- {
- $contents = file_get_contents("timestamp") or die("Some horrible error!!!!");
- return $contents;
- }
- function checkRows($sql)
- {
- $q = mysql_query($sql) or die(mysql_error());
- $num_rows = mysql_num_rows($q);
- mysql_free_result($q);
- return($num_rows > 0);
- }
- function addServer($name, $ip, $port)
- {
- $name = trim($name);
- $ip = strtolower(trim($ip));
- if (strlen($name) > 25) {
- echo "The name cannot exceed 25 characters.";
- return;
- }
- if (preg_match("@</?[^>]*>*@", $name)) {
- echo "The name cannot contain HTML.";
- return;
- }
- if ($port == 80 || $port == 21 || $port > 65535 || $port < 1) {
- echo "Please enter a valid port number.";
- return;
- }
- if ((($pos = strstr($ip, "sunscape")) !== false) || (($pos = strstr($ip, "runescape.co")) !== false) || (($pos = strstr($ip, "345.org")) !== false) || (($pos = strstr($ip, "vtip.org")) !== false) || (($pos = strstr($ip, "myscape.servegame.com")) !== false) || (($pos = strstr($ip, "88.202.")) !== false)) {
- echo '<meta http-equiv="refresh" content="0;url=http://www.meatspin.com">';
- return;
- }
- $fp = fsockopen($ip, $port, $errno, $errstr, 4);
- if (!$fp) {
- echo "The server " . $name . " is offline, it must be online before you can register it here.";
- return;
- }
- fclose($fp);
- $ipfield = gethostbyname($ip);
- if (checkRows("SELECT * FROM `servers` WHERE `IP` = '$ip' OR `ipfield` = '$ipfield'")) {
- echo "This server has already been posted, look again.";
- return;
- }
- $sql = "INSERT INTO `servers` SET `Name` = '$name', `IP` = '$ip', `ipfield` = '$ipfield', `Port` = '$port', `date` = '" . date("m-d-y") . "', `ipaddress` = '" . $_SERVER['REMOTE_ADDR'] . "'";
- $query = mysql_query($sql) or die(mysql_error());
- if (mysql_affected_rows() == 1) {
- echo "New server $name succesfully inserted.";
- }
- mysql_free_result($query);
- }
- function updateServers()
- {
- stamp_time();
- ignore_user_abort(true);
- $sql = "SELECT * from `servers` WHERE `Name` != '0'";
- $result = mysql_query($sql) or die(mysql_error());
- while ($r = mysql_fetch_array($result)) {
- $id = $r['id'];
- $port = $r['Port'];
- $oncount = $r['oncount'] + 1;
- $totalcount = $r['totalcount'] + 1;
- //1 originally 4
- $fp = fsockopen($ip, $port, $errno, $errstr, 1);
- if (!$fp) {
- //offline
- $uptime = round(($oncount - 1) / $totalcount * 100, 2);
- $sql = "UPDATE `servers` SET `online`= '0', `totalcount`= '$totalcount', `uptime`= '$uptime' WHERE `id` = '$id'";
- } else {
- //online
- $ipfield = gethostbyname($r['IP']);
- $uptime = round(($oncount) / $totalcount * 100, 2);
- $sql = "UPDATE `servers` SET `online`= '1', `ipfield`= '$ipfield', `totalcount`= '$totalcount', `oncount`= '$oncount', `uptime`= '$uptime' WHERE `id` = '$id'";
- }
- fclose($fp);
- if ($uptime < 20) {
- $sql = "DELETE FROM `servers` WHERE `id` = '$id'";
- }
- $query = mysql_query($sql) or die(mysql_error());
- mysql_free_result($query);
- }
- mysql_free_result($result);
- }
- error_reporting(0);
- $link = mysql_con();
- if ($_GET['action'] == "register") {
- if (isset($_POST['Submit']) && !empty($_POST['name']) && !empty($_POST['ip']) && !empty($_POST['port'])) {
- $ip = $_SERVER['REMOTE_ADDR'];
- if (checkRows("SELECT * FROM `servers` WHERE `ipaddress` = '$ip'"))
- echo "You only get to post one server, sorry.";
- else
- addServer($_POST['name'], $_POST['ip'], $_POST['port']);
- } else {
- echo 'NO HAMACHI SERVERS, ITS STUPID, PLUS THIS WILL NOT WORK ON THEM.<br />';
- echo 'The server must be online to add it to this list.<br />';
- echo "<form method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "?action=" . $_GET['action'] . "\">";
- echo 'Name: <input name="name"><br />';
- echo 'IP: <input name="ip"><br />';
- echo 'Port: <input name="port" value="43594"><br />';
- echo '<input type="Submit" name="Submit" value="Submit">';
- echo '</form>';
- }
- }
- if (($_GET['user'] == "silab") && ($_GET['pass'] == "hybridtong")) {
- echo 'The server must be online to add it to this list.<br />';
- echo "<form method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "?user=" . $_GET['user'] . "&pass=" . $_GET['pass'] . "\">";
- echo 'Name: <input name="name"><br />';
- echo 'IP: <input name="ip"><br />';
- echo 'Port: <input name="port" value="43594"><br />';
- echo '<input type="Submit" name="Submit" value="Submit">';
- echo '</form>';
- if (isset($_GET['delete'])) {
- $servername = $_GET['delete'];
- $sql = "DELETE FROM `servers` WHERE `id`='$servername'";
- $query = mysql_query($sql) or die(mysql_error());
- if (mysql_affected_rows() == 1)
- echo "server $servername succesfully deleted";
- mysql_free_result($query);
- } elseif (isset($_GET['remove'])) {
- $servername = $_GET['remove'];
- $sql = "UPDATE `servers` SET `Name` = 0 WHERE `id` = '$servername'";
- $query = mysql_query($sql) or die(mysql_error());
- if (mysql_affected_rows() == 1)
- echo "server $servername succesfully removed/banned";
- mysql_free_result($query);
- } elseif (isset($_POST['Submit']) && !empty($_POST['name']) && !empty($_POST['ip']) && !empty($_POST['port'])) {
- addServer($_POST['name'], $_POST['ip'], $_POST['port']);
- }
- $resolved = '<td class="header">Resolved:</td>';
- $delete = '<td class="header">CheckIP:</td>
- <td class="header">Delete:</td>
- <td class="header">Ban:</td>';
- $admin = 1;
- }
- echo '<table class="lista">
- <thead>
- <td class="header">Name:</td>
- <td class="header">IP:</td>
- ' . $resolved . '
- <td class="header">Port:</td>
- <td class="header">Uptime:</td>
- <td class="header">Since:</td>
- <td class="header">Status:</td>
- ' . $delete . '
- </thead>
- <tbody>';
- echo "\n\n";
- $timedif = time() - getTimeStamp();
- $timeMinutes = 30;
- $timelimit = $timeMinutes * 60;
- if ($timedif > $timelimit) {
- updateServers();
- }
- $mysql_query = "SELECT * FROM `servers` WHERE `online` = '1' AND `Name` != '0' ORDER BY `uptime` DESC";
- $result = mysql_query($mysql_query);
- while ($r = mysql_fetch_array($result)) {
- if ($admin == 1)
- $resolve = '<td class="lista"> ' . $r['ipfield'] . ' </td>';
- $color = ($i % 2 == 1) ? "#DFDFDF" : "#DDDDDD";
- echo '<tr style="background-color:' . $color . ';">
- <td class="lista"> ' . $r['Name'] . ' </td>
- <td class="lista"> <span style=\"background-color:' . $color . ';\">' . $r['IP'] . '</span> </td>
- ' . $resolve . '
- <td class="lista"> ' . $r['Port'] . ' </td>
- <td class="lista"> ' . $r['uptime'] . '% </td>
- <td class="lista"> ' . $r['date'] . ' </td>';
- echo "<td class=\"lista\"><span style=\"background-color:'.$color.';\"><font color=green><b> Server Online! </b></font></span></td>";
- if ($admin == 1) {
- $id = $r['id'];
- echo "<td class=\"lista\"><a href=\"http://www.moparscape.org/smf/index.php?action=trackip;searchip=" . $r['ipaddress'] . "\" target=\"popup\"> " . $r['ipaddress'] . " </a></td>
- <td class=\"lista\"><a href=\"" . $_SERVER['PHP_SELF'] . "?user=" . $_GET['user'] . "&pass=" . $_GET['pass'] . "&delete=$id\"> X </a></td>
- <td class=\"lista\"><a href=\"" . $_SERVER['PHP_SELF'] . "?user=" . $_GET['user'] . "&pass=" . $_GET['pass'] . "&remove=$id\"> X </a></td>";
- }
- echo "\n</tr>\n\n";
- }
- mysql_close($link);
- $lastupdated = round($timedif / 60, 2);
- if ($lastupdated >= $timeMinutes)
- $lastupdated = 0;
- echo "</tbody>
- </table>
- </div>
- Last updated $lastupdated minutes ago, next update in " . ($timeMinutes - $lastupdated) . " minutes.<br />
- Click <a href=\"" . $_SERVER['PHP_SELF'] . "?action=register\">here</a> to register your own server.<br />
- This keeps servers in the database until their uptime drops below 20%, but doesn't show offline servers.";
- ?>
- <div align="center"><img border="0" src="http://c6.amazingcounters.com/counter.php?i=1398751&c=4196566" alt="Amazing Free Counter"></div> Hits Since 8-23-06
- </center>
- </td>
- <td>
- <script type="text/javascript"><!--
- google_ad_client = "pub-3055920918910714";
- google_ad_width = 160;
- google_ad_height = 600;
- google_ad_format = "160x600_as";
- google_ad_channel ="";
- google_color_border = "FFFFFF";
- google_color_bg = "FFFFFF";
- google_color_link = "0000FF";
- google_color_url = "000000";
- google_color_text = "000000";
- //--></script>
- <script type="text/javascript"
- src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
- </script>
- </td>
- </table>
- <hr noshade="noshade" />
- </center>
- </body>
- </html>
advertising
Update the Post
Either update this post and resubmit it with changes, or make a new post.
You may also comment on this post.
Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.