8 # Displays a web page showing the stats for one player, displaying
9 # a picture, mail address and web page.
11 # Copyright (C) 2001 Andreas Ulbrich, Ralf Ertzinger (ndccode@ndc.sh)
13 # This program is free software; you can redistribute it and/or modify
14 # it under the terms of the GNU General Public License as published by
15 # the Free Software Foundation; either version 2 of the License, or
16 # (at your option) any later version.
18 # This program is distributed in the hope that it will be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 # GNU General Public License for more details.
23 # You should have received a copy of the GNU General Public License
24 # along with this program; if not, write to the Free Software
25 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
36 $picturepath = 'http://www.ndc.sh/graphics/playerdb/';
37 $nick = $CGIquery->param("nick");
39 # Define SQL-Variables
41 $sql_database = "stats";
42 $sql_datasource = "DBI:mysql:$sql_database";
45 $sql_db_handle = DBI->connect($sql_datasource, $sql_username, $sql_password) or die "Could not connect to database.\n";
48 print "Content-Type: text/html\n\n\n";
50 # Retrieve player data from SQL
52 $sql_query_string = "SELECT nick, email, picture, homepage, kills, victims, suicides, mapsplayed, mapswon, FPH, skill, time, skill_top, fe_skill, fe_kills, fe_victims, fe_suicides, fe_mapsplayed, fe_mapswon, fe_fph, fe_time, fe_rank, date_format(LastSeen, '%d.%m.%Y') as date_europe FROM PlayerStats WHERE nick=?";
53 $sql_query = $sql_db_handle->prepare($sql_query_string);
54 $sql_query->execute($nick);
56 $sql_row = $sql_query->fetchrow_hashref;
58 $pl_name = $sql_row->{nick};
59 $pl_email = $sql_row->{email};
60 $pl_picture = $picturepath . $sql_row->{picture};
61 $pl_homepage = $sql_row->{homepage};
62 $pl_kills = $sql_row->{kills};
63 $pl_victims = $sql_row->{victims};
64 $pl_suicides = $sql_row->{suicides};
65 $pl_fph = $sql_row->{FPH};
66 $pl_skill = $sql_row->{skill};
67 $pl_time = $sql_row->{time};
68 $pl_maps_played = $sql_row->{mapsplayed};
69 $pl_maps_won = $sql_row->{mapswon};
70 $pl_fe_kills = $sql_row->{fe_kills};
71 $pl_fe_victims = $sql_row->{fe_victims};
72 $pl_fe_suicides = $sql_row->{fe_suicides};
73 $pl_fe_maps_played= $sql_row->{fe_mapsplayed};
74 $pl_fe_maps_won = $sql_row->{fe_mapswon};
75 $pl_fe_skill = $sql_row->{fe_skill};
76 $pl_fe_fph = $sql_row->{fe_fph};
77 $pl_fe_time = $sql_row->{fe_time};
78 $pl_skill_top = $sql_row->{skill_top};
79 $pl_fe_rank = $sql_row->{fe_rank};
80 $pl_lastseen = $sql_row->{date_europe};
84 $sql_db_handle->disconnect;
88 print '<HTML><HEAD><TITLE>NDC Spielerdaten</TITLE>';
89 print '<META NAME="Andreas Ulbrich">';
90 print '</HEAD><BODY BGCOLOR="#FFFFFF">';
91 print "\n<CENTER><img SRC=\"http:\/\/www.ndc.sh\/graphics\/aktuell_logo.jpg\" WIDTH=\"300\" HEIGHT=\"90\" BORDER=\"0\"ALT=\"\[SERVER Status\]\"><\/CENTER>\n";
92 print "\ \;<P>\n";
93 if (defined($eingabe{showquery})) {
96 print "$sql_query_string\n";
99 print "<UL><table BORDER=\"0\">\n";
101 print "<td WIDTH=\"270\" ALIGN=\"CENTER\" BGCOLOR=\"\#FFFFCC\"><b>Spielerdaten<\/b><\/td>\n";
102 print "<\/TABLE><\/UL>\n";
104 if (defined($pl_name)) {
105 print "<UL><table BORDER=\"0\">\n";
107 print "<td ROWSPAN=\"10\" VALIGN=\"TOP\"><img src \=\"$pl_picture\" WIDTH=\"186\" HEIGHT=\"300\" BORDER=\"0\"><\/td>";
108 print "<td WIDTH=\"120\" BGCOLOR=\"\#CCCCCC\">Nickname:<\/td>";
109 print "<td WIDTH=\"200\" BGCOLOR=\"\#EEEEEE\"><b>" . make_html($pl_name) . "<\/b><\/td>\n";
113 print "<td BGCOLOR=\"#CCCCCC\">email:<\/td>";
114 if ($pl_email ne "") {
115 print "<td BGCOLOR=\"#EEEEEE\"><b><a href=\"mailto:$pl_email\">$pl_email<\/a><\/b><\/td>\n";
117 print "<td BGCOLOR=\"#EEEEEE\"><b>-<\/b><\/td>\n";
122 print "<td BGCOLOR=\"#CCCCCC\">Homepage:<\/td>";
123 if ($pl_homepage ne "") {
124 print "<td BGCOLOR=\"#EEEEEE\"><b><a href=\"$pl_homepage\" TARGET=\"xxyyzz\">$pl_homepage<\/a><\/b><\/td>\n";
126 print "<td BGCOLOR=\"#EEEEEE\"><b>-<\/b><\/td>\n";
131 print "<td BGCOLOR=\"#CCCCCC\">Kills:<\/td>";
132 print "<td BGCOLOR=\"#EEEEEE\"><b>$pl_fe_kills<\/b><\/td>\n";
136 print "<td BGCOLOR=\"#CCCCCC\">Victims:<\/td>";
137 print "<td BGCOLOR=\"#EEEEEE\"><b>$pl_fe_victims<\/b><\/td>\n";
141 print "<td BGCOLOR=\"#CCCCCC\">Suicides:<\/td>";
142 print "<td BGCOLOR=\"#EEEEEE\"><b>$pl_fe_suicides<\/b><\/td>\n";
146 print "<td BGCOLOR=\"#CCCCCC\">Skill:<\/td>";
147 print "<td BGCOLOR=\"#EEEEEE\"><b>$pl_fe_skill<\/b><\/td>\n";
151 print "<td BGCOLOR=\"#CCCCCC\">Höchster Skill:<\/td>";
152 print "<td BGCOLOR=\"#EEEEEE\"><b>$pl_skill_top<\/b><\/td>\n";
156 print "<td BGCOLOR=\"#CCCCCC\">Rang:<\/td>";
157 if ($pl_fe_rank != 0) {
158 print "<td BGCOLOR=\"#EEEEEE\"><b>$pl_fe_rank<\/b><\/td>\n";
160 print "<td BGCOLOR=\"#EEEEEE\"><b>-<\/b><\/td>\n";
165 print "<td BGCOLOR=\"#CCCCCC\">Zuletzt gespielt:<\/td>";
166 print "<td BGCOLOR=\"#EEEEEE\"><b>$pl_lastseen<\/b><\/td>\n";
169 print "<\/TABLE><\/UL>\n";
171 print "<P> <P>\n";
172 print "<UL><b>Gestern<\/b><br>\n";
173 print "<TABLE border=\"0\">\n";
175 print "<td ALIGN=\"CENTER\" BGCOLOR=\"#FFFFCC\" WIDTH=\"100\">Map<\/td>\n";
176 print "<td ALIGN=\"CENTER\" BGCOLOR=\"#FFFFCC\" WIDTH=\"50\">Skill<\/td>\n";
177 print "<td ALIGN=\"CENTER\" BGCOLOR=\"#FFFFCC\" WIDTH=\"50\">FPH<\/td>\n";
178 print "<td ALIGN=\"CENTER\" BGCOLOR=\"#FFFFCC\" WIDTH=\"50\">Maps gespielt<\/td>\n";
179 print "<td ALIGN=\"CENTER\" BGCOLOR=\"#FFFFCC\" WIDTH=\"50\">Maps gewonnen<\/td>\n";
180 print "<td ALIGN=\"CENTER\" BGCOLOR=\"#FFFFCC\" WIDTH=\"50\">Kills<\/td>\n";
181 print "<td ALIGN=\"CENTER\" BGCOLOR=\"#FFFFCC\" WIDTH=\"50\">Victims<\/td>\n";
182 print "<td ALIGN=\"CENTER\" BGCOLOR=\"#FFFFCC\" WIDTH=\"50\">Suicides<\/td>\n";
183 print "<td ALIGN=\"CENTER\" BGCOLOR=\"#FFFFCC\" WIDTH=\"50\">Zeit (Min)<\/td>\n";
186 if ($pl_maps_played > 0) {
189 print "<td ALIGN=\"CENTER\" BGCOLOR=\"#CCCCCC\">Total<\/td>\n";
190 print "<td ALIGN=\"CENTER\" BGCOLOR=\"#EEEEEE\">$pl_skill<\/td>\n";
191 print "<td ALIGN=\"CENTER\" BGCOLOR=\"#EEEEEE\">$pl_fph<\/td>\n";
192 print "<td ALIGN=\"CENTER\" BGCOLOR=\"#EEEEEE\">$pl_maps_played<\/td>\n";
193 print "<td ALIGN=\"CENTER\" BGCOLOR=\"#EEEEEE\">$pl_maps_won<\/td>\n";
194 print "<td ALIGN=\"CENTER\" BGCOLOR=\"#EEEEEE\">$pl_kills<\/td>\n";
195 print "<td ALIGN=\"CENTER\" BGCOLOR=\"#EEEEEE\">$pl_victims<\/td>\n";
196 print "<td ALIGN=\"CENTER\" BGCOLOR=\"#EEEEEE\">$pl_suicides<\/td>\n";
197 print "<td ALIGN=\"CENTER\" BGCOLOR=\"#EEEEEE\">$pl_time<\/td>\n";
203 print "<td ALIGN=\"CENTER\" BGCOLOR=\"#CCCCCC\">Total<\/td>\n";
204 print "<td ALIGN=\"CENTER\" BGCOLOR=\"#EEEEEE\">-<\/td>\n";
205 print "<td ALIGN=\"CENTER\" BGCOLOR=\"#EEEEEE\">-<\/td>\n";
206 print "<td ALIGN=\"CENTER\" BGCOLOR=\"#EEEEEE\">-<\/td>\n";
207 print "<td ALIGN=\"CENTER\" BGCOLOR=\"#EEEEEE\">-<\/td>\n";
208 print "<td ALIGN=\"CENTER\" BGCOLOR=\"#EEEEEE\">-<\/td>\n";
209 print "<td ALIGN=\"CENTER\" BGCOLOR=\"#EEEEEE\">-<\/td>\n";
210 print "<td ALIGN=\"CENTER\" BGCOLOR=\"#EEEEEE\">-<\/td>\n";
211 print "<td ALIGN=\"CENTER\" BGCOLOR=\"#EEEEEE\">-<\/td>\n";
216 print "<\/TABLE><\/UL>\n";
219 print "<P> <P>\n";
220 print "<UL><b>Gesamt<\/b><br>\n";
221 print "<TABLE border=\"0\">\n";
223 print "<td ALIGN=\"CENTER\" BGCOLOR=\"#FFFFCC\" WIDTH=\"100\">Map<\/td>\n";
224 print "<td ALIGN=\"CENTER\" BGCOLOR=\"#FFFFCC\" WIDTH=\"50\">Skill<\/td>\n";
225 print "<td ALIGN=\"CENTER\" BGCOLOR=\"#FFFFCC\" WIDTH=\"50\">FPH<\/td>\n";
226 print "<td ALIGN=\"CENTER\" BGCOLOR=\"#FFFFCC\" WIDTH=\"50\">Maps gespielt<\/td>\n";
227 print "<td ALIGN=\"CENTER\" BGCOLOR=\"#FFFFCC\" WIDTH=\"50\">Maps gewonnen<\/td>\n";
228 print "<td ALIGN=\"CENTER\" BGCOLOR=\"#FFFFCC\" WIDTH=\"50\">Kills<\/td>\n";
229 print "<td ALIGN=\"CENTER\" BGCOLOR=\"#FFFFCC\" WIDTH=\"50\">Victims<\/td>\n";
230 print "<td ALIGN=\"CENTER\" BGCOLOR=\"#FFFFCC\" WIDTH=\"50\">Suicides<\/td>\n";
231 print "<td ALIGN=\"CENTER\" BGCOLOR=\"#FFFFCC\" WIDTH=\"50\">Zeit (Min)<\/td>\n";
236 print "<td ALIGN=\"CENTER\" BGCOLOR=\"#CCCCCC\">Total<\/td>\n";
237 print "<td ALIGN=\"CENTER\" BGCOLOR=\"#EEEEEE\">$pl_fe_skill<\/td>\n";
238 print "<td ALIGN=\"CENTER\" BGCOLOR=\"#EEEEEE\">$pl_fe_fph<\/td>\n";
239 print "<td ALIGN=\"CENTER\" BGCOLOR=\"#EEEEEE\">$pl_fe_maps_played<\/td>\n";
240 print "<td ALIGN=\"CENTER\" BGCOLOR=\"#EEEEEE\">$pl_fe_maps_won<\/td>\n";
241 print "<td ALIGN=\"CENTER\" BGCOLOR=\"#EEEEEE\">$pl_fe_kills<\/td>\n";
242 print "<td ALIGN=\"CENTER\" BGCOLOR=\"#EEEEEE\">$pl_fe_victims<\/td>\n";
243 print "<td ALIGN=\"CENTER\" BGCOLOR=\"#EEEEEE\">$pl_fe_suicides<\/td>\n";
244 print "<td ALIGN=\"CENTER\" BGCOLOR=\"#EEEEEE\">$pl_fe_time<\/td>\n";
247 print "<\/TABLE><\/UL>\n";
249 print "<P> <P>\n";
250 print "<UL>Suche bei <a href=\"http\:\/\/www.theclq.com\/asp\/find.asp\?name=";
251 print make_compatible($pl_name);
252 print "\" TARGET=\"_blank\">The CLQ<\/a><\/ul>\n";
257 print "<ul>Es wurde kein Spieler dieses Namens in der Datenbank gefunden.</ul>\n";
261 print "<P><FONT SIZE=\"-2\"><DIV ALIGN=right>Skripting by NDC Code<BR><A href=\"http://www.ndc.sh\" target=\"_top\">www.ndc.sh</A></DIV></FONT><BR>\n";
263 print '</BODY></HTML>';
266 ####### Subroutines #####
271 # $input =~ s/&/und/g;
272 $input =~ s/</<\;/g;
273 $input =~ s/>/>\;/g;
274 $input =~ s/"/"\;/g;
275 $input =~ s/\x1c/·/g;
276 # $input =~ s/\|/pipe/g;
280 sub make_compatible {
284 $input =~ s/\+/%2B/g;
290 $input =~ s/\[/%5B/g;
291 $input =~ s/\]/%5D/g;
292 $input =~ s/\//%2F/g;
293 $input =~ s/\|/%7C/g;
294 $input =~ s/\?/%3F/g;
295 $input =~ s/\x1c/%1C/g;