]> jfr.im git - irc/gameservirc.git/blob - gameserv/php/displayplayers.php
More exciting additions to FilePlayerDAO!
[irc/gameservirc.git] / gameserv / php / displayplayers.php
1 <?php
2 include ('config.php');
3
4 if ($regenerate == true)
5 {
6 // Read the players.dat every time if specified in the config.php
7 include ('readplayers.php');
8 }
9
10 // This is just an example of how to display the player data in a nice table format
11 include ('mysql.php');
12
13 $query = "select p.name as name, level, exp, gold, bank, hp, maxhp, strength, defense, forestfights, playerfights, lastlogin, i.name as weapon, i2.name as armor from $playertablename as p, $itemtablename as i, $itemtablename as i2 where weaponID = i.id and armorID = i2.id";
14
15 $results = mysql_query($query) or die("Couldn't execute query: " . mysql_error());
16
17 echo "<table><tr><th>Name</th><th>Level</th><th>Experience</th><th>Gold</th><th>Bank Balance</th><th>HP</th><th>Forest Fights Left</th><th>Player Fights Left</th><th>Last Logged In</th><th>Weapon</th><th>Armor</th></tr>\n";
18 while ($result = mysql_fetch_array($results))
19 {
20 $name = $result['name'];
21 $level = $result['level'];
22 $exp = $result['exp'];
23 $gold = $result['gold'];
24 $bank = $result['bank'];
25 $hp = $result['hp'];
26 $maxhp = $result['maxhp'];
27 $strength = $result['strength'];
28 $defense = $result['defense'];
29 $forestfights = $result['forestfights'];
30 $playerfights = $results['playerfights'];
31 $lastlogin = date($results['lastlogin']);
32 $weapon = $results['weapon'];
33 $armor = $results['armor'];
34
35 echo "<tr>";
36 echo "<td>" . $name . "</td>";
37 echo "<td>" . $level . "</td>";
38 echo "<td>" . $exp . "</td>";
39 echo "<td>" . $gold . "</td>";
40 echo "<td>" . $bank . "</td>";
41 echo "<td>" . $hp . " of " . $maxhp . "</td>";
42 echo "<td>" . $strength . "</td>";
43 echo "<td>" . $defense . "</td>";
44 echo "<td>" . $forestfights . "</td>";
45 echo "<td>" . $playerfights . "</td>";
46 echo "<td>" . $lastlogin . "</td>";
47 echo "<td>" . $weapon . "</td>";
48 echo "<td>" . $armor . "</td>";
49 echo "</tr>" . "\n";
50 }
51 mysql_close($link);
52 echo "</table>\n";
53 ?>