This commit is contained in:
2025-09-15 16:30:24 -06:00
parent a4ff18076a
commit 6e23de8f12
61 changed files with 1103 additions and 687 deletions

76
irpg-web/xml.php Normal file
View File

@@ -0,0 +1,76 @@
<?php
header("Content-Type: text/xml");
header("Pragma: no-cache");
include("config.php");
/* Determine if a Player was entered. If not, redirect. */
$_GET['player'] = substr($_GET['player'],0,30);
if ($_GET['player']=="") header('Location: '.$irpg_base_dir.'players.php');
$file = fopen($irpg_db,"r");
fgets($file,1024); // skip top comment
while ($line=fgets($file,1024)) {
if (substr($line,0,strlen($_GET['player'])+1) == $_GET['player']."\t") {
list($user,,$isadmin,$level,$class,$secs,,$uhost,$online,$idled,
$x,$y,
$pen['mesg'],
$pen['nick'],
$pen['part'],
$pen['kick'],
$pen['quit'],
$pen['quest'],
$pen['logout'],
$created,
$lastlogin,
$item['amulet'],
$item['charm'],
$item['helm'],
$item['boots'],
$item['gloves'],
$item['ring'],
$item['leggings'],
$item['shield'],
$item['tunic'],
$item['weapon'],
$alignment,
) = explode("\t",trim($line));
break;
}
}
fclose($file);
echo "<?xml version=\"1.0\"?>";
?>
<player>
<username><?php echo $user; ?></username>
<isadmin><?php echo $isadmin; ?></isadmin>
<level><?php echo $level; ?></level>
<class><?php echo $class; ?></class>
<ttl><?php echo $secs; ?></ttl>
<userhost><?php echo $uhost; ?></userhost>
<online><?php echo $online; ?></online>
<totalidled><?php echo $idled; ?></totalidled>
<xpos><?php echo $x; ?></xpos>
<ypos><?php echo $y; ?></ypos>
<alignment><?php echo $alignment; ?></alignment>
<penalties>
<?php
$sum=0;
foreach ($pen as $key => $val) {
echo " <$key>$val</$key>\n";
$sum += $val;
}
echo " <total>$sum</total>\n";
?>
</penalties>
<items>
<?php
$sum=0;
foreach ($item as $key => $val) {
echo " <$key>$val</$key>\n";
$sum += $val;
}
echo " <total>$sum</total>\n";
?>
</items>
</player>