Ive got a code worked out in php to connect to the server and make a cached list just like Ethans Xini parse. Im an not great in php so there is alot of errors in the connection to the sln and i just took out from the EoServ webcp and edited it into. It doesnt work at the current code i no forsure.
Current Site : Here
<?php
$seose = "C:\Users\Andrew\Desktop\Seose\\"
function OnlineCache($serverhost, $serverport) {
if (!file_exists('online.cache') || filemtime('online.cache')+$onlinecache < time())
{
$serverconn = @fsockopen($serverhost, $serverport, $errno, $errstr, 2.0);
$online = (bool)$serverconn;
$onlinelist = array();
if ($online)
{
$request_online = chr(5).chr(254).chr(1).chr(22).chr(254).chr(255);
fwrite($serverconn, $request_online);
$raw = fread($serverconn, 1024*256); // Read up to 256KB of data
fclose($serverconn);
$raw = substr($raw, 5); // length, ID, replycode
$chars = Number(ord($raw[0]), ord($raw[1])); $raw = substr($raw, 2); // Number of characters
$raw = substr($raw, 1); // separator
for ($i = 0; $i < $chars; ++$i)
{
$newchar = array(
'name' => '',
'title' => '',
'guild' => '',
);
$pos = strpos($raw, chr(255));
$newchar['name'] = substr($raw, 0, $pos);
$raw = substr($raw, $pos+1);
$pos = strpos($raw, chr(255));
$newchar['title'] = substr($raw, 0, $pos);
$raw = substr($raw, $pos+1);
$raw = substr($raw, 1); // ?
$newchar['guild'] = trim(substr($raw, 0, 3));
$raw = substr($raw, 3);
$raw = substr($raw, 1); // separator
$onlinelist[] = $newchar;
}
ksort($onlinelist);
file_put_contents('online.cache', serialize($onlinelist));
}
}
}
function CreateLine($Name, $Title, $Guild) {
$newpart = "<tr align=\"center\"><th>$index<td>$Name</td><td>$Title</td><td>$Guild</td></tr>";
$cache = fopen($seose."onlinecache.txt", "w+");
fwrite($cache,$newpart);
fclose($cache);
}
function GetList($Host, $Port) {
foreach($onlinelist as &$character)
$character['name'] = ucfirst($character['name']);
$character['title'] = empty($character['title'])?'-':ucfirst($character['title']);
$character['guild'] = "Guild Not Implemented Yet."
$NameTemp = $character['name']
$TitleTemp = $character['title']
$GuildTemp = $character['guild']
CreateLine($NameTemp, $TitleTemp, $GuildTemp)
}
unset($character);
characters = $onlinelist;
OnlineCache($Host, $Port)
$handle = fopen($seose."onlinecache.txt", "r");
$out = fread($handle,filesize($seose."onlinecache.txt"));
print "<table width=\"70%\" border=1 bordercolor=\"white\" cellpadding=\"0\" cellspacing=\"0\"><tr><th>Name<th>Title<th>Guild<th></tr>";
print "$out";
print "</table>";
fclose($handle);
}
print<<<eof
<html><head><link rel="stylesheet" type="text/css" href="styles.css"></head><body><center>
eof;
if($_GET['query'] == "getlist1") {
GetList('wildarena.no-ip.org', 8078);
}
if($_GET['query'] == "getlist2") {
GetList('wildarenah2.no-ip.org', 8078);
}
print "</center></body></html>";
?>
---
Andrewbob - I would be on the fucking copter of rofls
Programmer, Web Developer, and Graphics Designer