[1451] | 1 | <?php
|
---|
| 2 | include("config.php");
|
---|
| 3 |
|
---|
| 4 | $_GET['player'] = substr($_GET['player'],0,30);
|
---|
| 5 |
|
---|
| 6 | /* Determine if a Player was entered. If not, redirect. */
|
---|
| 7 | if ($_GET['player']=="") header('Location: http://'.$_SERVER['SERVER_NAME'].
|
---|
| 8 | ($_SERVER['SERVER_PORT']!=80?':'.$_SERVER['SERVER_PORT']:'').$BASEURL.
|
---|
| 9 | 'players.php');
|
---|
| 10 |
|
---|
| 11 | $irpg_page_title = "Joueur: " . htmlentities($_GET['player']);
|
---|
[4283] | 12 | $showmap = isset($_GET['showmap'])?$_GET['showmap']:false;
|
---|
| 13 | $allmods = isset($_GET['allmods'])?$_GET['allmods']:false;
|
---|
[1451] | 14 |
|
---|
| 15 | include("header.php");
|
---|
| 16 | include("commonfunctions.php");
|
---|
| 17 | echo "<h1>Fiche de personnage</h1>";
|
---|
| 18 | $file = fopen($irpg_db,"r");
|
---|
| 19 | fgets($file,1024); // skip top comment
|
---|
| 20 | $found=0;
|
---|
| 21 | while ($line=fgets($file,1024)) {
|
---|
| 22 | if (substr($line,0,strlen($_GET['player'])+1) == $_GET['player']."\t") {
|
---|
| 23 | list($user,,$isadmin,$level,$class,$secs,,$uhost,$online,$idled,
|
---|
| 24 | $x,$y,
|
---|
| 25 | $pen['mesg'],
|
---|
| 26 | $pen['nick'],
|
---|
| 27 | $pen['part'],
|
---|
| 28 | $pen['kick'],
|
---|
| 29 | $pen['quit'],
|
---|
| 30 | $pen['quest'],
|
---|
| 31 | $pen['logout'],
|
---|
| 32 | $created,
|
---|
| 33 | $lastlogin,
|
---|
| 34 | $item['amulet'],
|
---|
| 35 | $item['charm'],
|
---|
| 36 | $item['helm'],
|
---|
| 37 | $item['boots'],
|
---|
| 38 | $item['gloves'],
|
---|
| 39 | $item['ring'],
|
---|
| 40 | $item['leggings'],
|
---|
| 41 | $item['shield'],
|
---|
| 42 | $item['tunic'],
|
---|
| 43 | $item['weapon'],
|
---|
| 44 | $alignment,
|
---|
| 45 | ) = explode("\t",trim($line));
|
---|
| 46 | $found=1;
|
---|
| 47 | break;
|
---|
| 48 | }
|
---|
| 49 | }
|
---|
| 50 | if (!$found) echo "<h1>Erreur</h1><p><b>Utilisateur inconnu.</b></p>\n";
|
---|
| 51 | else {
|
---|
| 52 | $class=htmlentities($class);
|
---|
| 53 | /* if we htmlentities($user), then we cannot use links with it. */
|
---|
| 54 | echo " <p><b>Pseudo :</b> ".htmlentities($user)."<br />\n".
|
---|
| 55 | " <b>Profession :</b> $class<br />\n".
|
---|
| 56 | " <b>Admin ? :</b> ".($isadmin?"Oui":"Non")."<br />\n".
|
---|
| 57 | " <b>Niveau :</b> $level<br />\n".
|
---|
| 58 | " <b>Prochain niveau :</b> ".duration($secs)."<br />\n".
|
---|
| 59 | " <b>Statut :</b> ".($online?"C":"Déc")."onnecté<br />\n".
|
---|
| 60 | " <b>Host :</b> ".($uhost?$uhost:"Unknown")."<br />\n".
|
---|
[1563] | 61 | " <b>Date de création :</b> ".htmlentities(strftime($dateformat,$created))."<br />\n".
|
---|
| 62 | " <b>Dernière connexion :</b> ".htmlentities(strftime($dateformat,$lastlogin))."<br />\n".
|
---|
[1462] | 63 | " <b>Temps d'inactivité total:</b> ".duration($idled)."<br />\n".
|
---|
[1451] | 64 | " <b>Position :</b> [$x,$y]<br />\n".
|
---|
| 65 | " <b>Coté :</b> ".($alignment=='e'?"Sadique":($alignment=='n'?"Nain-déci":"Brave"))."<br />\n".
|
---|
[1456] | 66 | " <b>XML :</b> [<a href=\"xml.php?player=".urlencode($user)."\">link</a>]</p>\n".
|
---|
[1451] | 67 | " <h2>Carte</h2>\n".
|
---|
| 68 | " ".($showmap?"<div id=\"map\"><img src=\"makemap.php?player=".urlencode($user)."\"></div>\n\n":"<p><a href=\"?player=".urlencode($user)."&showmap=1\">Voir la carte</a></p>\n\n")."".
|
---|
| 69 | " <h2>Equipement</h2>\n<p>";
|
---|
| 70 | ksort($item);
|
---|
| 71 | $sum = 0;
|
---|
| 72 | foreach ($item_order as $key) {
|
---|
| 73 | $val = $item[$key];
|
---|
| 74 | $uniquecolor="#be9256";
|
---|
| 75 | if ($key == "helm" && substr($val,-1,1) == "a") {
|
---|
[1465] | 76 | $val = intval($val)." [<font color=\"$uniquecolor\">".htmlentities(ucfirst(gettext("Mattt's Omniscience Grand Crown")))."</font>]";
|
---|
[1451] | 77 | }
|
---|
| 78 | if ($key == "tunic" && substr($val,-1,1) == "b") {
|
---|
[1466] | 79 | $val = intval($val)." [<font color=\"$uniquecolor\">".htmlentities(ucfirst(gettext("Res0's Protectorate Plate Mail")))."</font>]";
|
---|
[1451] | 80 | }
|
---|
| 81 | if ($key == "amulet" && substr($val,-1,1) == "c") {
|
---|
[1466] | 82 | $val = intval($val)." [<font color=\"$uniquecolor\">".htmlentities(ucfirst(gettext("Dwyn's Storm Magic Amulet")))."</font>]";
|
---|
[1451] | 83 | }
|
---|
| 84 | if ($key == "weapon" && substr($val,-1,1) == "d") {
|
---|
[1466] | 85 | $val = intval($val)." [<font color=\"$uniquecolor\">".htmlentities(ucfirst(gettext("Jotun's Fury Colossal Sword")))."</font>]";
|
---|
[1451] | 86 | }
|
---|
| 87 | if ($key == "weapon" && substr($val,-1,1) == "e") {
|
---|
[1466] | 88 | $val = intval($val)." [<font color=\"$uniquecolor\">".htmlentities(ucfirst(gettext("Drdink's Cane of Blind Rage")))."</font>]";
|
---|
[1451] | 89 | }
|
---|
| 90 | if ($key == "boots" && substr($val,-1,1) == "f") {
|
---|
[1466] | 91 | $val = intval($val)." [<font color=\"$uniquecolor\">".htmlentities(ucfirst(gettext("Mrquick's Magical Boots of Swiftness")))."</font>]";
|
---|
[1451] | 92 | }
|
---|
| 93 | if ($key == "weapon" && substr($val,-1,1) == "g") {
|
---|
[1466] | 94 | $val = intval($val)." [<font color=\"$uniquecolor\">".htmlentities(ucfirst(gettext("Jeff's Cluehammer of Doom")))."</font>]";
|
---|
[1451] | 95 | }
|
---|
| 96 | if ($key == "ring" && substr($val,-1,1) == "h") {
|
---|
[1466] | 97 | $val = intval($val)." [<font color=\"$uniquecolor\">".htmlentities(ucfirst(gettext("Juliet's Glorious Ring of Sparkliness")))."</font>]";
|
---|
[1451] | 98 | }
|
---|
| 99 | echo " ".htmlentities(ucfirst(gettext($key)))." : $val<br />\n";
|
---|
| 100 | $sum += $val;
|
---|
| 101 | }
|
---|
[1456] | 102 | echo " <br />\n Somme : $sum<br />\n".
|
---|
[1451] | 103 | " </p>".
|
---|
| 104 | " <h2>Pénalités</h2>\n".
|
---|
| 105 | " <p>\n";
|
---|
| 106 |
|
---|
| 107 | ksort($pen);
|
---|
| 108 | $sum = 0;
|
---|
| 109 | foreach ($pen as $key => $val) {
|
---|
[1457] | 110 | echo " ".ucfirst($key)." : ".duration($val)."<br />\n";
|
---|
[1451] | 111 | $sum += $val;
|
---|
| 112 | }
|
---|
[1456] | 113 | echo " <br />\n Total : ".duration($sum)."</p>\n";
|
---|
[1451] | 114 |
|
---|
| 115 | $file = fopen($irpg_mod,"r");
|
---|
| 116 | $temp = array();
|
---|
| 117 | while ($line=fgets($file,1024)) {
|
---|
| 118 | if (strstr($line," ".$_GET['player']." ") ||
|
---|
| 119 | strstr($line," ".$_GET['player'].", ") ||
|
---|
| 120 | substr($line,0,strlen($_GET['player'])+1) ==
|
---|
| 121 | $_GET['player']." " ||
|
---|
| 122 | substr($line,0,strlen($_GET['player'])+3) ==
|
---|
| 123 | $_GET['player']."'s ") {
|
---|
| 124 | array_push($temp,$line);
|
---|
| 125 | }
|
---|
| 126 | }
|
---|
| 127 | fclose($file);
|
---|
| 128 | if (!is_null($temp) && count($temp)) {
|
---|
| 129 | echo('<h2>');
|
---|
[4283] | 130 | echo (!$allmods)?"Dernières ":"";
|
---|
[1451] | 131 | echo('Modifications d\'Horlorge</h2><p>');
|
---|
[4283] | 132 | if ($allmods == 1 || count($temp) < 6) {
|
---|
[1451] | 133 | foreach ($temp as $line) {
|
---|
| 134 | $line=htmlentities(trim($line));
|
---|
| 135 | echo " $line<br />\n";
|
---|
| 136 | }
|
---|
| 137 | echo " <br />\n";
|
---|
| 138 | }
|
---|
| 139 | else {
|
---|
| 140 | end($temp);
|
---|
| 141 | for ($i=0;$i<4;++$i) prev($temp);
|
---|
| 142 | for ($line=trim(current($temp));$line;$line=trim(next($temp))) {
|
---|
| 143 | $line=htmlentities(trim($line));
|
---|
| 144 | echo " $line<br />\n";
|
---|
| 145 | }
|
---|
| 146 | }
|
---|
| 147 | }
|
---|
[4283] | 148 | if ($allmods != 1 && count($temp) > 5) {
|
---|
[1451] | 149 | ?>
|
---|
| 150 | <br />
|
---|
[4283] | 151 | [<a href="<?php echo $_SERVER['PHP_SELF']."?player=".urlencode($user);?>&allmods=1">Voir toutes les modifications</a> (<?php echo count($temp)?>)]
|
---|
[1451] | 152 | </p>
|
---|
| 153 | <?php
|
---|
| 154 | }
|
---|
| 155 | }
|
---|
| 156 | include("footer.php");
|
---|
| 157 | ?>
|
---|
| 158 |
|
---|