mirror of
https://github.com/kcozens/OpenSimSearch.git
synced 2026-08-14 08:52:28 +00:00
Update for the hostsregister table, making sure that a region doesn't make the file spit out messages.
Please update your database with the update-hostregister.sql for this to work (BETA test, do NOT use this in production systems) git-svn-id: http://forge.opensimulator.org/svn/ossearch/trunk@98 109abde3-1f22-4c10-b5d7-b6b0135cd00c
This commit is contained in:
+321
-284
@@ -1,284 +1,321 @@
|
||||
<?
|
||||
include("databaseinfo.php");
|
||||
|
||||
$now = time();
|
||||
|
||||
//
|
||||
// Search DB
|
||||
//
|
||||
mysql_connect ($DB_HOST, $DB_USER, $DB_PASSWORD);
|
||||
mysql_select_db ($DB_NAME);
|
||||
|
||||
function GetURL($host, $port, $url)
|
||||
{
|
||||
$url = "http://$host:$port/$url";
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
|
||||
|
||||
$data = curl_exec($ch);
|
||||
if (!curl_errno($ch))
|
||||
{
|
||||
curl_close($ch);
|
||||
return $data;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
function parse($hostname, $port)
|
||||
{
|
||||
global $now;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Search engine sim scanner
|
||||
//
|
||||
|
||||
//
|
||||
// Read params
|
||||
//
|
||||
if ($hostname != "" && $port != "")
|
||||
{
|
||||
$next = time() + 600; // 5 mins, so we don't get stuck
|
||||
|
||||
$updater = mysql_query("UPDATE hostsregister set lastcheck = $next " .
|
||||
"where host = '" . mysql_escape_string($hostname) . "' AND " .
|
||||
"port = '" . mysql_escape_string($port) . "'");
|
||||
|
||||
//
|
||||
// Load XML doc from URL
|
||||
//
|
||||
$objDOM = new DOMDocument();
|
||||
$objDOM->resolveExternals = false;
|
||||
$objDOM->loadXML(GetURL($hostname, $port, "?method=collector"));
|
||||
|
||||
//
|
||||
// Grabbing the expire to update
|
||||
//
|
||||
$regiondata = $objDOM->getElementsByTagName("regiondata")->item(0);
|
||||
$expire = $regiondata->getElementsByTagName("expire")->item(0)->nodeValue;
|
||||
|
||||
//
|
||||
// Calculate new expire
|
||||
//
|
||||
$next = time() + $expire;
|
||||
|
||||
$updater = mysql_query("UPDATE hostsregister set lastcheck = $next " .
|
||||
"where host = '" . mysql_escape_string($hostname) . "' AND " .
|
||||
"port = '" . mysql_escape_string($port) . "'");
|
||||
|
||||
$regionlist = $regiondata->getElementsByTagName("region");
|
||||
|
||||
foreach( $regionlist as $region )
|
||||
{
|
||||
//
|
||||
// Start reading the Region info
|
||||
//
|
||||
$info = $region->getElementsByTagName("info")->item(0);
|
||||
|
||||
$regionuuid =
|
||||
$info->getElementsByTagName("uuid")->item(0)->nodeValue;
|
||||
|
||||
$regionname =
|
||||
$info->getElementsByTagName("name")->item(0)->nodeValue;
|
||||
|
||||
$regionhandle =
|
||||
$info->getElementsByTagName("handle")->item(0)->nodeValue;
|
||||
|
||||
$url =
|
||||
$info->getElementsByTagName("url")->item(0)->nodeValue;
|
||||
|
||||
//
|
||||
// First, check if we already have a region that is the same
|
||||
//
|
||||
$check = mysql_query("SELECT * FROM regions WHERE regionuuid = '" .
|
||||
mysql_escape_string($regionuuid) . "'");
|
||||
|
||||
if (mysql_num_rows($check) > 0)
|
||||
{
|
||||
mysql_query("DELETE FROM regions WHERE regionuuid = '" .
|
||||
mysql_escape_string($regionuuid) . "'");
|
||||
mysql_query("DELETE FROM parcels WHERE regionuuid = '" .
|
||||
mysql_escape_string($regionuuid) . "'");
|
||||
mysql_query("DELETE FROM objects WHERE regionuuid = '" .
|
||||
mysql_escape_string($regionuuid) . "'");
|
||||
mysql_query("DELETE FROM allparcels WHERE regionUUID = '" .
|
||||
mysql_escape_string($regionuuid) . "'");
|
||||
mysql_query("DELETE FROM parcelsales WHERE regionUUID = '" .
|
||||
mysql_escape_string($regionuuid) . "'");
|
||||
}
|
||||
|
||||
$data = $region->getElementsByTagName("data")->item(0);
|
||||
$estate = $data->getElementsByTagName("estate")->item(0);
|
||||
|
||||
$username =
|
||||
$estate->getElementsByTagName("name")->item(0)->nodeValue;
|
||||
$useruuid =
|
||||
$estate->getElementsByTagName("uuid")->item(0)->nodeValue;
|
||||
|
||||
|
||||
//
|
||||
// Second, add the new info to the database
|
||||
//
|
||||
$sql = "INSERT INTO regions VALUES('" .
|
||||
mysql_escape_string($regionname) . "','" .
|
||||
mysql_escape_string($regionuuid) . "','" .
|
||||
mysql_escape_string($regionhandle) . "','" .
|
||||
mysql_escape_string($url) . "','" .
|
||||
mysql_escape_string($username) ."','" .
|
||||
mysql_escape_string($useruuid) ."')";
|
||||
|
||||
mysql_query($sql);
|
||||
|
||||
//
|
||||
// Start reading the parcel info
|
||||
//
|
||||
$parcel = $data->getElementsByTagName("parcel");
|
||||
|
||||
foreach( $parcel as $value )
|
||||
{
|
||||
$parcelname =
|
||||
$value->getElementsByTagName("name")->item(0)->nodeValue;
|
||||
|
||||
$parceluuid =
|
||||
$value->getElementsByTagName("uuid")->item(0)->nodeValue;
|
||||
|
||||
$infouuid =
|
||||
$value->getElementsByTagName("infouuid")->item(0)->nodeValue;
|
||||
|
||||
$parcellanding =
|
||||
$value->getElementsByTagName("location")->item(0)->nodeValue;
|
||||
|
||||
$parceldescription =
|
||||
$value->getElementsByTagName("description")->item(0)->nodeValue;
|
||||
|
||||
$parcelarea =
|
||||
$value->getElementsByTagName("area")->item(0)->nodeValue;
|
||||
|
||||
$parcelcategory =
|
||||
$value->getAttributeNode("category")->nodeValue;
|
||||
|
||||
$parcelsaleprice =
|
||||
$value->getAttributeNode("salesprice")->nodeValue;
|
||||
|
||||
$dwell =
|
||||
$value->getElementsByTagName("dwell")->item(0)->nodeValue;
|
||||
|
||||
$owner = $value->getElementsByTagName("owner")->item(0);
|
||||
|
||||
$owneruuid = $owner->getElementsByTagName("uuid")->item(0)->nodeValue;
|
||||
|
||||
//
|
||||
// Check bits on Public, Build, Script
|
||||
//
|
||||
$parcelforsale =
|
||||
$value->getAttributeNode("forsale")->nodeValue;
|
||||
$parceldirectory =
|
||||
$value->getAttributeNode("showinsearch")->nodeValue;
|
||||
$parcelbuild = $value->getAttributeNode("build")->nodeValue;
|
||||
$parcelscript = $value->getAttributeNode("scripts")->nodeValue;
|
||||
$parcelpublic = $value->getAttributeNode("public")->nodeValue;
|
||||
|
||||
//
|
||||
// Save
|
||||
//
|
||||
$sql = "insert into allparcels values('" .
|
||||
mysql_escape_string($regionuuid) . "','" .
|
||||
mysql_escape_string($parcelname) . "','" .
|
||||
mysql_escape_string($owneruuid) . "','" .
|
||||
mysql_escape_string('00000000-0000-0000-0000-000000000000') . "','" .
|
||||
mysql_escape_string($parcellanding) . "','" .
|
||||
mysql_escape_string($parceluuid) . "','" .
|
||||
mysql_escape_string($infouuid) . "','" .
|
||||
mysql_escape_string($parcelarea) . "' )";
|
||||
|
||||
mysql_query($sql);
|
||||
|
||||
if ($parceldirectory == "true")
|
||||
{
|
||||
$sql = "insert into parcels values('" .
|
||||
mysql_escape_string($regionuuid) . "','" .
|
||||
mysql_escape_string($parcelname) . "','" .
|
||||
mysql_escape_string($parceluuid) . "','" .
|
||||
mysql_escape_string($parcellanding) . "','" .
|
||||
mysql_escape_string($parceldescription) . "','" .
|
||||
mysql_escape_string($parcelcategory) . "','" .
|
||||
mysql_escape_string($parcelbuild) . "','" .
|
||||
mysql_escape_string($parcelscript) . "','" .
|
||||
mysql_escape_string($parcelpublic) . "','".
|
||||
mysql_escape_string($dwell) . "','".
|
||||
mysql_escape_string($infouuid) . "' )";
|
||||
|
||||
mysql_query($sql);
|
||||
}
|
||||
|
||||
if ($parcelforsale == "true")
|
||||
{
|
||||
$sql = "insert into parcelsales values('" .
|
||||
mysql_escape_string($regionuuid) . "','" .
|
||||
mysql_escape_string($parcelname) . "','" .
|
||||
mysql_escape_string($parceluuid) . "','" .
|
||||
mysql_escape_string($parcelarea) . "','" .
|
||||
mysql_escape_string($parcelsaleprice) . "','" .
|
||||
mysql_escape_string($parcellanding) . "','" .
|
||||
mysql_escape_string($infouuid) . "', '" .
|
||||
mysql_escape_string($dwell) . "', '" .
|
||||
mysql_escape_string("1") . "', '" .
|
||||
mysql_escape_string("false") . "')";
|
||||
|
||||
mysql_query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Handle objects
|
||||
//
|
||||
$objects = $data->getElementsByTagName("object");
|
||||
|
||||
foreach( $objects as $value )
|
||||
{
|
||||
$uuid =
|
||||
$value->getElementsByTagName("uuid")->item(0)->nodeValue;
|
||||
|
||||
$regionuuid =
|
||||
$value->getElementsByTagName("regionuuid")->item(0)->nodeValue;
|
||||
|
||||
$parceluuid =
|
||||
$value->getElementsByTagName("parceluuid")->item(0)->nodeValue;
|
||||
|
||||
$title =
|
||||
$value->getElementsByTagName("title")->item(0)->nodeValue;
|
||||
|
||||
$description =
|
||||
$value->getElementsByTagName("description")->item(0)->nodeValue;
|
||||
|
||||
$flags =
|
||||
$value->getElementsByTagName("flags")->item(0)->nodeValue;
|
||||
|
||||
mysql_query("insert into objects values('" .
|
||||
mysql_escape_string($uuid) . "','" .
|
||||
mysql_escape_string($parceluuid) . "','','" .
|
||||
mysql_escape_string($title) . "','" .
|
||||
mysql_escape_string($description) . "','" .
|
||||
mysql_escape_string($regionuuid) . "')");
|
||||
|
||||
}
|
||||
}
|
||||
return True;
|
||||
}
|
||||
else
|
||||
{
|
||||
return False;
|
||||
}
|
||||
}
|
||||
|
||||
$jobsearch = mysql_query("SELECT host, port from hostsregister " .
|
||||
"where lastcheck < $now limit 0,1");
|
||||
|
||||
while ($jobs = mysql_fetch_row($jobsearch))
|
||||
{
|
||||
parse($jobs[0], $jobs[1]);
|
||||
}
|
||||
?>
|
||||
<?
|
||||
include("databaseinfo.php");
|
||||
|
||||
//Supress all Warnings/Errors
|
||||
error_reporting(0);
|
||||
|
||||
$now = time();
|
||||
|
||||
//
|
||||
// Search DB
|
||||
//
|
||||
mysql_connect ($DB_HOST, $DB_USER, $DB_PASSWORD);
|
||||
mysql_select_db ($DB_NAME);
|
||||
|
||||
function GetURL($host, $port, $url)
|
||||
{
|
||||
$url = "http://$host:$port/$url";
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
|
||||
|
||||
$data = curl_exec($ch);
|
||||
if (!curl_errno($ch))
|
||||
{
|
||||
curl_close($ch);
|
||||
return $data;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
function CheckHost($hostname, $port)
|
||||
{
|
||||
$fp = fsockopen ($hostname, $port, $errno, $errstr, 10);
|
||||
|
||||
if(!$fp)
|
||||
{
|
||||
$sql = "UPDATE hostsregister set failcounter = failcounter + 1 ".
|
||||
"where host = '" . mysql_escape_string($hostname) . "' AND " .
|
||||
"port = '" . mysql_escape_string($port) . "'";
|
||||
|
||||
$check = mysql_query($sql);
|
||||
|
||||
//Setting a "fake" update time so this host will have time
|
||||
//to get back online
|
||||
|
||||
$next = time() + 600; // 5 mins, so we don't get stuck
|
||||
|
||||
$updater = mysql_query("UPDATE hostsregister set lastcheck = $next " .
|
||||
"where host = '" . mysql_escape_string($hostname) . "' AND " .
|
||||
"port = '" . mysql_escape_string($port) . "'");
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "UPDATE hostsregister set failcounter = 0 ".
|
||||
"where host = '" . mysql_escape_string($hostname) . "' AND " .
|
||||
"port = '" . mysql_escape_string($port) . "'";
|
||||
|
||||
$check = mysql_query($sql);
|
||||
|
||||
parse($hostname, $port);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function parse($hostname, $port)
|
||||
{
|
||||
global $now;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Search engine sim scanner
|
||||
//
|
||||
|
||||
//
|
||||
// Read params
|
||||
//
|
||||
if ($hostname != "" && $port != "")
|
||||
{
|
||||
$next = time() + 600; // 5 mins, so we don't get stuck
|
||||
|
||||
$updater = mysql_query("UPDATE hostsregister set lastcheck = $next " .
|
||||
"where host = '" . mysql_escape_string($hostname) . "' AND " .
|
||||
"port = '" . mysql_escape_string($port) . "'");
|
||||
|
||||
//
|
||||
// Load XML doc from URL
|
||||
//
|
||||
$objDOM = new DOMDocument();
|
||||
$objDOM->resolveExternals = false;
|
||||
$objDOM->loadXML(GetURL($hostname, $port, "?method=collector"));
|
||||
|
||||
//
|
||||
// Grabbing the expire to update
|
||||
//
|
||||
$regiondata = $objDOM->getElementsByTagName("regiondata")->item(0);
|
||||
$expire = $regiondata->getElementsByTagName("expire")->item(0)->nodeValue;
|
||||
|
||||
//
|
||||
// Calculate new expire
|
||||
//
|
||||
$next = time() + $expire;
|
||||
|
||||
$updater = mysql_query("UPDATE hostsregister set lastcheck = $next " .
|
||||
"where host = '" . mysql_escape_string($hostname) . "' AND " .
|
||||
"port = '" . mysql_escape_string($port) . "'");
|
||||
|
||||
$regionlist = $regiondata->getElementsByTagName("region");
|
||||
|
||||
foreach( $regionlist as $region )
|
||||
{
|
||||
//
|
||||
// Start reading the Region info
|
||||
//
|
||||
$info = $region->getElementsByTagName("info")->item(0);
|
||||
|
||||
$regionuuid =
|
||||
$info->getElementsByTagName("uuid")->item(0)->nodeValue;
|
||||
|
||||
$regionname =
|
||||
$info->getElementsByTagName("name")->item(0)->nodeValue;
|
||||
|
||||
$regionhandle =
|
||||
$info->getElementsByTagName("handle")->item(0)->nodeValue;
|
||||
|
||||
$url =
|
||||
$info->getElementsByTagName("url")->item(0)->nodeValue;
|
||||
|
||||
//
|
||||
// First, check if we already have a region that is the same
|
||||
//
|
||||
$check = mysql_query("SELECT * FROM regions WHERE regionuuid = '" .
|
||||
mysql_escape_string($regionuuid) . "'");
|
||||
|
||||
if (mysql_num_rows($check) > 0)
|
||||
{
|
||||
mysql_query("DELETE FROM regions WHERE regionuuid = '" .
|
||||
mysql_escape_string($regionuuid) . "'");
|
||||
mysql_query("DELETE FROM parcels WHERE regionuuid = '" .
|
||||
mysql_escape_string($regionuuid) . "'");
|
||||
mysql_query("DELETE FROM objects WHERE regionuuid = '" .
|
||||
mysql_escape_string($regionuuid) . "'");
|
||||
mysql_query("DELETE FROM allparcels WHERE regionUUID = '" .
|
||||
mysql_escape_string($regionuuid) . "'");
|
||||
mysql_query("DELETE FROM parcelsales WHERE regionUUID = '" .
|
||||
mysql_escape_string($regionuuid) . "'");
|
||||
}
|
||||
|
||||
$data = $region->getElementsByTagName("data")->item(0);
|
||||
$estate = $data->getElementsByTagName("estate")->item(0);
|
||||
|
||||
$username =
|
||||
$estate->getElementsByTagName("name")->item(0)->nodeValue;
|
||||
$useruuid =
|
||||
$estate->getElementsByTagName("uuid")->item(0)->nodeValue;
|
||||
|
||||
|
||||
//
|
||||
// Second, add the new info to the database
|
||||
//
|
||||
$sql = "INSERT INTO regions VALUES('" .
|
||||
mysql_escape_string($regionname) . "','" .
|
||||
mysql_escape_string($regionuuid) . "','" .
|
||||
mysql_escape_string($regionhandle) . "','" .
|
||||
mysql_escape_string($url) . "','" .
|
||||
mysql_escape_string($username) ."','" .
|
||||
mysql_escape_string($useruuid) ."')";
|
||||
|
||||
mysql_query($sql);
|
||||
|
||||
//
|
||||
// Start reading the parcel info
|
||||
//
|
||||
$parcel = $data->getElementsByTagName("parcel");
|
||||
|
||||
foreach( $parcel as $value )
|
||||
{
|
||||
$parcelname =
|
||||
$value->getElementsByTagName("name")->item(0)->nodeValue;
|
||||
|
||||
$parceluuid =
|
||||
$value->getElementsByTagName("uuid")->item(0)->nodeValue;
|
||||
|
||||
$infouuid =
|
||||
$value->getElementsByTagName("infouuid")->item(0)->nodeValue;
|
||||
|
||||
$parcellanding =
|
||||
$value->getElementsByTagName("location")->item(0)->nodeValue;
|
||||
|
||||
$parceldescription =
|
||||
$value->getElementsByTagName("description")->item(0)->nodeValue;
|
||||
|
||||
$parcelarea =
|
||||
$value->getElementsByTagName("area")->item(0)->nodeValue;
|
||||
|
||||
$parcelcategory =
|
||||
$value->getAttributeNode("category")->nodeValue;
|
||||
|
||||
$parcelsaleprice =
|
||||
$value->getAttributeNode("salesprice")->nodeValue;
|
||||
|
||||
$dwell =
|
||||
$value->getElementsByTagName("dwell")->item(0)->nodeValue;
|
||||
|
||||
$owner = $value->getElementsByTagName("owner")->item(0);
|
||||
|
||||
$owneruuid = $owner->getElementsByTagName("uuid")->item(0)->nodeValue;
|
||||
|
||||
//
|
||||
// Check bits on Public, Build, Script
|
||||
//
|
||||
$parcelforsale =
|
||||
$value->getAttributeNode("forsale")->nodeValue;
|
||||
$parceldirectory =
|
||||
$value->getAttributeNode("showinsearch")->nodeValue;
|
||||
$parcelbuild = $value->getAttributeNode("build")->nodeValue;
|
||||
$parcelscript = $value->getAttributeNode("scripts")->nodeValue;
|
||||
$parcelpublic = $value->getAttributeNode("public")->nodeValue;
|
||||
|
||||
//
|
||||
// Save
|
||||
//
|
||||
$sql = "insert into allparcels values('" .
|
||||
mysql_escape_string($regionuuid) . "','" .
|
||||
mysql_escape_string($parcelname) . "','" .
|
||||
mysql_escape_string($owneruuid) . "','" .
|
||||
mysql_escape_string('00000000-0000-0000-0000-000000000000') . "','" .
|
||||
mysql_escape_string($parcellanding) . "','" .
|
||||
mysql_escape_string($parceluuid) . "','" .
|
||||
mysql_escape_string($infouuid) . "','" .
|
||||
mysql_escape_string($parcelarea) . "' )";
|
||||
|
||||
mysql_query($sql);
|
||||
|
||||
if ($parceldirectory == "true")
|
||||
{
|
||||
$sql = "insert into parcels values('" .
|
||||
mysql_escape_string($regionuuid) . "','" .
|
||||
mysql_escape_string($parcelname) . "','" .
|
||||
mysql_escape_string($parceluuid) . "','" .
|
||||
mysql_escape_string($parcellanding) . "','" .
|
||||
mysql_escape_string($parceldescription) . "','" .
|
||||
mysql_escape_string($parcelcategory) . "','" .
|
||||
mysql_escape_string($parcelbuild) . "','" .
|
||||
mysql_escape_string($parcelscript) . "','" .
|
||||
mysql_escape_string($parcelpublic) . "','".
|
||||
mysql_escape_string($dwell) . "','".
|
||||
mysql_escape_string($infouuid) . "' )";
|
||||
|
||||
mysql_query($sql);
|
||||
}
|
||||
|
||||
if ($parcelforsale == "true")
|
||||
{
|
||||
$sql = "insert into parcelsales values('" .
|
||||
mysql_escape_string($regionuuid) . "','" .
|
||||
mysql_escape_string($parcelname) . "','" .
|
||||
mysql_escape_string($parceluuid) . "','" .
|
||||
mysql_escape_string($parcelarea) . "','" .
|
||||
mysql_escape_string($parcelsaleprice) . "','" .
|
||||
mysql_escape_string($parcellanding) . "','" .
|
||||
mysql_escape_string($infouuid) . "', '" .
|
||||
mysql_escape_string($dwell) . "', '" .
|
||||
mysql_escape_string("1") . "', '" .
|
||||
mysql_escape_string("false") . "')";
|
||||
|
||||
mysql_query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Handle objects
|
||||
//
|
||||
$objects = $data->getElementsByTagName("object");
|
||||
|
||||
foreach( $objects as $value )
|
||||
{
|
||||
$uuid =
|
||||
$value->getElementsByTagName("uuid")->item(0)->nodeValue;
|
||||
|
||||
$regionuuid =
|
||||
$value->getElementsByTagName("regionuuid")->item(0)->nodeValue;
|
||||
|
||||
$parceluuid =
|
||||
$value->getElementsByTagName("parceluuid")->item(0)->nodeValue;
|
||||
|
||||
$title =
|
||||
$value->getElementsByTagName("title")->item(0)->nodeValue;
|
||||
|
||||
$description =
|
||||
$value->getElementsByTagName("description")->item(0)->nodeValue;
|
||||
|
||||
$flags =
|
||||
$value->getElementsByTagName("flags")->item(0)->nodeValue;
|
||||
|
||||
mysql_query("insert into objects values('" .
|
||||
mysql_escape_string($uuid) . "','" .
|
||||
mysql_escape_string($parceluuid) . "','','" .
|
||||
mysql_escape_string($title) . "','" .
|
||||
mysql_escape_string($description) . "','" .
|
||||
mysql_escape_string($regionuuid) . "')");
|
||||
|
||||
}
|
||||
}
|
||||
return True;
|
||||
}
|
||||
else
|
||||
{
|
||||
return False;
|
||||
}
|
||||
}
|
||||
|
||||
$jobsearch = mysql_query("SELECT host, port from hostsregister " .
|
||||
"where lastcheck < $now limit 0,1");
|
||||
|
||||
while ($jobs = mysql_fetch_row($jobsearch))
|
||||
{
|
||||
CheckHost($jobs[0], $jobs[1]);
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -43,7 +43,7 @@ if ($hostname != "" && $port != "" && $service == "online")
|
||||
$register = "INSERT INTO hostsregister VALUES ".
|
||||
"('" . mysql_escape_string($hostname) . "', " .
|
||||
"'" . mysql_escape_string($port) . "', " .
|
||||
"'" . mysql_escape_string($timestamp) . "', 0)";
|
||||
"'" . mysql_escape_string($timestamp) . "', 0, 0)";
|
||||
|
||||
$runupdate = mysql_query($register);
|
||||
}
|
||||
@@ -56,4 +56,4 @@ elseif ($hostname != "" && $port != "" && $service = "offline")
|
||||
|
||||
$rundelete = mysql_query($delete);
|
||||
}
|
||||
?>
|
||||
?>
|
||||
+15
-23
@@ -3,11 +3,11 @@
|
||||
-- http://www.phpmyadmin.net
|
||||
--
|
||||
-- Host: localhost
|
||||
-- Generatie Tijd: 26 Oct 2008 om 21:53
|
||||
-- Generatie Tijd: 05 Nov 2008 om 20:26
|
||||
-- Server versie: 5.0.51
|
||||
-- PHP Versie: 5.2.4-2ubuntu5.3
|
||||
--
|
||||
-- Database: `ostest`
|
||||
-- Database: `ossearch`
|
||||
--
|
||||
|
||||
-- --------------------------------------------------------
|
||||
@@ -16,7 +16,6 @@
|
||||
-- Tabel structuur voor tabel `allparcels`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `allparcels`;
|
||||
CREATE TABLE `allparcels` (
|
||||
`regionUUID` varchar(255) NOT NULL,
|
||||
`parcelname` varchar(255) NOT NULL,
|
||||
@@ -27,7 +26,7 @@ CREATE TABLE `allparcels` (
|
||||
`infoUUID` char(36) NOT NULL default '00000000-0000-0000-0000-000000000000',
|
||||
`parcelarea` int(11) NOT NULL,
|
||||
PRIMARY KEY (`regionUUID`)
|
||||
) TYPE=InnoDB;
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
@@ -35,7 +34,6 @@ CREATE TABLE `allparcels` (
|
||||
-- Tabel structuur voor tabel `classifieds`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `classifieds`;
|
||||
CREATE TABLE `classifieds` (
|
||||
`classifieduuid` char(36) NOT NULL,
|
||||
`creatoruuid` char(36) NOT NULL,
|
||||
@@ -53,7 +51,7 @@ CREATE TABLE `classifieds` (
|
||||
`classifiedflags` int(8) NOT NULL,
|
||||
`priceforlisting` int(5) NOT NULL,
|
||||
PRIMARY KEY (`classifieduuid`)
|
||||
) TYPE=InnoDB;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
@@ -61,24 +59,23 @@ CREATE TABLE `classifieds` (
|
||||
-- Tabel structuur voor tabel `events`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `events`;
|
||||
CREATE TABLE `events` (
|
||||
`owneruuid` char(40) NOT NULL,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`eventid` int(11) NOT NULL,
|
||||
`eventid` int(11) NOT NULL auto_increment,
|
||||
`creatoruuid` char(40) NOT NULL,
|
||||
`category` int(2) NOT NULL,
|
||||
`description` text NOT NULL,
|
||||
`dateUTC` int(10) NOT NULL,
|
||||
`duration` int(10) NOT NULL,
|
||||
`covercharge` int(10) NOT NULL,
|
||||
`duration` int(3) NOT NULL,
|
||||
`covercharge` int(1) NOT NULL,
|
||||
`coveramount` int(10) NOT NULL,
|
||||
`simname` varchar(255) NOT NULL,
|
||||
`globalPos` varchar(255) NOT NULL,
|
||||
`eventflags` int(10) NOT NULL,
|
||||
`mature` enum('true','false') NOT NULL,
|
||||
PRIMARY KEY (`eventid`)
|
||||
) TYPE=InnoDB;
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
@@ -86,14 +83,14 @@ CREATE TABLE `events` (
|
||||
-- Tabel structuur voor tabel `hostsregister`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `hostsregister`;
|
||||
CREATE TABLE `hostsregister` (
|
||||
`host` varchar(255) NOT NULL,
|
||||
`port` int(5) NOT NULL,
|
||||
`register` int(10) NOT NULL,
|
||||
`lastcheck` int(10) NOT NULL,
|
||||
`failcounter` int(1) NOT NULL,
|
||||
PRIMARY KEY (`host`,`port`)
|
||||
) TYPE=InnoDB;
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
@@ -101,7 +98,6 @@ CREATE TABLE `hostsregister` (
|
||||
-- Tabel structuur voor tabel `objects`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `objects`;
|
||||
CREATE TABLE `objects` (
|
||||
`objectuuid` varchar(255) NOT NULL,
|
||||
`parceluuid` varchar(255) NOT NULL,
|
||||
@@ -110,7 +106,7 @@ CREATE TABLE `objects` (
|
||||
`description` varchar(255) NOT NULL,
|
||||
`regionuuid` varchar(255) NOT NULL default '',
|
||||
PRIMARY KEY (`objectuuid`,`parceluuid`)
|
||||
) TYPE=InnoDB;
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
@@ -118,7 +114,6 @@ CREATE TABLE `objects` (
|
||||
-- Tabel structuur voor tabel `parcels`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `parcels`;
|
||||
CREATE TABLE `parcels` (
|
||||
`regionUUID` varchar(255) NOT NULL,
|
||||
`parcelname` varchar(255) NOT NULL,
|
||||
@@ -136,7 +131,7 @@ CREATE TABLE `parcels` (
|
||||
KEY `description` (`description`),
|
||||
KEY `searchcategory` (`searchcategory`),
|
||||
KEY `dwell` (`dwell`)
|
||||
) TYPE=InnoDB;
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
@@ -144,7 +139,6 @@ CREATE TABLE `parcels` (
|
||||
-- Tabel structuur voor tabel `parcelsales`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `parcelsales`;
|
||||
CREATE TABLE `parcelsales` (
|
||||
`regionUUID` varchar(255) NOT NULL,
|
||||
`parcelname` varchar(255) NOT NULL,
|
||||
@@ -157,7 +151,7 @@ CREATE TABLE `parcelsales` (
|
||||
`parentestate` int(11) NOT NULL default '1',
|
||||
`mature` varchar(32) NOT NULL default 'false',
|
||||
PRIMARY KEY (`regionUUID`,`parcelUUID`)
|
||||
) TYPE=InnoDB;
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
@@ -165,7 +159,6 @@ CREATE TABLE `parcelsales` (
|
||||
-- Tabel structuur voor tabel `popularplaces`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `popularplaces`;
|
||||
CREATE TABLE `popularplaces` (
|
||||
`parcelUUID` char(36) NOT NULL,
|
||||
`name` varchar(255) NOT NULL,
|
||||
@@ -173,7 +166,7 @@ CREATE TABLE `popularplaces` (
|
||||
`infoUUID` char(36) NOT NULL,
|
||||
`has_picture` tinyint(4) NOT NULL,
|
||||
`mature` tinyint(4) NOT NULL
|
||||
) TYPE=InnoDB;
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
@@ -181,7 +174,6 @@ CREATE TABLE `popularplaces` (
|
||||
-- Tabel structuur voor tabel `regions`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `regions`;
|
||||
CREATE TABLE `regions` (
|
||||
`regionname` varchar(255) NOT NULL,
|
||||
`regionuuid` varchar(255) NOT NULL,
|
||||
@@ -190,4 +182,4 @@ CREATE TABLE `regions` (
|
||||
`owner` varchar(255) NOT NULL,
|
||||
`owneruuid` varchar(255) NOT NULL,
|
||||
PRIMARY KEY (`regionuuid`)
|
||||
) TYPE=InnoDB;
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
ALTER TABLE `hostsregister` ADD `failcounter` INT( 1 ) NOT NULL ;
|
||||
Reference in New Issue
Block a user