1 | <?php
|
---|
2 |
|
---|
3 | header("Content-Type: text/xml");
|
---|
4 | header("Pragma: no-cache");
|
---|
5 |
|
---|
6 | include("config.php");
|
---|
7 |
|
---|
8 | $_GET['player'] = substr($_GET['player'],0,30);
|
---|
9 |
|
---|
10 | /* Determine if a Player was entered. If not, redirect. */
|
---|
11 | if ($_GET['player']=="") header('Location: http://'.$_SERVER['SERVER_NAME'].
|
---|
12 | ($_SERVER['SERVER_PORT']!=80?':'.$_SERVER['SERVER_PORT']:'').$BASEURL.
|
---|
13 | 'players.php');
|
---|
14 |
|
---|
15 | $file = fopen($irpg_db,"r");
|
---|
16 | fgets($file,1024); // skip top comment
|
---|
17 |
|
---|
18 | while ($line=fgets($file,1024)) {
|
---|
19 | if (substr($line,0,strlen($_GET['player'])+1) == $_GET['player']."\t") {
|
---|
20 | list($user,,$isadmin,$level,$class,$secs,,$uhost,$online,$idled,
|
---|
21 | $x,$y,
|
---|
22 | $pen['mesg'],
|
---|
23 | $pen['nick'],
|
---|
24 | $pen['part'],
|
---|
25 | $pen['kick'],
|
---|
26 | $pen['quit'],
|
---|
27 | $pen['quest'],
|
---|
28 | $pen['logout'],
|
---|
29 | $created,
|
---|
30 | $lastlogin,
|
---|
31 | $item['amulet'],
|
---|
32 | $item['charm'],
|
---|
33 | $item['helm'],
|
---|
34 | $item['boots'],
|
---|
35 | $item['gloves'],
|
---|
36 | $item['ring'],
|
---|
37 | $item['leggings'],
|
---|
38 | $item['shield'],
|
---|
39 | $item['tunic'],
|
---|
40 | $item['weapon'],
|
---|
41 | $alignment,
|
---|
42 | ) = explode("\t",trim($line));
|
---|
43 | break;
|
---|
44 | }
|
---|
45 | }
|
---|
46 | fclose($file);
|
---|
47 | echo "<?xml version=\"1.0\"?>";
|
---|
48 | ?>
|
---|
49 |
|
---|
50 | <player>
|
---|
51 | <username><?php print $user?></username>
|
---|
52 | <isadmin><?php print $isadmin?></isadmin>
|
---|
53 | <level><?php print $level?></level>
|
---|
54 | <class><?php print $class?></class>
|
---|
55 | <ttl><?php print $secs?></ttl>
|
---|
56 | <userhost><?php print $uhost?></userhost>
|
---|
57 | <online><?php print $online?></online>
|
---|
58 | <totalidled><?php print $idled?></totalidled>
|
---|
59 | <xpos><?php print $x?></xpos>
|
---|
60 | <ypos><?php print $y?></ypos>
|
---|
61 | <alignment><?php print $alignment?></alignment>
|
---|
62 | <penalties>
|
---|
63 | <?php
|
---|
64 | $sum=0;
|
---|
65 | foreach ($pen as $key => $val) {
|
---|
66 | echo " <$key>$val</$key>\n";
|
---|
67 | $sum += $val;
|
---|
68 | }
|
---|
69 | echo " <total>$sum</total>\n";
|
---|
70 | ?>
|
---|
71 | </penalties>
|
---|
72 | <items>
|
---|
73 | <?php
|
---|
74 | $sum=0;
|
---|
75 | foreach ($item as $key => $val) {
|
---|
76 | echo " <$key>$val</$key>\n";
|
---|
77 | $sum += $val;
|
---|
78 | }
|
---|
79 | echo " <total>$sum</total>\n";
|
---|
80 | ?>
|
---|
81 | </items>
|
---|
82 | </player>
|
---|