source: irpg/trunk/htdocs/playerview.php@ 5413

Last change on this file since 5413 was 4283, checked in by Daimonos Tereutes, 14 years ago

suppression des shortopentags

File size: 7.2 KB
Line 
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 = isset($_GET['showmap'])?$_GET['showmap']:false;
13 $allmods = isset($_GET['allmods'])?$_GET['allmods']:false;
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&eacute;c")."onnect&eacute;<br />\n".
60 " <b>Host :</b> ".($uhost?$uhost:"Unknown")."<br />\n".
61 " <b>Date de cr&eacute;ation :</b> ".htmlentities(strftime($dateformat,$created))."<br />\n".
62 " <b>Derni&egrave;re connexion :</b> ".htmlentities(strftime($dateformat,$lastlogin))."<br />\n".
63 " <b>Temps d'inactivit&eacute; total:</b> ".duration($idled)."<br />\n".
64 " <b>Position :</b> [$x,$y]<br />\n".
65 " <b>Cot&eacute; :</b> ".($alignment=='e'?"Sadique":($alignment=='n'?"Nain-d&eacute;ci":"Brave"))."<br />\n".
66 " <b>XML :</b> [<a href=\"xml.php?player=".urlencode($user)."\">link</a>]</p>\n".
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") {
76 $val = intval($val)." [<font color=\"$uniquecolor\">".htmlentities(ucfirst(gettext("Mattt's Omniscience Grand Crown")))."</font>]";
77 }
78 if ($key == "tunic" && substr($val,-1,1) == "b") {
79 $val = intval($val)." [<font color=\"$uniquecolor\">".htmlentities(ucfirst(gettext("Res0's Protectorate Plate Mail")))."</font>]";
80 }
81 if ($key == "amulet" && substr($val,-1,1) == "c") {
82 $val = intval($val)." [<font color=\"$uniquecolor\">".htmlentities(ucfirst(gettext("Dwyn's Storm Magic Amulet")))."</font>]";
83 }
84 if ($key == "weapon" && substr($val,-1,1) == "d") {
85 $val = intval($val)." [<font color=\"$uniquecolor\">".htmlentities(ucfirst(gettext("Jotun's Fury Colossal Sword")))."</font>]";
86 }
87 if ($key == "weapon" && substr($val,-1,1) == "e") {
88 $val = intval($val)." [<font color=\"$uniquecolor\">".htmlentities(ucfirst(gettext("Drdink's Cane of Blind Rage")))."</font>]";
89 }
90 if ($key == "boots" && substr($val,-1,1) == "f") {
91 $val = intval($val)." [<font color=\"$uniquecolor\">".htmlentities(ucfirst(gettext("Mrquick's Magical Boots of Swiftness")))."</font>]";
92 }
93 if ($key == "weapon" && substr($val,-1,1) == "g") {
94 $val = intval($val)." [<font color=\"$uniquecolor\">".htmlentities(ucfirst(gettext("Jeff's Cluehammer of Doom")))."</font>]";
95 }
96 if ($key == "ring" && substr($val,-1,1) == "h") {
97 $val = intval($val)." [<font color=\"$uniquecolor\">".htmlentities(ucfirst(gettext("Juliet's Glorious Ring of Sparkliness")))."</font>]";
98 }
99 echo " ".htmlentities(ucfirst(gettext($key)))." : $val<br />\n";
100 $sum += $val;
101 }
102 echo " <br />\n Somme : $sum<br />\n".
103 " </p>".
104 " <h2>P&eacute;nalit&eacute;s</h2>\n".
105 " <p>\n";
106
107 ksort($pen);
108 $sum = 0;
109 foreach ($pen as $key => $val) {
110 echo " ".ucfirst($key)." : ".duration($val)."<br />\n";
111 $sum += $val;
112 }
113 echo " <br />\n Total : ".duration($sum)."</p>\n";
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>');
130 echo (!$allmods)?"Derni&egrave;res ":"";
131 echo('Modifications d\'Horlorge</h2><p>');
132 if ($allmods == 1 || count($temp) < 6) {
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 }
148 if ($allmods != 1 && count($temp) > 5) {
149?>
150 <br />
151 [<a href="<?php echo $_SERVER['PHP_SELF']."?player=".urlencode($user);?>&amp;allmods=1">Voir toutes les modifications</a> (<?php echo count($temp)?>)]
152 </p>
153<?php
154 }
155 }
156 include("footer.php");
157?>
158
Note: See TracBrowser for help on using the repository browser.