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