Repository navigation
Expand file tree
/
Copy pathServerStats.php
More file actions
2772 lines (2765 loc) · 101 KB
/
Copy pathServerStats.php
File metadata and controls
2772 lines (2765 loc) · 101 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
// server stats page by Ty_ger07 at http://open-web-community.com/
// THIS FOLLOWING INFORMATION NEEDS TO BE FILLED IN
// DATABASE SERVER ID
$server_ID = ''; // default server ID is 1. If using more than one server in the same database, you can select a server other than the first one.
// SERVER NAME
$server_name = ''; // server name to display
// BATTLE LOG LINK
$battlelog = ''; // your server battlelog link
// DON'T EDIT ANYTHING BELOW UNLESS YOU KNOW WHAT YOU ARE DOING
//
//
// include common.php contents
require_once('./common/common.php');
// database connection details
$database_connect = $db_host . ':' . $db_port;
// start counting page load time
$mtime = microtime();
$mtime = explode(" ",$mtime);
$mtime = $mtime[1] + $mtime[0];
$starttime = $mtime;
// output the header
echo '
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-gb" xml:lang="en-gb">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta http-equiv="content-language" content="en-gb" />
<meta http-equiv="content-style-type" content="text/css" />
<meta http-equiv="imagetoolbar" content="no" />
<meta name="resource-type" content="document" />
<meta name="distribution" content="global" />
<meta name="copyright" content="2013 Open-Web-Community http://open-web-community.com/" />
';
// hide php notices
error_reporting(E_ALL ^ E_NOTICE);
// load stylesheet now because we have to (a bit early but ok)
echo '<link rel="stylesheet" href="./common/stats.css" type="text/css" />';
// use server name in database if user didn't enter one above
$database_connected = 0;
if($server_name == null)
{
// connect to the database early because we have to
@mysql_connect($database_connect, $db_uname, $db_pass);
@mysql_select_db($db_name) or die ("<title>BF4 Player Stats - Error</title></head><body><br/><center><b>Unable to access stats database. Please notify this website's administrator.</b></center><br/><center>If you are the administrator, please seek assistance <a href='https://forum.myrcon.com/showthread.php?6854-Server-Stats-page-for-XpKiller-s-BF4-Chat-GUID-Stats-and-Mapstats-Logger' target='_blank'>here</a>.</center><br/></body></html>");
$database_connected = 1;
$server_query = @mysql_query("SELECT `ServerName` FROM `tbl_server` WHERE `ServerID` = '$server_ID'");
if(@mysql_num_rows($server_query)!=0)
{
$server_row = @mysql_fetch_assoc($server_query);
$server_name = $server_row['ServerName'];
}
}
// change page title, meta description, and keywords depending on the page content
if($_GET['search_player'])
{
$player_name = $_GET['player_name'];
echo '
<meta name="keywords" content="' . $player_name . ',' . $server_name . ',' . $clan_name . ',BF4,Player,Stats,Server" />
<meta name="description" content="This is our ' . $clan_name . ' BF4 ' . $server_name . ' server player stats page for ' . $player_name . '." />
<title>' . $clan_name . ' BF4 Player Stats - ' . $player_name . ' - ' . $server_name . '</title>
';
}
elseif($_GET['suspicious_players'])
{
echo '
<meta name="keywords" content="Suspicious,Players,' . $server_name . ',' . $clan_name . ',BF4,Player,Stats,Server" />
<meta name="description" content="This is our ' . $clan_name . ' BF4 ' . $server_name . ' server Suspicious Players page." />
<title>' . $clan_name . ' BF4 Player Stats - Suspicious Players - ' . $server_name . '</title>
';
}
elseif($_GET['top25_players'])
{
echo '
<meta name="keywords" content="Top,Players,' . $server_name . ',' . $clan_name . ',BF4,Player,Stats,Server" />
<meta name="description" content="This is our ' . $clan_name . ' BF4 ' . $server_name . ' server player stats page of Top Players." />
<title>' . $clan_name . ' BF4 Player Stats - Top Players - ' . $server_name . '</title>
';
}
elseif($_GET['top25_countries'])
{
echo '
<meta name="keywords" content="Country,' . $server_name . ',' . $clan_name . ',BF4,Player,Stats,Server" />
<meta name="description" content="This is our ' . $clan_name . ' BF4 ' . $server_name . ' server Country Stats page." />
<title>' . $clan_name . ' BF4 Player Stats - Country Stats - ' . $server_name . '</title>
';
}
elseif($_GET['mapstats'])
{
echo '
<meta name="keywords" content="Map,' . $server_name . ',' . $clan_name . ',BF4,Player,Stats,Server" />
<meta name="description" content="This is our ' . $clan_name . ' BF4 ' . $server_name . ' server Map Stats page." />
<title>' . $clan_name . ' BF4 Player Stats - Map Stats - ' . $server_name . '</title>
';
}
elseif($_GET['serverstats'])
{
echo '
<meta name="keywords" content="Server,Scoreboard,' . $server_name . ',' . $clan_name . ',BF4,Player,Stats,Info" />
<meta name="description" content="This is our ' . $clan_name . ' BF4 ' . $server_name . ' server Scoreboard and Info page." />
<title>' . $clan_name . ' BF4 Player Stats - Server Info - ' . $server_name . '</title>
<meta http-equiv="refresh" content="60" />
';
}
elseif($_GET['chat'])
{
echo '
<meta name="keywords" content="Chat,' . $server_name . ',' . $clan_name . ',BF4,Player,Recent,Server" />
<meta name="description" content="This is our ' . $clan_name . ' BF4 ' . $server_name . ' server Chat Content page." />
<title>' . $clan_name . ' BF4 - Recent Chat - ' . $server_name . '</title>
<meta http-equiv="refresh" content="60" />
';
}
else
{
echo '
<meta name="keywords" content="Main,Top,25,Players,' . $server_name . ',' . $clan_name . ',BF4,Player,Stats,Server" />
<meta name="description" content="This is our ' . $clan_name . ' BF4 ' . $server_name . ' server main player stats page." />
<title>' . $clan_name . ' BF4 Player Stats - Main Page - ' . $server_name . '</title>
<meta http-equiv="refresh" content="60" />
';
}
echo '
</head>
<body>
<br/>
<div id="pagebody">
<br/>
<table width="100%" cellspacing="1">
<tr>
<td>
<div>
<div class="topcontent">
<center><a href="' . $banner_url . '" target="_blank"><img alt="BF4 Stats Page Copyright 2013 Open-Web-Community" border="0" src="' . $banner_image . '" /></a></center>
</div>
';
// if index link is present, show this block
if($index_link != '')
{
echo '
<br/>
<div class="topcontent">
<table width="95%" align="center" border="0">
<tr>
<td width="90%">
<table width="100%" border="0">
<tr>
<td>
<br/><a href="' . $index_link . '"><font size="4">Return to ' . $clan_name . ' Stats Index Page</font></a><br/>
</td>
</tr>
<tr>
<td>
<a href="' . $_SERVER['PHP_SELF'] . '"><b><font class="information">Currently viewing:</font> ' . $server_name . '</b></a><br/>
</td>
</tr>
</table>
</td>
<td width="10%" style="text-align: right;">
<br/><a href="' . $battlelog . '" target="_blank"><img src="./images/joinbtn.png" alt="join" class="joinbutton"/></a><br/>
</td>
</tr>
</table>
<br/>
</div>
';
}
else
{
echo '
<br/>
<div class="topcontent">
<table width="95%" align="center" border="0">
<tr>
<td width="75%">
<br/><a href="' . $_SERVER['PHP_SELF'] . '"><b><font class="information">Currently viewing:</font> ' . $server_name . '</b></a><br/>
</td>
<td width="25%" style="float: right;">
<br/><a href="' . $battlelog . '" target="_blank"><img src="./images/joinbtn.png" alt="join" class="joinbutton"/></a><br/>
</td>
</tr>
</table>
<br/>
</div>
';
}
echo '
<table border="0" width="100%" align="center">
<tr>
<td>
<center>
';
// connect to the database if not already done
if($database_connected == 0)
{
@mysql_connect($database_connect, $db_uname, $db_pass);
@mysql_select_db($db_name) or die ("<b><br/>Unable to access stats database. Please notify this website's administrator.</b><br/>If you are the administrator, please seek assistance <a href='https://forum.myrcon.com/showthread.php?6854-Server-Stats-page-for-XpKiller-s-BF4-Chat-GUID-Stats-and-Mapstats-Logger'>here</a>.<br/></center></td></tr></table></div></td></tr></table></div></body></html>");
$database_connected = 1;
}
echo '
<table width="100%">
<tr>
<td width="1%">
</td>
<td>
<table width="100%">
<tr>
<td>
<div class="menucontent">
<table align="center" width="100%" border="0">
<tr>
<td width="30%" style="text-align: left">
<form action="' . $_SERVER['PHP_SELF'] . '" method="get">
<font class="information">Player:</font>
<input type="text" class="inputbox" name="player_name" />
<input type="submit" name="search_player" value="Search" title="Search" class="button" />
</form>
</td>
<td width="10%" style="text-align: center">
</td>
<td width="10%" style="text-align: center">
<a href="' . $_SERVER['PHP_SELF'] . '">Home</a>
</td>
<td width="10%" style="text-align: center">
<a href="' . $_SERVER['PHP_SELF'] . '?suspicious_players=Search">Suspicious</a>
</td>
<td width="10%" style="text-align: center">
<a href="' . $_SERVER['PHP_SELF'] . '?chat=View">Chat</a>
</td>
<td width="10%" style="text-align: center">
<a href="' . $_SERVER['PHP_SELF'] . '?top25_countries=View">Country Stats</a>
</td>
<td width="10%" style="text-align: center">
<a href="' . $_SERVER['PHP_SELF'] . '?mapstats=View">Map Stats</a>
</td>
<td width="10%" style="text-align: center">
<a href="' . $_SERVER['PHP_SELF'] . '?serverstats=View">Server Info</a>
</td>
</tr>
</table>
</div>
<br/>
';
// these constants will be used later
// make an array of game modes
$mode_array = array('Air Superiority'=>'AirSuperiority0','Capture The Flag'=>'CaptureTheFlag0','Team Deathmatch'=>'TeamDeathMatch0','Domination'=>'Domination0','Defuse'=>'Elimination0','Obliteration'=>'Obliteration','Tank Superiority'=>'TankSuperiority0','Rush'=>'RushLarge0','Conquest Large'=>'ConquestLarge0','Conquest Small'=>'ConquestSmall0','Squad Deathmatch'=>'SquadDeathMatch0');
// make an array of map names
$map_array = array('Zavod 311'=>'MP_Abandoned','Lancang Dam'=>'MP_Damage','Flood Zone'=>'MP_Flooded','Golmud Railway'=>'MP_Journey','Paracel Storm'=>'MP_Naval','Operation Locker'=>'MP_Prison','Hainan Resort'=>'MP_Resort','Siege of Shanghai'=>'MP_Siege','Rogue Transmission'=>'MP_TheDish','Dawnbreaker'=>'MP_Tremors');
// make an array of squad names
$squad_array = array('None'=>'0','Alpha'=>'1','Bravo'=>'2','Charlie'=>'3','Delta'=>'4','Echo'=>'5','Foxtrot'=>'6','Golf'=>'7','Hotel'=>'8','India'=>'9','Juliet'=>'10','Kilo'=>'11','Lima'=>'12','Mike'=>'13','November'=>'14','Oscar'=>'15','Papa'=>'16','Quebec'=>'17','Romeo'=>'18','Sierra'=>'19','Tango'=>'20','Uniform'=>'21','Victor'=>'22','Whiskey'=>'23','X-Ray'=>'24','Yankee'=>'25','Zulu'=>'26');
// make an array of country names
$country_array = array('Null'=>'','Unknown'=>'--','Afghanistan'=>'AF','Albania'=>'AL','Algeria'=>'DZ','American Samoa'=>'AS','Andorra'=>'AD','Angola'=>'AO','Anguilla'=>'AI','Antarctica'=>'AQ','Antigua'=>'AG','Argentina'=>'AR','Armenia'=>'AM','Aruba'=>'AW','Australia'=>'AU','Austria'=>'AT','Azerbaijan'=>'AZ','Bahamas'=>'BS','Bahrain'=>'BH','Bangladesh'=>'BD','Barbados'=>'BB','Belarus'=>'BY','Belgium'=>'BE','Belize'=>'BZ','Benin'=>'BJ','Bermuda'=>'BM','Bhutan'=>'BT','Bolivia'=>'BO','Bosnia'=>'BA','Botswana'=>'BW','Bouvet Island'=>'BV','Brazil'=>'BR','Indian Ocean'=>'IO','Brunei Darussalum'=>'BN','Bulgaria'=>'BG','Burkina Faso'=>'BF','Burundi'=>'BI','Cambodia'=>'KH','Cameroon'=>'CM','Canada'=>'CA','Cape Verde'=>'CV','Cayman Islands'=>'KY','Central Africa'=>'CF','Chad'=>'TD','Chile'=>'CL','China'=>'CN','Christmas Island'=>'CX','Cocos Islands'=>'CC','Columbia'=>'CO','Comoros'=>'KM','Congo'=>'CG','Republic of Congo'=>'CD','Cook Islands'=>'CK','Costa Rica'=>'CR','Ivory Coast'=>'CI','Croatia'=>'HR','Cuba'=>'CU','Cyprus'=>'CY','Czech Repuplic'=>'CZ','Denmark'=>'DK','Djibouti'=>'DJ','Dominica'=>'DM','Dominican Republic'=>'DO','East Timor'=>'TP','Ecuador'=>'EC','Egypt'=>'EG','El Salvador'=>'SV','Equatorial Guinea'=>'GQ','Eritrea'=>'ER','Estonia'=>'EE','Ethiopia'=>'ET','Falkland Islands'=>'FK','Faroe Islands'=>'FO','Fiji'=>'FJ','Finland'=>'FI','France'=>'FR','Metropolitan France'=>'FX','French Guiana'=>'GF','French Polynesia'=>'PF','French Territories'=>'TF','Gabon'=>'GA','Gambia'=>'GM','Georgia'=>'GE','Germany'=>'DE','Ghana'=>'GH','Gibraltar'=>'GI','Greece'=>'GR','Greenland'=>'GL','Grenada'=>'GD','Guadeloupe'=>'GP','Guam'=>'GU','Guatemala'=>'GT','Guernsey'=>'GG','Guinea'=>'GN','Guinea-Bissau'=>'GW','Guyana'=>'GY','Haiti'=>'HT','McDonald Islands'=>'HM','Vatican City'=>'VA','Honduras'=>'HN','Hong Kong'=>'HK','Hungary'=>'HU','Iceland'=>'IS','India'=>'IN','Indonesia'=>'ID','Iran'=>'IR','Iraq'=>'IQ','Ireland'=>'IE','Israel'=>'IL','Italy'=>'IT','Jamaica'=>'JM','Japan'=>'JP','Jordan'=>'JO','Kazakstan'=>'KZ','Kenya'=>'KE','Kiribati'=>'KI','North Korea'=>'KP','South Korea'=>'KR','Kuwait'=>'KW','Kyrgyzstan'=>'KG','Lao'=>'LA','Latvia'=>'LV','Lebanon'=>'LB','Lesotho'=>'LS','Liberia'=>'LR','Libya'=>'LY','Liechtenstein'=>'LI','Lithuania'=>'LT','Luxembourg'=>'LU','Macau'=>'MO','Macedonia'=>'MK','Madagascar'=>'MG','Malawi'=>'MW','Malaysia'=>'MY','Maldives'=>'MV','Mali'=>'ML','Malta'=>'MT','Marshall Islands'=>'MH','Martinique'=>'MQ','Mauritania'=>'MR','Mauritius'=>'MU','Mayotte'=>'YT','Mexico'=>'MX','Micronesia'=>'FM','Moldova'=>'MD','Monaco'=>'MC','Mongolia'=>'MN','Montserrat'=>'MS','Morocco'=>'MA','Mozambique'=>'MZ','Myanmar'=>'MM','Namibia'=>'NA','Nauru'=>'NR','Nepal'=>'NP','Netherlands'=>'NL','Netherlands Antilles'=>'AN','New Caledonia'=>'NC','New Zealand'=>'NZ','Nicaragua'=>'NI','Niger'=>'NE','Nigeria'=>'NG','Niue'=>'NU','Norfolk Island'=>'NF','Mariana Islands'=>'MP','Norway'=>'NO','Oman'=>'OM','Pakistan'=>'PK','Palau'=>'PW','Palestine'=>'PS','Panama'=>'PA','Papua New Guinea'=>'PG','Paraguay'=>'PY','Peru'=>'PE','Philippines'=>'PH','Pitcairn'=>'PN','Poland'=>'PL','Portugal'=>'PT','Puerto Rico'=>'PR','Qatar'=>'QA','Reunion'=>'RE','Romania'=>'RO','Russia'=>'RU','Rwanda'=>'RW','Saint Helena'=>'SH','Saint Kitts'=>'KN','Saint Lucia'=>'LC','Saint Pierre'=>'PM','Saint Vincent'=>'VC','Samoa'=>'WS','San Marino'=>'SM','Sao Tome'=>'ST','Saudi Arabia'=>'SA','Senegal'=>'SN','Seychelles'=>'SC','Sierra Leone'=>'SL','Singapore'=>'SG','Slovakia'=>'SK','Slovenia'=>'SI','Solomon Islands'=>'SB','Somalia'=>'SO','South Africa'=>'ZA','Sandwich Islands'=>'GS','Spain'=>'ES','Sri Lanka'=>'LK','Sudan'=>'SD','Suriname'=>'SR','Svalbard'=>'SJ','Swaziland'=>'SZ','Sweden'=>'SE','Switzerland'=>'CH','Syria'=>'SY','Taiwan'=>'TW','Tajikistan'=>'TJ','Tanzania'=>'TZ','Thailand'=>'TH','Togo'=>'TG','Tokelau'=>'TK','Tonga'=>'TO','Trinidad'=>'TT','Tunisia'=>'TN','Turkey'=>'TR','Turkmenistan'=>'TM','Turks Islands'=>'TC','Tuvalu'=>'TV','Uganda'=>'UG','Ukraine'=>'UA','United Arab Emirates'=>'AE','United Kingdom'=>'GB','United States'=>'US','US Minor Outlying Islands'=>'UM','Uruguay'=>'UY','Uzbekistan'=>'UZ','Vanuatu'=>'VU','Venezuela'=>'VE','Vietnam'=>'VN','Virgin Islands (British)'=>'VG','Virgin Islands (US)'=>'VI','Wallis and Futuna'=>'WF','Western Sahara'=>'EH','Yemen'=>'YE','Yugoslavia'=>'YU','Zambia'=>'ZM','Zimbabwe'=>'ZW');
// functions
// function to find player's weapon stats
function Statsout($headingprint, $damagetype, $ThisPlayerName, $server_ID)
{
$expand_id = preg_replace("/\s/","",$damagetype);
// get current query details
if(isset($_GET['rank']) AND !empty($_GET['rank']))
{
$rank = $_GET['rank'];
if($rank == 'HSR')
{
$rankin = '(Headshots/Kills)';
}
else
{
$rankin = $rank;
}
}
else
{
$rankin = 'Friendlyname';
$rank = 'Friendlyname';
}
if(isset($_GET['order']) AND !empty($_GET['order']))
{
$order = $_GET['order'];
if($order == 'DESC')
{
$nextorder = 'ASC';
}
else
{
$nextorder = 'DESC';
}
}
else
{
$order = 'ASC';
$nextorder = 'DESC';
}
// see if this player has used this category's weapons
$weapon_result = @mysql_query("SELECT tws.Friendlyname, wa.Kills, wa.Deaths, wa.Headshots, wa.WeaponID FROM tbl_weapons_stats wa INNER JOIN tbl_server_player tsp ON tsp.StatsID = wa.StatsID INNER JOIN tbl_playerdata tpd ON tsp.PlayerID = tpd.PlayerID INNER JOIN tbl_weapons tws ON tws.WeaponID = wa.WeaponID WHERE tsp.ServerID = '$server_ID' AND tpd.SoldierName = '$ThisPlayerName' AND tws.Damagetype = '$damagetype' AND wa.Kills > '0' ORDER BY $rankin $order");
// see if we have any records for this player for this category
if(@mysql_num_rows($weapon_result)!=0)
{
echo '
<div class="innercontent">
<table width="98%" border="0">
<tr>
<th style="text-align: left;">' . $headingprint . '</th>
</tr>
</table>
<table align="center" width="98%" border="0">
<tr>
<td width="3%" style="text-align:left"> </td>
';
if($rank != 'Friendlyname')
{
echo'<th width="17%" style="text-align:left;"><a href="' . $_SERVER['PHP_SELF'] . '?player_name=' . $ThisPlayerName . '&search_player=Search&rank=Friendlyname&order=ASC"><span class="orderheader">Weapon Name</span></a></th>';
}
else
{
echo'<th width="17%" style="text-align:left;"><a href="' . $_SERVER['PHP_SELF'] . '?player_name=' . $ThisPlayerName . '&search_player=Search&rank=Friendlyname&order=' . $nextorder . '"><span class="orderheader">Weapon Name</span></a></th>';
}
echo '<th width="16%" style="text-align:left;">Rank</th>';
if($rank != 'Kills')
{
echo'<th width="16%" style="text-align:left;"><a href="' . $_SERVER['PHP_SELF'] . '?player_name=' . $ThisPlayerName . '&search_player=Search&rank=Kills&order=DESC"><span class="orderheader">Kills</span></a></th>';
}
else
{
echo'<th width="16%" style="text-align:left;"><a href="' . $_SERVER['PHP_SELF'] . '?player_name=' . $ThisPlayerName . '&search_player=Search&rank=Kills&order=' . $nextorder . '"><span class="orderheader">Kills</span></a></th>';
}
if($rank != 'Deaths')
{
echo'<th width="16%" style="text-align:left;"><a href="' . $_SERVER['PHP_SELF'] . '?player_name=' . $ThisPlayerName . '&search_player=Search&rank=Deaths&order=DESC"><span class="orderheader">Deaths</span></a></th>';
}
else
{
echo'<th width="16%" style="text-align:left;"><a href="' . $_SERVER['PHP_SELF'] . '?player_name=' . $ThisPlayerName . '&search_player=Search&rank=Deaths&order=' . $nextorder . '"><span class="orderheader">Deaths</span></a></th>';
}
if($rank != 'Headshots')
{
echo'<th width="16%" style="text-align:left;"><a href="' . $_SERVER['PHP_SELF'] . '?player_name=' . $ThisPlayerName . '&search_player=Search&rank=Headshots&order=DESC"><span class="orderheader">Headshots</span></a></th>';
}
else
{
echo'<th width="16%" style="text-align:left;"><a href="' . $_SERVER['PHP_SELF'] . '?player_name=' . $ThisPlayerName . '&search_player=Search&rank=Headshots&order=' . $nextorder . '"><span class="orderheader">Headshots</span></a></th>';
}
if($rank != 'HSR')
{
echo'<th width="16%" style="text-align:left;"><a href="' . $_SERVER['PHP_SELF'] . '?player_name=' . $ThisPlayerName . '&search_player=Search&rank=HSR&order=DESC"><span class="orderheader">Headshot Ratio</span></a></th>';
}
else
{
echo'<th width="16%" style="text-align:left;"><a href="' . $_SERVER['PHP_SELF'] . '?player_name=' . $ThisPlayerName . '&search_player=Search&rank=HSR&order=' . $nextorder . '"><span class="orderheader">Headshot Ratio</span></a></th>';
}
echo '</tr>';
while($weapon_row = @mysql_fetch_assoc($weapon_result))
{
$weapon_name_displayed = $weapon_row['Friendlyname'];
$weapon_name_displayed = preg_replace("/_/"," ",$weapon_name_displayed);
$kills = $weapon_row['Kills'];
$deaths = $weapon_row['Deaths'];
$headshots = $weapon_row['Headshots'];
// avoid dividing by zero (this shouldn't happen though because we already filtered out zero kills)
if($kills==0)
{
$kills = 0.0001;
}
$ratio = round((($headshots / $kills)*100),2);
// return kills to their proper value
if($kills==0.0001)
{
$kills = 0;
}
// find this player's weapon rank
$weaponID = $weapon_row['WeaponID'];
// initialize values
$weapon_count = 0;
$num_rows = 0;
// rank weapon
$weaponrank_result = @mysql_query("SELECT wa.Kills FROM tbl_weapons_stats wa INNER JOIN tbl_server_player tsp ON tsp.StatsID = wa.StatsID WHERE tsp.ServerID = '$server_ID' AND wa.WeaponID = '$weaponID' AND wa.Kills > '0' ORDER BY wa.Kills DESC");
// count number of rows as total number of kills with this weapon in the database
$num_rows = @mysql_num_rows($weaponrank_result);
while($weaponrank_row = @mysql_fetch_assoc($weaponrank_result))
{
$weapon_count++;
$this_kills = $weaponrank_row['Kills'];
// if this player's number of kills matches the current kill row
if($kills == $this_kills)
{
break;
}
}
echo '
<tr>
<td width="3%" style="text-align:left"> </td>
<td width="17%" class="tablecontents" style="text-align: left"><font class="information">' . $weapon_name_displayed . ':</font></td>
<td width="16%" class="tablecontents" style="text-align: left">' . $weapon_count . '<font class="information"> / </font>' . $num_rows . '</td>
<td width="16%" class="tablecontents" style="text-align: left">' . $kills . '</td>
<td width="16%" class="tablecontents" style="text-align: left">' . $deaths . '</td>
<td width="16%" class="tablecontents" style="text-align: left">' . $headshots . '</td>
<td width="16%" class="tablecontents" style="text-align: left">' . $ratio . ' <font class="information">%</font></td>
</tr>
';
}
echo '
</table></div>
';
}
}
// function to create and display scoreboard
function scoreboard($server_ID, $server_name, $mode_array, $map_array, $squad_array, $country_array)
{
echo'
<div class="middlecontent">
<table width="100%" border="0">
<tr>
<th class="headline"><b>Scoreboard</b></th>
</tr>
<tr>
<td>
';
// query for player in server and order them by team
$scoreboard_players = @mysql_query("SELECT `TeamID` FROM tbl_currentplayers WHERE `ServerID` = '$server_ID' ORDER BY `TeamID` ASC");
if(@mysql_num_rows($scoreboard_players)==0)
{
// initialize values
$mode_name = 'Unknown';
$map_name = 'Unknown';
$mode = 'Unknown';
// figure out current game mode and map name
$mode_query = @mysql_query("SELECT `mapName`, `Gamemode`, `maxSlots`, `usedSlots`, `IP_Address` FROM tbl_server WHERE `ServerID` = '$server_ID'");
if(@mysql_num_rows($mode_query)!=0)
{
$mode_row = @mysql_fetch_assoc($mode_query);
$used_slots = $mode_row['usedSlots'];
$available_slots = $mode_row['maxSlots'];
$ip_address = $mode_row['IP_Address'];
// convert mode to friendly name
$mode = $mode_row['Gamemode'];
$mode_name = array_search($mode,$mode_array);
// convert map to friendly name
$map = $mode_row['mapName'];
$map_name = array_search($map,$map_array);
$map_img = './images/maps/' . $map . '.png';
}
echo '
<div class="innercontent">
<table width="98%" align="center" border="0" class="prettytable">
<tr>
<td class="mapimage" style="background-image: url(' . $map_img . ');">
<div class="simplecontent">
<table width="80%" align="center" border="0">
<tr>
<td width="10%" style="text-align:left"><br/> <br/><br/></td>
<td width="22%" style="text-align:left"><br/><font class="information">Current Game Mode:</font><br/><br/></td>
<td width="22%" style="text-align:left"><br/>' . $mode_name . '<br/><br/></td>
<td width="22%" style="text-align:left"><br/><font class="information">Current Map:</font><br/><br/></td>
<td width="22%" style="text-align:left"><br/>' . $map_name . '<br/><br/></td>
</tr>
<tr>
<td width="10%" style="text-align:left"> <br/><br/></td>
<td width="22%" style="text-align:left"><font class="information">Server IP Address:</font><br/><br/></td>
<td width="22%" style="text-align:left">' . $ip_address . '<br/><br/></td>
<td width="22%" style="text-align:left"><font class="information">Server Slots:</font><br/><br/></td>
<td width="22%" style="text-align:left">' . $used_slots . ' <font class="information">/</font> ' . $available_slots . '<br/><br/></td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</div>
';
}
else
{
echo '
<div class="innercontent">
<table width="98%" align="center" border="0">
';
// initialize values
$mode_name = 'Unknown';
$map_name = 'Unknown';
$mode = 'Unknown';
$count2 = 0;
// figure out current game mode and map name
$mode_query = @mysql_query("SELECT `mapName`, `Gamemode`, `maxSlots`, `usedSlots`, `IP_Address` FROM tbl_server WHERE `ServerID` = '$server_ID'");
if(@mysql_num_rows($mode_query)!=0)
{
$mode_row = @mysql_fetch_assoc($mode_query);
$used_slots = $mode_row['usedSlots'];
$available_slots = $mode_row['maxSlots'];
$ip_address = $mode_row['IP_Address'];
// convert mode to friendly name
$mode = $mode_row['Gamemode'];
$mode_name = array_search($mode,$mode_array);
// convert map to friendly name
$map = $mode_row['mapName'];
$map_name = array_search($map,$map_array);
$map_img = './images/maps/' . $map . '.png';
echo '
<tr>
<td colspan="2" class="mapimage" style="background-image: url(' . $map_img . ');">
<div class="simplecontent">
';
}
else
{
echo '<tr><td><div>';
}
// initialize values
$mode_shown = 0;
$last_team = -1;
while($team_row = @mysql_fetch_assoc($scoreboard_players))
{
$this_team = $team_row['TeamID'];
if($this_team != $last_team)
{
if($this_team == 3)
{
echo '</tr><tr><td colspan="2"> </td></tr><tr>';
}
// only show the header information once
if($mode_shown == 0)
{
echo '
<table width="80%" align="center" border="0">
<tr>
<td width="10%" style="text-align:left"><br/> <br/><br/></td>
<td width="22%" style="text-align:left"><br/><font class="information">Current Game Mode:</font><br/><br/></td>
<td width="22%" style="text-align:left"><br/>' . $mode_name . '<br/><br/></td>
<td width="22%" style="text-align:left"><br/><font class="information">Current Map:</font><br/><br/></td>
<td width="22%" style="text-align:left"><br/>' . $map_name . '<br/><br/></td>
</tr>
<tr>
<td width="10%" style="text-align:left"> <br/><br/></td>
<td width="22%" style="text-align:left"><font class="information">Server IP Address:</font><br/><br/></td>
<td width="22%" style="text-align:left">' . $ip_address . '<br/><br/></td>
<td width="22%" style="text-align:left"><font class="information">Server Slots:</font><br/><br/></td>
<td width="22%" style="text-align:left">' . $used_slots . ' <font class="information">/</font> ' . $available_slots . '<br/><br/></td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
';
$mode_shown = 1;
}
// change team name shown depending on team number
if($this_team == 0)
{
$team_name = 'Loading In';
}
else
{
if($mode == 'RushLarge0')
{
if($this_team == 1)
{
if(($map == 'MP_Abandoned') OR ($map == 'MP_Damage') OR ($map == 'MP_Journey') OR ($map == 'MP_TheDish'))
{
$team_name = 'RU Attackers';
}
elseif(($map == 'MP_Flooded') OR ($map == 'MP_Naval') OR ($map == 'MP_Prison') OR ($map == 'MP_Resort') OR ($map == 'MP_Siege') OR ($map == 'MP_Tremors'))
{
$team_name = 'US Attackers';
}
else
{
$team_name = 'Attackers';
}
}
elseif($this_team == 2)
{
if($map == 'MP_Abandoned')
{
$team_name = 'US Defenders';
}
elseif(($map == 'MP_Damage') OR ($map == 'MP_Flooded') OR ($map == 'MP_Journey') OR ($map == 'MP_Naval') OR ($map == 'MP_Resort') OR ($map == 'MP_Siege') OR ($map == 'MP_TheDish') OR ($map == 'MP_Tremors'))
{
$team_name = 'CN Defenders';
}
elseif($map == 'MP_Prison')
{
$team_name = 'RU Defenders';
}
else
{
$team_name = 'Defenders';
}
}
else
{
$team_name = 'Team ' . $this_team;
}
}
elseif(($mode == 'ConquestLarge0') OR ($mode == 'ConquestSmall0') OR ($mode == 'Domination0') OR ($mode == 'Elimination0') OR ($mode == 'Obliteration') OR ($mode == 'TeamDeathMatch0'))
{
if($this_team == 1)
{
if(($map == 'MP_Abandoned') OR ($map == 'MP_Damage') OR ($map == 'MP_Journey') OR ($map == 'MP_TheDish'))
{
$team_name = 'RU Army';
}
elseif(($map == 'MP_Flooded') OR ($map == 'MP_Naval') OR ($map == 'MP_Prison') OR ($map == 'MP_Resort') OR ($map == 'MP_Siege') OR ($map == 'MP_Tremors'))
{
$team_name = 'US Army';
}
else
{
$team_name = 'US Army';
}
}
elseif($this_team == 2)
{
if($map == 'MP_Abandoned')
{
$team_name = 'US Army';
}
elseif(($map == 'MP_Damage') OR ($map == 'MP_Flooded') OR ($map == 'MP_Journey') OR ($map == 'MP_Naval') OR ($map == 'MP_Resort') OR ($map == 'MP_Siege') OR ($map == 'MP_TheDish') OR ($map == 'MP_Tremors'))
{
$team_name = 'CN Army';
}
elseif($map == 'MP_Prison')
{
$team_name = 'RU Army';
}
else
{
$team_name = 'RU Army';
}
}
else
{
$team_name = 'Team ' . $this_team;
}
}
elseif(($mode == 'SquadDeathMatch0'))
{
if($this_team == 1)
{
$team_name = 'Alpha';
}
elseif($this_team == 2)
{
$team_name = 'Bravo';
}
elseif($this_team == 3)
{
$team_name = 'Charlie';
}
elseif($this_team == 4)
{
$team_name = 'Delta';
}
else
{
$team_name = 'Team ' . $this_team;
}
}
else
{
$team_name = 'Team ' . $this_team;
}
}
if($this_team == 0)
{
echo '<td valign="top" colspan="2">';
}
else
{
echo '<td valign="top" class="prettytable">';
}
if($this_team != 0)
{
// query for scores
$score_query = @mysql_query("SELECT `TeamID`, `Score`, `WinningScore` FROM `tbl_teamscores` WHERE `ServerID` = '$server_ID' AND `TeamID` = '$this_team'");
if(@mysql_num_rows($score_query)!=0)
{
while($score_row = @mysql_fetch_assoc($score_query))
{
$Score = $score_row['Score'];
$WinningScore = $score_row['WinningScore'];
if($WinningScore == 0)
{
echo '<b><font class="teamname">' . $team_name . '</font></b> <font class="information">Tickets Remaining:</font> ' . $Score;
}
else
{
echo '<b><font class="teamname">' . $team_name . '</font></b> <font class="information">Tickets:</font> ' . $Score . '<font class="information">/</font>' . $WinningScore;
}
}
}
}
echo '
<table width="100%" align="center" border="0" class="prettytable">
<tr>
';
// change team color depending...
if($this_team == 0)
{
echo '
<th width="15%" style="text-align:left">' . $team_name . '</th>
<th width="40%" colspan="3" style="text-align:left">Player</th>
';
}
else
{
echo '
<th width="5%" style="text-align:left">#</th>
<th width="51%" colspan="2" style="text-align:left">Player</th>
';
}
// if player is loading in, don't show the score, kills, deaths, or squad name headers
if($this_team != 0)
{
echo'
<th width="10%" style="text-align:left">Score</th>
<th width="10%" style="text-align:left">Kills</th>
<th width="10%" style="text-align:left">Deaths</th>
<th width="14%" style="text-align:left">Squad</th>
';
}
echo'</tr>';
// query all players on this team
$scoreboard_query = @mysql_query("SELECT `ServerID`, `Soldiername`, `Score`, `Kills`, `Deaths`, `TeamID`, `SquadID`, `CountryCode` FROM tbl_currentplayers WHERE ServerID = '$server_ID' AND `TeamID` = '$this_team' ORDER BY `Score` Desc");
if(@mysql_num_rows($scoreboard_query)!=0)
{
$count = 1;
while($scoreboard_row = @mysql_fetch_assoc($scoreboard_query))
{
$player = $scoreboard_row['Soldiername'];
$score = $scoreboard_row['Score'];
$kills = $scoreboard_row['Kills'];
$deaths = $scoreboard_row['Deaths'];
$team = $scoreboard_row['TeamID'];
$squad = $scoreboard_row['SquadID'];
// convert squad name and country name to friendly names
$squad_name = array_search($squad,$squad_array);
$country = strtoupper($scoreboard_row['CountryCode']);
$country_name = array_search($country,$country_array);
if(($country == '') OR ($country == '--'))
{
$country_img = './images/flags/none.png';
}
else
{
$country_img = './images/flags/' . strtolower($country) . '.png';
}
echo '
<tr>
<td class="tablecontents" width="5%" style="text-align:left">' . $count . '</td>
<td class="tablecontents" width="26%" style="text-align:left"><a href="' . $_SERVER['PHP_SELF'] . '?player_name=' . $player . '&search_player=Search"><font size="2">' . $player . '</font></a></td>
<td class="tablecontents" width="26%" style="text-align:left"><img src="' . $country_img . '" alt="' . $country_name . '"/> ' . $country_name . '</td>
';
// if player is loading in, don't show the score, kills, deaths, or squad name
if($this_team != 0)
{
echo '
<td class="tablecontents" width="10%" style="text-align:left">' . $score . '</td>
<td class="tablecontents" width="10%" style="text-align:left">' . $kills . '</td>
<td class="tablecontents" width="10%" style="text-align:left">' . $deaths . '</td>
<td class="tablecontents" width="14%" style="text-align:left">' . $squad_name . '</td>
';
}
$count++;
echo '</tr>';
}
}
echo '</table></td>';
if($this_team == 0)
{
echo '</tr><tr><td colspan="2"> </td></tr><tr>';
}
}
$last_team = $this_team;
}
echo '
</tr>
</table>
<br/>
</div>
';
}
echo '
</td></tr>
</table>
</div>
';
}
// function to replace dangerous characters in content
function textcleaner($content)
{
$content = preg_replace("/&/","&",$content);
$content = preg_replace("/'/","'",$content);
$content = preg_replace("/</","<",$content);
$content = preg_replace("/>/",">",$content);
return $content;
}
// function to reverse cleaning operation
function textuncleaner($content)
{
$content = preg_replace("/'/","'",$content);
$content = preg_replace("/</","<",$content);
$content = preg_replace("/>/",">",$content);
$content = preg_replace("/&/","&",$content);
return $content;
}
// function to search for and display all recent chat content
function recent_chat($server_ID, $server_name, $clan_name)
{
echo'
<div class="middlecontent">
<table width="100%" border="0">
<tr>
<td class="headline">
<br/>
<center>
<b>Recent Chat Content</b>
</center>
<br/>
</td>
</tr>
</table>
</div>
<br/>
<br/>
<div class="middlecontent">
<table width="100%" border="0">
<tr>
<th class="headline"><b>Chat Results</b></th>
</tr>
<tr>
<td>
<div class="innercontent">
<table width="100%" border="0">
<tr>
<td>
';
// pagination code thanks to: http://www.phpfreaks.com/tutorial/basic-pagination
// find out how many rows are in the table
$sql = @mysql_query("SELECT count(`logDate`) AS count, `logDate` FROM tbl_chatlog WHERE `ServerID` = '$server_ID' ORDER BY `logDate` DESC");
$r = @mysql_fetch_row($sql);
$numrows = $r[0];
// number of rows to show per page
$rowsperpage = 25;
// find out total pages
$totalpages = ceil($numrows / $rowsperpage);
// get the current page or set a default
if (isset($_GET['currentpage']) && is_numeric($_GET['currentpage']))
{
// cast var as int
$currentpage = (int) $_GET['currentpage'];
}
else
{
// default page num
$currentpage = 1;
}
// if current page is greater than total pages...
if ($currentpage > $totalpages)
{
// set current page to last page
$currentpage = $totalpages;
}
// if current page is less than first page...
if ($currentpage < 1)
{
// set current page to first page
$currentpage = 1;
}
// get current query details
if(isset($_GET['rank']) AND !empty($_GET['rank']))
{
$rank = $_GET['rank'];
$rankin = $rank;
}
else
{
$rankin = 'logDate';
$rank = 'logDate';
}
if(isset($_GET['order']) AND !empty($_GET['order']))
{
$order = $_GET['order'];
if($order == 'DESC')
{
$nextorder = 'ASC';
}
else
{
$nextorder = 'DESC';
}
}
else
{
$order = 'DESC';
$nextorder = 'ASC';
}
// the offset of the list, based on current page
$offset = ($currentpage - 1) * $rowsperpage;
// get the info from the db
$sql = @mysql_query("SELECT `logDate`, `logSoldierName`, TRIM(`logMessage`) AS logMessage, `logSubset` FROM tbl_chatlog WHERE `ServerID` = '$server_ID' ORDER BY $rankin $order, `logDate` DESC LIMIT $offset, $rowsperpage");
// offset count
$count = ($currentpage * 25) - 25;
// check if chat rows were found
if(@mysql_num_rows($sql)!=0)
{
echo '
<table width="98%" align="center" border="0" class="prettytable">
<tr>
<th width="5%" style="text-align:left">#</th>
';
if($rank != 'logDate')
{
echo'<th width="13%" style="text-align:left;"><a href="' . $_SERVER['PHP_SELF'] . '?chat=View&currentpage=' . $currentpage . '&rank=logDate&order=DESC"><span class="orderheader">Date</span></a></th>';
}
else
{
echo'<th width="13%" style="text-align:left;"><a href="' . $_SERVER['PHP_SELF'] . '?chat=View&currentpage=' . $currentpage . '&rank=logDate&order=' . $nextorder . '"><span class="orderheader">Date</span></a></th>';
}
if($rank != 'logSoldierName')
{
echo'<th width="10%" style="text-align:left;"><a href="' . $_SERVER['PHP_SELF'] . '?chat=View&currentpage=' . $currentpage . '&rank=logSoldierName&order=ASC"><span class="orderheader">Player</span></a></th>';
}
else
{
echo'<th width="10%" style="text-align:left;"><a href="' . $_SERVER['PHP_SELF'] . '?chat=View&currentpage=' . $currentpage . '&rank=logSoldierName&order=' . $nextorder . '"><span class="orderheader">Player</span></a></th>';
}
if($rank != 'logSubset')
{
echo'<th width="7%" style="text-align:left;"><a href="' . $_SERVER['PHP_SELF'] . '?chat=View&currentpage=' . $currentpage . '&rank=logSubset&order=ASC"><span class="orderheader">Audience</span></a></th>';
}
else
{
echo'<th width="7%" style="text-align:left;"><a href="' . $_SERVER['PHP_SELF'] . '?chat=View&currentpage=' . $currentpage . '&rank=logSubset&order=' . $nextorder . '"><span class="orderheader">Audience</span></a></th>';
}
if($rank != 'logMessage')
{
echo'<th width="65%" style="text-align:left;"><a href="' . $_SERVER['PHP_SELF'] . '?chat=View&currentpage=' . $currentpage . '&rank=logMessage&order=ASC"><span class="orderheader">Message</span></a></th>';
}
else
{
echo'<th width="65%" style="text-align:left;"><a href="' . $_SERVER['PHP_SELF'] . '?chat=View&currentpage=' . $currentpage . '&rank=logMessage&order=' . $nextorder . '"><span class="orderheader">Message</span></a></th>';
}
echo '</tr>';
// while there are rows to be fetched...
while($chat_row = @mysql_fetch_assoc($sql))
{
// get data
$logDate = $chat_row['logDate'];
$logSoldierName = textcleaner($chat_row['logSoldierName']);
$logMessage = textcleaner($chat_row['logMessage']);
$logSubset = $chat_row['logSubset'];
$count++;
echo '
<tr>
<td width="5%" class="tablecontents" style="text-align: left;"><font size="2">' . $count . ':</font></td>
<td width="13%" class="tablecontents" style="text-align: left;">' . $logDate . '</td>
<td width="10%" class="tablecontents" style="text-align: left;"><a href="' . $_SERVER['PHP_SELF'] . '?player_name=' . $logSoldierName . '&search_player=Search">' . $logSoldierName . '</a></td>
<td width="7%" class="tablecontents" style="text-align: left;">' . $logSubset . '</td>
<td width="65%" class="tablecontents" style="text-align: left;">' . $logMessage . '</td>
</tr>
';
}
}
else
{
echo '
<table width="98%" align="center" border="0" class="prettytable">
<tr>
<td style="text-align: left;" width="100%" colspan="5"><br/><center><font class="information">No chat content found for ' . $server_name . ' server.</font></center><br/></td>
</tr>
';
}
// build the pagination links
echo '</table>';
// if no chat was found, don't display pagination links
if(@mysql_num_rows($sql)!=0)
{
echo '
<div class="pagination">
<center>
';
// range of num links to show
$range = 3;
// if on page 1, don't show back links
if ($currentpage > 1)
{
// show << link to go back to first page
echo '<a href="' . $_SERVER['PHP_SELF'] . '?chat=View&currentpage=1&rank=' . $rank . '&order=' . $order . '"><<</a>';
// get previous page num
$prevpage = $currentpage - 1;
// show < link to go back one page
echo ' <a href="' . $_SERVER['PHP_SELF'] . '?chat=View&currentpage=' . $prevpage . '&rank=' . $rank . '&order=' . $order . '"><</a> ';
}
// loop to show links to range of pages around current page
for($x = ($currentpage - $range); $x < (($currentpage + $range) + 1); $x++)