Scotsman Site Admin
Joined: 03 Aug 2004 Posts: 705 Location: MadWolf Software
|
Posted: Sun Apr 10, 2005 5:57 pm Post subject: gate PHP |
|
|
Ok, here's the php to add to a gate RMD to display the top 5 most populated manors. It creates spots 16-20. You will probably need to make some adjustments for your needs. Don't forget to change the extension from RMD to PHP and don't use the room editor on the room or you will loose the php code.
Code: |
<?php
$db = mysql_connect('madwolfsw.com', 'carlm_external', 'WeBsTeR');
if ($db)
{
if (mysql_select_db('carlm_servers'))
{
$result = mysql_query("select sites.ID, sites.sitename,
UNIX_TIMESTAMP(now()) as servTime, UNIX_TIMESTAMP(lastUpdate) as lastUpdate, sites.population,
sites.imgURL, sites.URL, sites.revURL, sites.description, sites.profileURL, sites.isPlat
from carlm_servers.sites as sites
where date_add(sites.lastUpdate, interval 20 minute) >= now()
order by sites.population desc limit 5");
for ($site = 0; $site < mysql_num_rows($result); $site++)
{
$siteRow = mysql_fetch_object($result);
$rectTop = 100 + $site * 20;
$rectBottom = 120 + $site * 20;
$spotID = $site + 16;
echo "<spot id=".$spotID;
echo " poly=614,".$rectTop;
echo ":749,".$rectTop.":749,".$rectBottom.":614,".$rectBottom;
echo " pasg=\"".$siteRow->URL."\" title=\"".$siteRow->sitename." (".$siteRow->population." people)\"></spot>\n";
}
}
}
?>
|
|
|