diff options
author | Matthijs Kuiper <info@matthijskuiper.nl> | 2017-02-04 16:05:45 +0100 |
---|---|---|
committer | Matthijs Kuiper <info@matthijskuiper.nl> | 2017-02-04 16:05:45 +0100 |
commit | 40dfa7d5c0dc8e4cb2c95e403b6b4b2c4bf70644 (patch) | |
tree | 6ac6279ac26749ffe7ca0ae9603fbcae2e757e6e |
Original UTStats beta 4.2.84.2.8
460 files changed, 16550 insertions, 0 deletions
diff --git a/System/UTSAccuBeta4_2.u b/System/UTSAccuBeta4_2.u Binary files differnew file mode 100755 index 0000000..bb4ff71 --- /dev/null +++ b/System/UTSAccuBeta4_2.u diff --git a/System/UTStatsBeta4_2.u b/System/UTStatsBeta4_2.u Binary files differnew file mode 100755 index 0000000..9c0f763 --- /dev/null +++ b/System/UTStatsBeta4_2.u diff --git a/html/GeoIP.dat b/html/GeoIP.dat Binary files differnew file mode 100755 index 0000000..d898243 --- /dev/null +++ b/html/GeoIP.dat diff --git a/html/admin.php b/html/admin.php new file mode 100755 index 0000000..74eb5b7 --- /dev/null +++ b/html/admin.php @@ -0,0 +1,60 @@ +<?php
+if (isset($_REQUEST['rememberkey'])) setcookie('uts_adminkey', $_REQUEST['key'], time()+60*60*24*30*365);
+if (isset($_COOKIE['uts_adminkey'])) $adminkey = $_REQUEST['uts_adminkey'];
+
+include ("includes/config.php");
+include ("includes/functions.php");
+include ("includes/functions_admin.php");
+include ("includes/header.php");
+
+// Get key from web browser
+if (isset($_REQUEST['key'])) $adminkey = $_REQUEST['key'];
+if (!isset($adminkey)) $adminkey = '';
+$action = (!empty($_REQUEST['action'])) ? $_REQUEST['action'] : 'main';
+
+echo'<table class = "box" border="0" cellpadding="1" cellspacing="2" width="720">
+<tr>
+ <td class="heading" align="center" colspan="2">UTStats Administration</td>
+</tr>';
+
+IF (empty($import_adminkey)) {
+ echo'<tr><td class="smheading" align="left" width="150">Error:</td>
+ <td class="grey" align="left">No key set in config.php</td>
+ </tr></table>';
+ include("includes/footer.php");
+ return;
+}
+
+
+IF (!empty($adminkey) and $adminkey != $import_adminkey) {
+ echo'<tr><td class="smheading" align="left" width="150">Error:</td>
+ <td class="grey" align="left">Keys do not match</td>
+ </tr>';
+ $adminkey = '';
+}
+
+IF (empty($adminkey)) {
+ echo'<tr>
+ <td class="smheading" align="left" width="150">Enter Admin key:</td>
+ <td class="grey" align="left"><form NAME="adminkey" ACTION="admin.php">
+ <input TYPE="text" NAME="key" MAXLENGTH="35" SIZE="20" CLASS="searchform">
+ <input TYPE="submit" VALUE="Submit" CLASS="searchformb">
+ <input TYPE="checkbox" NAME="rememberkey"> Remember the key
+ </form></td>
+ </tr></table>';
+ include("includes/footer.php");
+ return;
+}
+
+
+echo'</table>
+ <br>';
+
+$action = str_replace(array('.', '/', '<', ':'), array(), $action);
+$fn = "pages/admin/$action.php";
+if (!file_exists($fn) or !is_file($fn)) die('bla');
+require($fn);
+
+include('includes/footer.php');
+
+?>
diff --git a/html/images/bars/h_bar1.png b/html/images/bars/h_bar1.png Binary files differnew file mode 100755 index 0000000..c6638fd --- /dev/null +++ b/html/images/bars/h_bar1.png diff --git a/html/images/bars/h_bar10.png b/html/images/bars/h_bar10.png Binary files differnew file mode 100755 index 0000000..50f7e14 --- /dev/null +++ b/html/images/bars/h_bar10.png diff --git a/html/images/bars/h_bar11.png b/html/images/bars/h_bar11.png Binary files differnew file mode 100755 index 0000000..17176f1 --- /dev/null +++ b/html/images/bars/h_bar11.png diff --git a/html/images/bars/h_bar12.png b/html/images/bars/h_bar12.png Binary files differnew file mode 100755 index 0000000..5a6a8b3 --- /dev/null +++ b/html/images/bars/h_bar12.png diff --git a/html/images/bars/h_bar13.png b/html/images/bars/h_bar13.png Binary files differnew file mode 100755 index 0000000..c798d7b --- /dev/null +++ b/html/images/bars/h_bar13.png diff --git a/html/images/bars/h_bar14.png b/html/images/bars/h_bar14.png Binary files differnew file mode 100755 index 0000000..02ea0a9 --- /dev/null +++ b/html/images/bars/h_bar14.png diff --git a/html/images/bars/h_bar15.png b/html/images/bars/h_bar15.png Binary files differnew file mode 100755 index 0000000..7330058 --- /dev/null +++ b/html/images/bars/h_bar15.png diff --git a/html/images/bars/h_bar16.png b/html/images/bars/h_bar16.png Binary files differnew file mode 100755 index 0000000..21c0456 --- /dev/null +++ b/html/images/bars/h_bar16.png diff --git a/html/images/bars/h_bar2.png b/html/images/bars/h_bar2.png Binary files differnew file mode 100755 index 0000000..7302d90 --- /dev/null +++ b/html/images/bars/h_bar2.png diff --git a/html/images/bars/h_bar3.png b/html/images/bars/h_bar3.png Binary files differnew file mode 100755 index 0000000..d8ccc70 --- /dev/null +++ b/html/images/bars/h_bar3.png diff --git a/html/images/bars/h_bar4.png b/html/images/bars/h_bar4.png Binary files differnew file mode 100755 index 0000000..615d588 --- /dev/null +++ b/html/images/bars/h_bar4.png diff --git a/html/images/bars/h_bar5.png b/html/images/bars/h_bar5.png Binary files differnew file mode 100755 index 0000000..91a8513 --- /dev/null +++ b/html/images/bars/h_bar5.png diff --git a/html/images/bars/h_bar6.png b/html/images/bars/h_bar6.png Binary files differnew file mode 100755 index 0000000..59266f0 --- /dev/null +++ b/html/images/bars/h_bar6.png diff --git a/html/images/bars/h_bar7.png b/html/images/bars/h_bar7.png Binary files differnew file mode 100755 index 0000000..9d15c10 --- /dev/null +++ b/html/images/bars/h_bar7.png diff --git a/html/images/bars/h_bar8.png b/html/images/bars/h_bar8.png Binary files differnew file mode 100755 index 0000000..f7a35d0 --- /dev/null +++ b/html/images/bars/h_bar8.png diff --git a/html/images/bars/h_bar9.png b/html/images/bars/h_bar9.png Binary files differnew file mode 100755 index 0000000..22cbba2 --- /dev/null +++ b/html/images/bars/h_bar9.png diff --git a/html/images/bars/index.htm b/html/images/bars/index.htm new file mode 100755 index 0000000..e69de29 --- /dev/null +++ b/html/images/bars/index.htm diff --git a/html/images/bars/v_bar1.png b/html/images/bars/v_bar1.png Binary files differnew file mode 100755 index 0000000..6ae04ff --- /dev/null +++ b/html/images/bars/v_bar1.png diff --git a/html/images/bars/v_bar10.png b/html/images/bars/v_bar10.png Binary files differnew file mode 100755 index 0000000..fa91fa8 --- /dev/null +++ b/html/images/bars/v_bar10.png diff --git a/html/images/bars/v_bar11.png b/html/images/bars/v_bar11.png Binary files differnew file mode 100755 index 0000000..49bd4c0 --- /dev/null +++ b/html/images/bars/v_bar11.png diff --git a/html/images/bars/v_bar12.png b/html/images/bars/v_bar12.png Binary files differnew file mode 100755 index 0000000..07c6dab --- /dev/null +++ b/html/images/bars/v_bar12.png diff --git a/html/images/bars/v_bar13.png b/html/images/bars/v_bar13.png Binary files differnew file mode 100755 index 0000000..ec5950b --- /dev/null +++ b/html/images/bars/v_bar13.png diff --git a/html/images/bars/v_bar14.png b/html/images/bars/v_bar14.png Binary files differnew file mode 100755 index 0000000..5f6401d --- /dev/null +++ b/html/images/bars/v_bar14.png diff --git a/html/images/bars/v_bar15.png b/html/images/bars/v_bar15.png Binary files differnew file mode 100755 index 0000000..dc65286 --- /dev/null +++ b/html/images/bars/v_bar15.png diff --git a/html/images/bars/v_bar16.png b/html/images/bars/v_bar16.png Binary files differnew file mode 100755 index 0000000..a8893b9 --- /dev/null +++ b/html/images/bars/v_bar16.png diff --git a/html/images/bars/v_bar2.png b/html/images/bars/v_bar2.png Binary files differnew file mode 100755 index 0000000..f90b7f6 --- /dev/null +++ b/html/images/bars/v_bar2.png diff --git a/html/images/bars/v_bar3.png b/html/images/bars/v_bar3.png Binary files differnew file mode 100755 index 0000000..156862c --- /dev/null +++ b/html/images/bars/v_bar3.png diff --git a/html/images/bars/v_bar4.png b/html/images/bars/v_bar4.png Binary files differnew file mode 100755 index 0000000..0f6b2b0 --- /dev/null +++ b/html/images/bars/v_bar4.png diff --git a/html/images/bars/v_bar5.png b/html/images/bars/v_bar5.png Binary files differnew file mode 100755 index 0000000..0771a95 --- /dev/null +++ b/html/images/bars/v_bar5.png diff --git a/html/images/bars/v_bar6.png b/html/images/bars/v_bar6.png Binary files differnew file mode 100755 index 0000000..d30c8fd --- /dev/null +++ b/html/images/bars/v_bar6.png diff --git a/html/images/bars/v_bar7.png b/html/images/bars/v_bar7.png Binary files differnew file mode 100755 index 0000000..9496f8c --- /dev/null +++ b/html/images/bars/v_bar7.png diff --git a/html/images/bars/v_bar8.png b/html/images/bars/v_bar8.png Binary files differnew file mode 100755 index 0000000..5a9fa53 --- /dev/null +++ b/html/images/bars/v_bar8.png diff --git a/html/images/bars/v_bar9.png b/html/images/bars/v_bar9.png Binary files differnew file mode 100755 index 0000000..3559892 --- /dev/null +++ b/html/images/bars/v_bar9.png diff --git a/html/images/blankbar.gif b/html/images/blankbar.gif Binary files differnew file mode 100755 index 0000000..6ba6306 --- /dev/null +++ b/html/images/blankbar.gif diff --git a/html/images/characters/char1.jpg b/html/images/characters/char1.jpg Binary files differnew file mode 100755 index 0000000..3e9dc9d --- /dev/null +++ b/html/images/characters/char1.jpg diff --git a/html/images/characters/char10.jpg b/html/images/characters/char10.jpg Binary files differnew file mode 100755 index 0000000..d42ffd8 --- /dev/null +++ b/html/images/characters/char10.jpg diff --git a/html/images/characters/char11.jpg b/html/images/characters/char11.jpg Binary files differnew file mode 100755 index 0000000..2fc3adc --- /dev/null +++ b/html/images/characters/char11.jpg diff --git a/html/images/characters/char12.jpg b/html/images/characters/char12.jpg Binary files differnew file mode 100755 index 0000000..0288d05 --- /dev/null +++ b/html/images/characters/char12.jpg diff --git a/html/images/characters/char13.jpg b/html/images/characters/char13.jpg Binary files differnew file mode 100755 index 0000000..bfffa5d --- /dev/null +++ b/html/images/characters/char13.jpg diff --git a/html/images/characters/char14.jpg b/html/images/characters/char14.jpg Binary files differnew file mode 100755 index 0000000..ca92844 --- /dev/null +++ b/html/images/characters/char14.jpg diff --git a/html/images/characters/char2.jpg b/html/images/characters/char2.jpg Binary files differnew file mode 100755 index 0000000..8e9ef8c --- /dev/null +++ b/html/images/characters/char2.jpg diff --git a/html/images/characters/char3.jpg b/html/images/characters/char3.jpg Binary files differnew file mode 100755 index 0000000..eb1c174 --- /dev/null +++ b/html/images/characters/char3.jpg diff --git a/html/images/characters/char4.jpg b/html/images/characters/char4.jpg Binary files differnew file mode 100755 index 0000000..f7edb22 --- /dev/null +++ b/html/images/characters/char4.jpg diff --git a/html/images/characters/char5.jpg b/html/images/characters/char5.jpg Binary files differnew file mode 100755 index 0000000..137e981 --- /dev/null +++ b/html/images/characters/char5.jpg diff --git a/html/images/characters/char6.jpg b/html/images/characters/char6.jpg Binary files differnew file mode 100755 index 0000000..e2a8b31 --- /dev/null +++ b/html/images/characters/char6.jpg diff --git a/html/images/characters/char7.jpg b/html/images/characters/char7.jpg Binary files differnew file mode 100755 index 0000000..a55d8c0 --- /dev/null +++ b/html/images/characters/char7.jpg diff --git a/html/images/characters/char8.jpg b/html/images/characters/char8.jpg Binary files differnew file mode 100755 index 0000000..8bb9040 --- /dev/null +++ b/html/images/characters/char8.jpg diff --git a/html/images/characters/char9.jpg b/html/images/characters/char9.jpg Binary files differnew file mode 100755 index 0000000..581d022 --- /dev/null +++ b/html/images/characters/char9.jpg diff --git a/html/images/characters/index.htm b/html/images/characters/index.htm new file mode 100755 index 0000000..e69de29 --- /dev/null +++ b/html/images/characters/index.htm diff --git a/html/images/del.png b/html/images/del.png Binary files differnew file mode 100755 index 0000000..6fc4d3b --- /dev/null +++ b/html/images/del.png diff --git a/html/images/favicon.ico b/html/images/favicon.ico Binary files differnew file mode 100755 index 0000000..765407a --- /dev/null +++ b/html/images/favicon.ico diff --git a/html/images/flags/ad.png b/html/images/flags/ad.png Binary files differnew file mode 100755 index 0000000..8e7d7b8 --- /dev/null +++ b/html/images/flags/ad.png diff --git a/html/images/flags/ae.png b/html/images/flags/ae.png Binary files differnew file mode 100755 index 0000000..be9d284 --- /dev/null +++ b/html/images/flags/ae.png diff --git a/html/images/flags/af.png b/html/images/flags/af.png Binary files differnew file mode 100755 index 0000000..385de43 --- /dev/null +++ b/html/images/flags/af.png diff --git a/html/images/flags/ag.png b/html/images/flags/ag.png Binary files differnew file mode 100755 index 0000000..20440ba --- /dev/null +++ b/html/images/flags/ag.png diff --git a/html/images/flags/ai.png b/html/images/flags/ai.png Binary files differnew file mode 100755 index 0000000..c71ec83 --- /dev/null +++ b/html/images/flags/ai.png diff --git a/html/images/flags/al.png b/html/images/flags/al.png Binary files differnew file mode 100755 index 0000000..2afeb63 --- /dev/null +++ b/html/images/flags/al.png diff --git a/html/images/flags/am.png b/html/images/flags/am.png Binary files differnew file mode 100755 index 0000000..134ff6b --- /dev/null +++ b/html/images/flags/am.png diff --git a/html/images/flags/an.png b/html/images/flags/an.png Binary files differnew file mode 100755 index 0000000..ce2a9c3 --- /dev/null +++ b/html/images/flags/an.png diff --git a/html/images/flags/ao.png b/html/images/flags/ao.png Binary files differnew file mode 100755 index 0000000..94831db --- /dev/null +++ b/html/images/flags/ao.png diff --git a/html/images/flags/aq.png b/html/images/flags/aq.png Binary files differnew file mode 100755 index 0000000..f214498 --- /dev/null +++ b/html/images/flags/aq.png diff --git a/html/images/flags/ar.png b/html/images/flags/ar.png Binary files differnew file mode 100755 index 0000000..f7d1d93 --- /dev/null +++ b/html/images/flags/ar.png diff --git a/html/images/flags/as.png b/html/images/flags/as.png Binary files differnew file mode 100755 index 0000000..5e6b4cd --- /dev/null +++ b/html/images/flags/as.png diff --git a/html/images/flags/at.png b/html/images/flags/at.png Binary files differnew file mode 100755 index 0000000..d098a34 --- /dev/null +++ b/html/images/flags/at.png diff --git a/html/images/flags/au.png b/html/images/flags/au.png Binary files differnew file mode 100755 index 0000000..2539471 --- /dev/null +++ b/html/images/flags/au.png diff --git a/html/images/flags/aw.png b/html/images/flags/aw.png Binary files differnew file mode 100755 index 0000000..d0a9950 --- /dev/null +++ b/html/images/flags/aw.png diff --git a/html/images/flags/az.png b/html/images/flags/az.png Binary files differnew file mode 100755 index 0000000..38d856d --- /dev/null +++ b/html/images/flags/az.png diff --git a/html/images/flags/ba.png b/html/images/flags/ba.png Binary files differnew file mode 100755 index 0000000..a7802bc --- /dev/null +++ b/html/images/flags/ba.png diff --git a/html/images/flags/bb.png b/html/images/flags/bb.png Binary files differnew file mode 100755 index 0000000..205ab1f --- /dev/null +++ b/html/images/flags/bb.png diff --git a/html/images/flags/bd.png b/html/images/flags/bd.png Binary files differnew file mode 100755 index 0000000..f5d70f7 --- /dev/null +++ b/html/images/flags/bd.png diff --git a/html/images/flags/be.png b/html/images/flags/be.png Binary files differnew file mode 100755 index 0000000..cfc02c9 --- /dev/null +++ b/html/images/flags/be.png diff --git a/html/images/flags/bf.png b/html/images/flags/bf.png Binary files differnew file mode 100755 index 0000000..602d349 --- /dev/null +++ b/html/images/flags/bf.png diff --git a/html/images/flags/bg.png b/html/images/flags/bg.png Binary files differnew file mode 100755 index 0000000..41543f2 --- /dev/null +++ b/html/images/flags/bg.png diff --git a/html/images/flags/bh.png b/html/images/flags/bh.png Binary files differnew file mode 100755 index 0000000..ba1a0b3 --- /dev/null +++ b/html/images/flags/bh.png diff --git a/html/images/flags/bi.png b/html/images/flags/bi.png Binary files differnew file mode 100755 index 0000000..4a31c28 --- /dev/null +++ b/html/images/flags/bi.png diff --git a/html/images/flags/bj.png b/html/images/flags/bj.png Binary files differnew file mode 100755 index 0000000..3f633b2 --- /dev/null +++ b/html/images/flags/bj.png diff --git a/html/images/flags/bm.png b/html/images/flags/bm.png Binary files differnew file mode 100755 index 0000000..4226252 --- /dev/null +++ b/html/images/flags/bm.png diff --git a/html/images/flags/bn.png b/html/images/flags/bn.png Binary files differnew file mode 100755 index 0000000..7977797 --- /dev/null +++ b/html/images/flags/bn.png diff --git a/html/images/flags/bo.png b/html/images/flags/bo.png Binary files differnew file mode 100755 index 0000000..bcd0bed --- /dev/null +++ b/html/images/flags/bo.png diff --git a/html/images/flags/br.png b/html/images/flags/br.png Binary files differnew file mode 100755 index 0000000..006a820 --- /dev/null +++ b/html/images/flags/br.png diff --git a/html/images/flags/bs.png b/html/images/flags/bs.png Binary files differnew file mode 100755 index 0000000..c1f396b --- /dev/null +++ b/html/images/flags/bs.png diff --git a/html/images/flags/bt.png b/html/images/flags/bt.png Binary files differnew file mode 100755 index 0000000..dbc798a --- /dev/null +++ b/html/images/flags/bt.png diff --git a/html/images/flags/bv.png b/html/images/flags/bv.png Binary files differnew file mode 100755 index 0000000..bac14bc --- /dev/null +++ b/html/images/flags/bv.png diff --git a/html/images/flags/bw.png b/html/images/flags/bw.png Binary files differnew file mode 100755 index 0000000..0f578cb --- /dev/null +++ b/html/images/flags/bw.png diff --git a/html/images/flags/by.png b/html/images/flags/by.png Binary files differnew file mode 100755 index 0000000..f1e19f3 --- /dev/null +++ b/html/images/flags/by.png diff --git a/html/images/flags/bz.png b/html/images/flags/bz.png Binary files differnew file mode 100755 index 0000000..b9eb10d --- /dev/null +++ b/html/images/flags/bz.png diff --git a/html/images/flags/ca.png b/html/images/flags/ca.png Binary files differnew file mode 100755 index 0000000..0d4d74d --- /dev/null +++ b/html/images/flags/ca.png diff --git a/html/images/flags/cc.png b/html/images/flags/cc.png Binary files differnew file mode 100755 index 0000000..82310fa --- /dev/null +++ b/html/images/flags/cc.png diff --git a/html/images/flags/cd.png b/html/images/flags/cd.png Binary files differnew file mode 100755 index 0000000..05f14ca --- /dev/null +++ b/html/images/flags/cd.png diff --git a/html/images/flags/cf.png b/html/images/flags/cf.png Binary files differnew file mode 100755 index 0000000..c443e16 --- /dev/null +++ b/html/images/flags/cf.png diff --git a/html/images/flags/cg.png b/html/images/flags/cg.png Binary files differnew file mode 100755 index 0000000..503e7b3 --- /dev/null +++ b/html/images/flags/cg.png diff --git a/html/images/flags/ch.png b/html/images/flags/ch.png Binary files differnew file mode 100755 index 0000000..cf13acb --- /dev/null +++ b/html/images/flags/ch.png diff --git a/html/images/flags/ci.png b/html/images/flags/ci.png Binary files differnew file mode 100755 index 0000000..a25068b --- /dev/null +++ b/html/images/flags/ci.png diff --git a/html/images/flags/ck.png b/html/images/flags/ck.png Binary files differnew file mode 100755 index 0000000..e5a036d --- /dev/null +++ b/html/images/flags/ck.png diff --git a/html/images/flags/cl.png b/html/images/flags/cl.png Binary files differnew file mode 100755 index 0000000..bcacb1d --- /dev/null +++ b/html/images/flags/cl.png diff --git a/html/images/flags/cm.png b/html/images/flags/cm.png Binary files differnew file mode 100755 index 0000000..7ef0fec --- /dev/null +++ b/html/images/flags/cm.png diff --git a/html/images/flags/cn.png b/html/images/flags/cn.png Binary files differnew file mode 100755 index 0000000..c691364 --- /dev/null +++ b/html/images/flags/cn.png diff --git a/html/images/flags/co.png b/html/images/flags/co.png Binary files differnew file mode 100755 index 0000000..b7213de --- /dev/null +++ b/html/images/flags/co.png diff --git a/html/images/flags/cr.png b/html/images/flags/cr.png Binary files differnew file mode 100755 index 0000000..f8e7811 --- /dev/null +++ b/html/images/flags/cr.png diff --git a/html/images/flags/cs.png b/html/images/flags/cs.png Binary files differnew file mode 100755 index 0000000..33ea6c1 --- /dev/null +++ b/html/images/flags/cs.png diff --git a/html/images/flags/cu.png b/html/images/flags/cu.png Binary files differnew file mode 100755 index 0000000..4725b37 --- /dev/null +++ b/html/images/flags/cu.png diff --git a/html/images/flags/cv.png b/html/images/flags/cv.png Binary files differnew file mode 100755 index 0000000..5321516 --- /dev/null +++ b/html/images/flags/cv.png diff --git a/html/images/flags/cx.png b/html/images/flags/cx.png Binary files differnew file mode 100755 index 0000000..e197852 --- /dev/null +++ b/html/images/flags/cx.png diff --git a/html/images/flags/cy.png b/html/images/flags/cy.png Binary files differnew file mode 100755 index 0000000..94c1333 --- /dev/null +++ b/html/images/flags/cy.png diff --git a/html/images/flags/cz.png b/html/images/flags/cz.png Binary files differnew file mode 100755 index 0000000..0a3bedf --- /dev/null +++ b/html/images/flags/cz.png diff --git a/html/images/flags/de.png b/html/images/flags/de.png Binary files differnew file mode 100755 index 0000000..6971ba3 --- /dev/null +++ b/html/images/flags/de.png diff --git a/html/images/flags/dj.png b/html/images/flags/dj.png Binary files differnew file mode 100755 index 0000000..a9b2adf --- /dev/null +++ b/html/images/flags/dj.png diff --git a/html/images/flags/dk.png b/html/images/flags/dk.png Binary files differnew file mode 100755 index 0000000..8f34fe5 --- /dev/null +++ b/html/images/flags/dk.png diff --git a/html/images/flags/dm.png b/html/images/flags/dm.png Binary files differnew file mode 100755 index 0000000..31fa4cd --- /dev/null +++ b/html/images/flags/dm.png diff --git a/html/images/flags/do.png b/html/images/flags/do.png Binary files differnew file mode 100755 index 0000000..818b2ce --- /dev/null +++ b/html/images/flags/do.png diff --git a/html/images/flags/dz.png b/html/images/flags/dz.png Binary files differnew file mode 100755 index 0000000..0b1b336 --- /dev/null +++ b/html/images/flags/dz.png diff --git a/html/images/flags/ec.png b/html/images/flags/ec.png Binary files differnew file mode 100755 index 0000000..a9a1e8b --- /dev/null +++ b/html/images/flags/ec.png diff --git a/html/images/flags/ee.png b/html/images/flags/ee.png Binary files differnew file mode 100755 index 0000000..a8fc075 --- /dev/null +++ b/html/images/flags/ee.png diff --git a/html/images/flags/eg.png b/html/images/flags/eg.png Binary files differnew file mode 100755 index 0000000..02b02e5 --- /dev/null +++ b/html/images/flags/eg.png diff --git a/html/images/flags/eh.png b/html/images/flags/eh.png Binary files differnew file mode 100755 index 0000000..9f6cb1c --- /dev/null +++ b/html/images/flags/eh.png diff --git a/html/images/flags/er.png b/html/images/flags/er.png Binary files differnew file mode 100755 index 0000000..6811a68 --- /dev/null +++ b/html/images/flags/er.png diff --git a/html/images/flags/es.png b/html/images/flags/es.png Binary files differnew file mode 100755 index 0000000..bba29f5 --- /dev/null +++ b/html/images/flags/es.png diff --git a/html/images/flags/et.png b/html/images/flags/et.png Binary files differnew file mode 100755 index 0000000..d7904c9 --- /dev/null +++ b/html/images/flags/et.png diff --git a/html/images/flags/fi.png b/html/images/flags/fi.png Binary files differnew file mode 100755 index 0000000..9144a0f --- /dev/null +++ b/html/images/flags/fi.png diff --git a/html/images/flags/fj.png b/html/images/flags/fj.png Binary files differnew file mode 100755 index 0000000..fbe2eb6 --- /dev/null +++ b/html/images/flags/fj.png diff --git a/html/images/flags/fk.png b/html/images/flags/fk.png Binary files differnew file mode 100755 index 0000000..2b721f9 --- /dev/null +++ b/html/images/flags/fk.png diff --git a/html/images/flags/fm.png b/html/images/flags/fm.png Binary files differnew file mode 100755 index 0000000..1a91064 --- /dev/null +++ b/html/images/flags/fm.png diff --git a/html/images/flags/fo.png b/html/images/flags/fo.png Binary files differnew file mode 100755 index 0000000..5e17381 --- /dev/null +++ b/html/images/flags/fo.png diff --git a/html/images/flags/fr.png b/html/images/flags/fr.png Binary files differnew file mode 100755 index 0000000..b0c177f --- /dev/null +++ b/html/images/flags/fr.png diff --git a/html/images/flags/ga.png b/html/images/flags/ga.png Binary files differnew file mode 100755 index 0000000..744515d --- /dev/null +++ b/html/images/flags/ga.png diff --git a/html/images/flags/gb.png b/html/images/flags/gb.png Binary files differnew file mode 100755 index 0000000..ce4c90a --- /dev/null +++ b/html/images/flags/gb.png diff --git a/html/images/flags/gd.png b/html/images/flags/gd.png Binary files differnew file mode 100755 index 0000000..70467ac --- /dev/null +++ b/html/images/flags/gd.png diff --git a/html/images/flags/ge.png b/html/images/flags/ge.png Binary files differnew file mode 100755 index 0000000..3768ccd --- /dev/null +++ b/html/images/flags/ge.png diff --git a/html/images/flags/gf.png b/html/images/flags/gf.png Binary files differnew file mode 100755 index 0000000..d4616ed --- /dev/null +++ b/html/images/flags/gf.png diff --git a/html/images/flags/gh.png b/html/images/flags/gh.png Binary files differnew file mode 100755 index 0000000..3f3b980 --- /dev/null +++ b/html/images/flags/gh.png diff --git a/html/images/flags/gi.png b/html/images/flags/gi.png Binary files differnew file mode 100755 index 0000000..482c717 --- /dev/null +++ b/html/images/flags/gi.png diff --git a/html/images/flags/gl.png b/html/images/flags/gl.png Binary files differnew file mode 100755 index 0000000..39fb25e --- /dev/null +++ b/html/images/flags/gl.png diff --git a/html/images/flags/gm.png b/html/images/flags/gm.png Binary files differnew file mode 100755 index 0000000..95cce12 --- /dev/null +++ b/html/images/flags/gm.png diff --git a/html/images/flags/gn.png b/html/images/flags/gn.png Binary files differnew file mode 100755 index 0000000..5f8bba1 --- /dev/null +++ b/html/images/flags/gn.png diff --git a/html/images/flags/gp.png b/html/images/flags/gp.png Binary files differnew file mode 100755 index 0000000..5525d33 --- /dev/null +++ b/html/images/flags/gp.png diff --git a/html/images/flags/gq.png b/html/images/flags/gq.png Binary files differnew file mode 100755 index 0000000..2cbd4a8 --- /dev/null +++ b/html/images/flags/gq.png diff --git a/html/images/flags/gr.png b/html/images/flags/gr.png Binary files differnew file mode 100755 index 0000000..45b1589 --- /dev/null +++ b/html/images/flags/gr.png diff --git a/html/images/flags/gs.png b/html/images/flags/gs.png Binary files differnew file mode 100755 index 0000000..7706171 --- /dev/null +++ b/html/images/flags/gs.png diff --git a/html/images/flags/gt.png b/html/images/flags/gt.png Binary files differnew file mode 100755 index 0000000..6ecdbff --- /dev/null +++ b/html/images/flags/gt.png diff --git a/html/images/flags/gu.png b/html/images/flags/gu.png Binary files differnew file mode 100755 index 0000000..bce752f --- /dev/null +++ b/html/images/flags/gu.png diff --git a/html/images/flags/gw.png b/html/images/flags/gw.png Binary files differnew file mode 100755 index 0000000..5e70972 --- /dev/null +++ b/html/images/flags/gw.png diff --git a/html/images/flags/gy.png b/html/images/flags/gy.png Binary files differnew file mode 100755 index 0000000..2cb64d2 --- /dev/null +++ b/html/images/flags/gy.png diff --git a/html/images/flags/hk.png b/html/images/flags/hk.png Binary files differnew file mode 100755 index 0000000..5fb3aff --- /dev/null +++ b/html/images/flags/hk.png diff --git a/html/images/flags/hm.png b/html/images/flags/hm.png Binary files differnew file mode 100755 index 0000000..214924d --- /dev/null +++ b/html/images/flags/hm.png diff --git a/html/images/flags/hn.png b/html/images/flags/hn.png Binary files differnew file mode 100755 index 0000000..de08a36 --- /dev/null +++ b/html/images/flags/hn.png diff --git a/html/images/flags/hr.png b/html/images/flags/hr.png Binary files differnew file mode 100755 index 0000000..3d8d894 --- /dev/null +++ b/html/images/flags/hr.png diff --git a/html/images/flags/ht.png b/html/images/flags/ht.png Binary files differnew file mode 100755 index 0000000..dc6d443 --- /dev/null +++ b/html/images/flags/ht.png diff --git a/html/images/flags/hu.png b/html/images/flags/hu.png Binary files differnew file mode 100755 index 0000000..d9eb523 --- /dev/null +++ b/html/images/flags/hu.png diff --git a/html/images/flags/id.png b/html/images/flags/id.png Binary files differnew file mode 100755 index 0000000..f62aaaa --- /dev/null +++ b/html/images/flags/id.png diff --git a/html/images/flags/ie.png b/html/images/flags/ie.png Binary files differnew file mode 100755 index 0000000..c7be694 --- /dev/null +++ b/html/images/flags/ie.png diff --git a/html/images/flags/il.png b/html/images/flags/il.png Binary files differnew file mode 100755 index 0000000..4f8743e --- /dev/null +++ b/html/images/flags/il.png diff --git a/html/images/flags/in.png b/html/images/flags/in.png Binary files differnew file mode 100755 index 0000000..f1d201f --- /dev/null +++ b/html/images/flags/in.png diff --git a/html/images/flags/index.htm b/html/images/flags/index.htm new file mode 100755 index 0000000..e69de29 --- /dev/null +++ b/html/images/flags/index.htm diff --git a/html/images/flags/io.png b/html/images/flags/io.png Binary files differnew file mode 100755 index 0000000..9ece8ab --- /dev/null +++ b/html/images/flags/io.png diff --git a/html/images/flags/iq.png b/html/images/flags/iq.png Binary files differnew file mode 100755 index 0000000..80561ac --- /dev/null +++ b/html/images/flags/iq.png diff --git a/html/images/flags/ir.png b/html/images/flags/ir.png Binary files differnew file mode 100755 index 0000000..395c6e7 --- /dev/null +++ b/html/images/flags/ir.png diff --git a/html/images/flags/is.png b/html/images/flags/is.png Binary files differnew file mode 100755 index 0000000..bf733b5 --- /dev/null +++ b/html/images/flags/is.png diff --git a/html/images/flags/it.png b/html/images/flags/it.png Binary files differnew file mode 100755 index 0000000..480f387 --- /dev/null +++ b/html/images/flags/it.png diff --git a/html/images/flags/jm.png b/html/images/flags/jm.png Binary files differnew file mode 100755 index 0000000..1524b9e --- /dev/null +++ b/html/images/flags/jm.png diff --git a/html/images/flags/jo.png b/html/images/flags/jo.png Binary files differnew file mode 100755 index 0000000..4d25698 --- /dev/null +++ b/html/images/flags/jo.png diff --git a/html/images/flags/jp.png b/html/images/flags/jp.png Binary files differnew file mode 100755 index 0000000..5aacb34 --- /dev/null +++ b/html/images/flags/jp.png diff --git a/html/images/flags/ke.png b/html/images/flags/ke.png Binary files differnew file mode 100755 index 0000000..59c790a --- /dev/null +++ b/html/images/flags/ke.png diff --git a/html/images/flags/kg.png b/html/images/flags/kg.png Binary files differnew file mode 100755 index 0000000..9a02593 --- /dev/null +++ b/html/images/flags/kg.png diff --git a/html/images/flags/kh.png b/html/images/flags/kh.png Binary files differnew file mode 100755 index 0000000..8fad7cb --- /dev/null +++ b/html/images/flags/kh.png diff --git a/html/images/flags/ki.png b/html/images/flags/ki.png Binary files differnew file mode 100755 index 0000000..71c515a --- /dev/null +++ b/html/images/flags/ki.png diff --git a/html/images/flags/km.png b/html/images/flags/km.png Binary files differnew file mode 100755 index 0000000..f0aab2e --- /dev/null +++ b/html/images/flags/km.png diff --git a/html/images/flags/kn.png b/html/images/flags/kn.png Binary files differnew file mode 100755 index 0000000..887c87c --- /dev/null +++ b/html/images/flags/kn.png diff --git a/html/images/flags/kp.png b/html/images/flags/kp.png Binary files differnew file mode 100755 index 0000000..139afed --- /dev/null +++ b/html/images/flags/kp.png diff --git a/html/images/flags/kr.png b/html/images/flags/kr.png Binary files differnew file mode 100755 index 0000000..425c9a9 --- /dev/null +++ b/html/images/flags/kr.png diff --git a/html/images/flags/kw.png b/html/images/flags/kw.png Binary files differnew file mode 100755 index 0000000..a4c27ff --- /dev/null +++ b/html/images/flags/kw.png diff --git a/html/images/flags/ky.png b/html/images/flags/ky.png Binary files differnew file mode 100755 index 0000000..b9e233c --- /dev/null +++ b/html/images/flags/ky.png diff --git a/html/images/flags/kz.png b/html/images/flags/kz.png Binary files differnew file mode 100755 index 0000000..215c45c --- /dev/null +++ b/html/images/flags/kz.png diff --git a/html/images/flags/la.png b/html/images/flags/la.png Binary files differnew file mode 100755 index 0000000..fd70e04 --- /dev/null +++ b/html/images/flags/la.png diff --git a/html/images/flags/lb.png b/html/images/flags/lb.png Binary files differnew file mode 100755 index 0000000..cbc27a2 --- /dev/null +++ b/html/images/flags/lb.png diff --git a/html/images/flags/lc.png b/html/images/flags/lc.png Binary files differnew file mode 100755 index 0000000..b47370b --- /dev/null +++ b/html/images/flags/lc.png diff --git a/html/images/flags/li.png b/html/images/flags/li.png Binary files differnew file mode 100755 index 0000000..156079c --- /dev/null +++ b/html/images/flags/li.png diff --git a/html/images/flags/lk.png b/html/images/flags/lk.png Binary files differnew file mode 100755 index 0000000..91c7a51 --- /dev/null +++ b/html/images/flags/lk.png diff --git a/html/images/flags/lr.png b/html/images/flags/lr.png Binary files differnew file mode 100755 index 0000000..a779984 --- /dev/null +++ b/html/images/flags/lr.png diff --git a/html/images/flags/ls.png b/html/images/flags/ls.png Binary files differnew file mode 100755 index 0000000..377d7da --- /dev/null +++ b/html/images/flags/ls.png diff --git a/html/images/flags/lt.png b/html/images/flags/lt.png Binary files differnew file mode 100755 index 0000000..8cf8561 --- /dev/null +++ b/html/images/flags/lt.png diff --git a/html/images/flags/lu.png b/html/images/flags/lu.png Binary files differnew file mode 100755 index 0000000..0925952 --- /dev/null +++ b/html/images/flags/lu.png diff --git a/html/images/flags/lv.png b/html/images/flags/lv.png Binary files differnew file mode 100755 index 0000000..72511ac --- /dev/null +++ b/html/images/flags/lv.png diff --git a/html/images/flags/ly.png b/html/images/flags/ly.png Binary files differnew file mode 100755 index 0000000..c3ff32e --- /dev/null +++ b/html/images/flags/ly.png diff --git a/html/images/flags/ma.png b/html/images/flags/ma.png Binary files differnew file mode 100755 index 0000000..70f0912 --- /dev/null +++ b/html/images/flags/ma.png diff --git a/html/images/flags/mc.png b/html/images/flags/mc.png Binary files differnew file mode 100755 index 0000000..e28ffd6 --- /dev/null +++ b/html/images/flags/mc.png diff --git a/html/images/flags/md.png b/html/images/flags/md.png Binary files differnew file mode 100755 index 0000000..a48b555 --- /dev/null +++ b/html/images/flags/md.png diff --git a/html/images/flags/mg.png b/html/images/flags/mg.png Binary files differnew file mode 100755 index 0000000..7d59a91 --- /dev/null +++ b/html/images/flags/mg.png diff --git a/html/images/flags/mh.png b/html/images/flags/mh.png Binary files differnew file mode 100755 index 0000000..7463976 --- /dev/null +++ b/html/images/flags/mh.png diff --git a/html/images/flags/mk.png b/html/images/flags/mk.png Binary files differnew file mode 100755 index 0000000..2e72beb --- /dev/null +++ b/html/images/flags/mk.png diff --git a/html/images/flags/ml.png b/html/images/flags/ml.png Binary files differnew file mode 100755 index 0000000..36a632e --- /dev/null +++ b/html/images/flags/ml.png diff --git a/html/images/flags/mm.png b/html/images/flags/mm.png Binary files differnew file mode 100755 index 0000000..86ecd2c --- /dev/null +++ b/html/images/flags/mm.png diff --git a/html/images/flags/mn.png b/html/images/flags/mn.png Binary files differnew file mode 100755 index 0000000..22aa6cb --- /dev/null +++ b/html/images/flags/mn.png diff --git a/html/images/flags/mo.png b/html/images/flags/mo.png Binary files differnew file mode 100755 index 0000000..f22e255 --- /dev/null +++ b/html/images/flags/mo.png diff --git a/html/images/flags/mp.png b/html/images/flags/mp.png Binary files differnew file mode 100755 index 0000000..9cdccae --- /dev/null +++ b/html/images/flags/mp.png diff --git a/html/images/flags/mq.png b/html/images/flags/mq.png Binary files differnew file mode 100755 index 0000000..d4616ed --- /dev/null +++ b/html/images/flags/mq.png diff --git a/html/images/flags/mr.png b/html/images/flags/mr.png Binary files differnew file mode 100755 index 0000000..1460ab7 --- /dev/null +++ b/html/images/flags/mr.png diff --git a/html/images/flags/ms.png b/html/images/flags/ms.png Binary files differnew file mode 100755 index 0000000..31e6ef0 --- /dev/null +++ b/html/images/flags/ms.png diff --git a/html/images/flags/mt.png b/html/images/flags/mt.png Binary files differnew file mode 100755 index 0000000..bb243c5 --- /dev/null +++ b/html/images/flags/mt.png diff --git a/html/images/flags/mu.png b/html/images/flags/mu.png Binary files differnew file mode 100755 index 0000000..d8b22cc --- /dev/null +++ b/html/images/flags/mu.png diff --git a/html/images/flags/mv.png b/html/images/flags/mv.png Binary files differnew file mode 100755 index 0000000..0024b86 --- /dev/null +++ b/html/images/flags/mv.png diff --git a/html/images/flags/mw.png b/html/images/flags/mw.png Binary files differnew file mode 100755 index 0000000..975fb0a --- /dev/null +++ b/html/images/flags/mw.png diff --git a/html/images/flags/mx.png b/html/images/flags/mx.png Binary files differnew file mode 100755 index 0000000..98be90b --- /dev/null +++ b/html/images/flags/mx.png diff --git a/html/images/flags/my.png b/html/images/flags/my.png Binary files differnew file mode 100755 index 0000000..1865930 --- /dev/null +++ b/html/images/flags/my.png diff --git a/html/images/flags/mz.png b/html/images/flags/mz.png Binary files differnew file mode 100755 index 0000000..87672b7 --- /dev/null +++ b/html/images/flags/mz.png diff --git a/html/images/flags/na.png b/html/images/flags/na.png Binary files differnew file mode 100755 index 0000000..040daf2 --- /dev/null +++ b/html/images/flags/na.png diff --git a/html/images/flags/nc.png b/html/images/flags/nc.png Binary files differnew file mode 100755 index 0000000..bf6f02e --- /dev/null +++ b/html/images/flags/nc.png diff --git a/html/images/flags/ne.png b/html/images/flags/ne.png Binary files differnew file mode 100755 index 0000000..8e6eb32 --- /dev/null +++ b/html/images/flags/ne.png diff --git a/html/images/flags/nf.png b/html/images/flags/nf.png Binary files differnew file mode 100755 index 0000000..9060d53 --- /dev/null +++ b/html/images/flags/nf.png diff --git a/html/images/flags/ng.png b/html/images/flags/ng.png Binary files differnew file mode 100755 index 0000000..46dceb2 --- /dev/null +++ b/html/images/flags/ng.png diff --git a/html/images/flags/ni.png b/html/images/flags/ni.png Binary files differnew file mode 100755 index 0000000..4527065 --- /dev/null +++ b/html/images/flags/ni.png diff --git a/html/images/flags/nl.png b/html/images/flags/nl.png Binary files differnew file mode 100755 index 0000000..c078391 --- /dev/null +++ b/html/images/flags/nl.png diff --git a/html/images/flags/no.png b/html/images/flags/no.png Binary files differnew file mode 100755 index 0000000..d0073fd --- /dev/null +++ b/html/images/flags/no.png diff --git a/html/images/flags/np.png b/html/images/flags/np.png Binary files differnew file mode 100755 index 0000000..543c902 --- /dev/null +++ b/html/images/flags/np.png diff --git a/html/images/flags/nr.png b/html/images/flags/nr.png Binary files differnew file mode 100755 index 0000000..05ba8e1 --- /dev/null +++ b/html/images/flags/nr.png diff --git a/html/images/flags/nu.png b/html/images/flags/nu.png Binary files differnew file mode 100755 index 0000000..eafce7b --- /dev/null +++ b/html/images/flags/nu.png diff --git a/html/images/flags/nz.png b/html/images/flags/nz.png Binary files differnew file mode 100755 index 0000000..af703c0 --- /dev/null +++ b/html/images/flags/nz.png diff --git a/html/images/flags/om.png b/html/images/flags/om.png Binary files differnew file mode 100755 index 0000000..e1c9598 --- /dev/null +++ b/html/images/flags/om.png diff --git a/html/images/flags/pa.png b/html/images/flags/pa.png Binary files differnew file mode 100755 index 0000000..aca9541 --- /dev/null +++ b/html/images/flags/pa.png diff --git a/html/images/flags/pe.png b/html/images/flags/pe.png Binary files differnew file mode 100755 index 0000000..a801662 --- /dev/null +++ b/html/images/flags/pe.png diff --git a/html/images/flags/pf.png b/html/images/flags/pf.png Binary files differnew file mode 100755 index 0000000..cf4d029 --- /dev/null +++ b/html/images/flags/pf.png diff --git a/html/images/flags/pg.png b/html/images/flags/pg.png Binary files differnew file mode 100755 index 0000000..d704154 --- /dev/null +++ b/html/images/flags/pg.png diff --git a/html/images/flags/ph.png b/html/images/flags/ph.png Binary files differnew file mode 100755 index 0000000..55d850e --- /dev/null +++ b/html/images/flags/ph.png diff --git a/html/images/flags/pk.png b/html/images/flags/pk.png Binary files differnew file mode 100755 index 0000000..4c8ee9f --- /dev/null +++ b/html/images/flags/pk.png diff --git a/html/images/flags/pl.png b/html/images/flags/pl.png Binary files differnew file mode 100755 index 0000000..eb722dc --- /dev/null +++ b/html/images/flags/pl.png diff --git a/html/images/flags/pm.png b/html/images/flags/pm.png Binary files differnew file mode 100755 index 0000000..681bcd8 --- /dev/null +++ b/html/images/flags/pm.png diff --git a/html/images/flags/pn.png b/html/images/flags/pn.png Binary files differnew file mode 100755 index 0000000..f5743c5 --- /dev/null +++ b/html/images/flags/pn.png diff --git a/html/images/flags/pr.png b/html/images/flags/pr.png Binary files differnew file mode 100755 index 0000000..0536dcb --- /dev/null +++ b/html/images/flags/pr.png diff --git a/html/images/flags/ps.png b/html/images/flags/ps.png Binary files differnew file mode 100755 index 0000000..94c6512 --- /dev/null +++ b/html/images/flags/ps.png diff --git a/html/images/flags/pt.png b/html/images/flags/pt.png Binary files differnew file mode 100755 index 0000000..6cd086e --- /dev/null +++ b/html/images/flags/pt.png diff --git a/html/images/flags/pw.png b/html/images/flags/pw.png Binary files differnew file mode 100755 index 0000000..6ab9422 --- /dev/null +++ b/html/images/flags/pw.png diff --git a/html/images/flags/py.png b/html/images/flags/py.png Binary files differnew file mode 100755 index 0000000..2eab2bf --- /dev/null +++ b/html/images/flags/py.png diff --git a/html/images/flags/qa.png b/html/images/flags/qa.png Binary files differnew file mode 100755 index 0000000..0b8c897 --- /dev/null +++ b/html/images/flags/qa.png diff --git a/html/images/flags/re.png b/html/images/flags/re.png Binary files differnew file mode 100755 index 0000000..d4616ed --- /dev/null +++ b/html/images/flags/re.png diff --git a/html/images/flags/ro.png b/html/images/flags/ro.png Binary files differnew file mode 100755 index 0000000..ce0a889 --- /dev/null +++ b/html/images/flags/ro.png diff --git a/html/images/flags/ru.png b/html/images/flags/ru.png Binary files differnew file mode 100755 index 0000000..fb4f54a --- /dev/null +++ b/html/images/flags/ru.png diff --git a/html/images/flags/rw.png b/html/images/flags/rw.png Binary files differnew file mode 100755 index 0000000..774d035 --- /dev/null +++ b/html/images/flags/rw.png diff --git a/html/images/flags/sa.png b/html/images/flags/sa.png Binary files differnew file mode 100755 index 0000000..80b0a05 --- /dev/null +++ b/html/images/flags/sa.png diff --git a/html/images/flags/sb.png b/html/images/flags/sb.png Binary files differnew file mode 100755 index 0000000..7b75f5c --- /dev/null +++ b/html/images/flags/sb.png diff --git a/html/images/flags/sc.png b/html/images/flags/sc.png Binary files differnew file mode 100755 index 0000000..804ff98 --- /dev/null +++ b/html/images/flags/sc.png diff --git a/html/images/flags/sd.png b/html/images/flags/sd.png Binary files differnew file mode 100755 index 0000000..75229d5 --- /dev/null +++ b/html/images/flags/sd.png diff --git a/html/images/flags/se.png b/html/images/flags/se.png Binary files differnew file mode 100755 index 0000000..e13cc6f --- /dev/null +++ b/html/images/flags/se.png diff --git a/html/images/flags/sg.png b/html/images/flags/sg.png Binary files differnew file mode 100755 index 0000000..337b1be --- /dev/null +++ b/html/images/flags/sg.png diff --git a/html/images/flags/sh.png b/html/images/flags/sh.png Binary files differnew file mode 100755 index 0000000..c696327 --- /dev/null +++ b/html/images/flags/sh.png diff --git a/html/images/flags/si.png b/html/images/flags/si.png Binary files differnew file mode 100755 index 0000000..907b389 --- /dev/null +++ b/html/images/flags/si.png diff --git a/html/images/flags/sj.png b/html/images/flags/sj.png Binary files differnew file mode 100755 index 0000000..bac14bc --- /dev/null +++ b/html/images/flags/sj.png diff --git a/html/images/flags/sk.png b/html/images/flags/sk.png Binary files differnew file mode 100755 index 0000000..6ab7df8 --- /dev/null +++ b/html/images/flags/sk.png diff --git a/html/images/flags/sl.png b/html/images/flags/sl.png Binary files differnew file mode 100755 index 0000000..4c543da --- /dev/null +++ b/html/images/flags/sl.png diff --git a/html/images/flags/sm.png b/html/images/flags/sm.png Binary files differnew file mode 100755 index 0000000..fe0cace --- /dev/null +++ b/html/images/flags/sm.png diff --git a/html/images/flags/sn.png b/html/images/flags/sn.png Binary files differnew file mode 100755 index 0000000..e3edef7 --- /dev/null +++ b/html/images/flags/sn.png diff --git a/html/images/flags/so.png b/html/images/flags/so.png Binary files differnew file mode 100755 index 0000000..2c34d60 --- /dev/null +++ b/html/images/flags/so.png diff --git a/html/images/flags/sr.png b/html/images/flags/sr.png Binary files differnew file mode 100755 index 0000000..8ccf0c1 --- /dev/null +++ b/html/images/flags/sr.png diff --git a/html/images/flags/st.png b/html/images/flags/st.png Binary files differnew file mode 100755 index 0000000..c83b44c --- /dev/null +++ b/html/images/flags/st.png diff --git a/html/images/flags/sv.png b/html/images/flags/sv.png Binary files differnew file mode 100755 index 0000000..f6e2c2f --- /dev/null +++ b/html/images/flags/sv.png diff --git a/html/images/flags/sy.png b/html/images/flags/sy.png Binary files differnew file mode 100755 index 0000000..9f2dc3e --- /dev/null +++ b/html/images/flags/sy.png diff --git a/html/images/flags/sz.png b/html/images/flags/sz.png Binary files differnew file mode 100755 index 0000000..c880f71 --- /dev/null +++ b/html/images/flags/sz.png diff --git a/html/images/flags/tc.png b/html/images/flags/tc.png Binary files differnew file mode 100755 index 0000000..a4d1069 --- /dev/null +++ b/html/images/flags/tc.png diff --git a/html/images/flags/td.png b/html/images/flags/td.png Binary files differnew file mode 100755 index 0000000..cf8e057 --- /dev/null +++ b/html/images/flags/td.png diff --git a/html/images/flags/tf.png b/html/images/flags/tf.png Binary files differnew file mode 100755 index 0000000..88d2158 --- /dev/null +++ b/html/images/flags/tf.png diff --git a/html/images/flags/tg.png b/html/images/flags/tg.png Binary files differnew file mode 100755 index 0000000..c360da6 --- /dev/null +++ b/html/images/flags/tg.png diff --git a/html/images/flags/th.png b/html/images/flags/th.png Binary files differnew file mode 100755 index 0000000..eed829d --- /dev/null +++ b/html/images/flags/th.png diff --git a/html/images/flags/ti.png b/html/images/flags/ti.png Binary files differnew file mode 100755 index 0000000..6eacaf4 --- /dev/null +++ b/html/images/flags/ti.png diff --git a/html/images/flags/tj.png b/html/images/flags/tj.png Binary files differnew file mode 100755 index 0000000..efad9a5 --- /dev/null +++ b/html/images/flags/tj.png diff --git a/html/images/flags/tk.png b/html/images/flags/tk.png Binary files differnew file mode 100755 index 0000000..36a08b1 --- /dev/null +++ b/html/images/flags/tk.png diff --git a/html/images/flags/tl.png b/html/images/flags/tl.png Binary files differnew file mode 100755 index 0000000..b5df531 --- /dev/null +++ b/html/images/flags/tl.png diff --git a/html/images/flags/tm.png b/html/images/flags/tm.png Binary files differnew file mode 100755 index 0000000..88d2158 --- /dev/null +++ b/html/images/flags/tm.png diff --git a/html/images/flags/tn.png b/html/images/flags/tn.png Binary files differnew file mode 100755 index 0000000..3475a44 --- /dev/null +++ b/html/images/flags/tn.png diff --git a/html/images/flags/to.png b/html/images/flags/to.png Binary files differnew file mode 100755 index 0000000..7be6de8 --- /dev/null +++ b/html/images/flags/to.png diff --git a/html/images/flags/tp.png b/html/images/flags/tp.png Binary files differnew file mode 100755 index 0000000..c5884b6 --- /dev/null +++ b/html/images/flags/tp.png diff --git a/html/images/flags/tr.png b/html/images/flags/tr.png Binary files differnew file mode 100755 index 0000000..d9dfbb8 --- /dev/null +++ b/html/images/flags/tr.png diff --git a/html/images/flags/tt.png b/html/images/flags/tt.png Binary files differnew file mode 100755 index 0000000..5b37c6f --- /dev/null +++ b/html/images/flags/tt.png diff --git a/html/images/flags/tv.png b/html/images/flags/tv.png Binary files differnew file mode 100755 index 0000000..23614ac --- /dev/null +++ b/html/images/flags/tv.png diff --git a/html/images/flags/tw.png b/html/images/flags/tw.png Binary files differnew file mode 100755 index 0000000..9787569 --- /dev/null +++ b/html/images/flags/tw.png diff --git a/html/images/flags/tz.png b/html/images/flags/tz.png Binary files differnew file mode 100755 index 0000000..3d39b1b --- /dev/null +++ b/html/images/flags/tz.png diff --git a/html/images/flags/ua.png b/html/images/flags/ua.png Binary files differnew file mode 100755 index 0000000..1fbe64c --- /dev/null +++ b/html/images/flags/ua.png diff --git a/html/images/flags/ug.png b/html/images/flags/ug.png Binary files differnew file mode 100755 index 0000000..3a7f3a4 --- /dev/null +++ b/html/images/flags/ug.png diff --git a/html/images/flags/uk.png b/html/images/flags/uk.png Binary files differnew file mode 100755 index 0000000..ce4c90a --- /dev/null +++ b/html/images/flags/uk.png diff --git a/html/images/flags/um.png b/html/images/flags/um.png Binary files differnew file mode 100755 index 0000000..a21bdc5 --- /dev/null +++ b/html/images/flags/um.png diff --git a/html/images/flags/us.png b/html/images/flags/us.png Binary files differnew file mode 100755 index 0000000..d2eacb2 --- /dev/null +++ b/html/images/flags/us.png diff --git a/html/images/flags/uy.png b/html/images/flags/uy.png Binary files differnew file mode 100755 index 0000000..e279248 --- /dev/null +++ b/html/images/flags/uy.png diff --git a/html/images/flags/uz.png b/html/images/flags/uz.png Binary files differnew file mode 100755 index 0000000..456d359 --- /dev/null +++ b/html/images/flags/uz.png diff --git a/html/images/flags/va.png b/html/images/flags/va.png Binary files differnew file mode 100755 index 0000000..c3c20ba --- /dev/null +++ b/html/images/flags/va.png diff --git a/html/images/flags/vc.png b/html/images/flags/vc.png Binary files differnew file mode 100755 index 0000000..6824712 --- /dev/null +++ b/html/images/flags/vc.png diff --git a/html/images/flags/ve.png b/html/images/flags/ve.png Binary files differnew file mode 100755 index 0000000..ef96a14 --- /dev/null +++ b/html/images/flags/ve.png diff --git a/html/images/flags/vg.png b/html/images/flags/vg.png Binary files differnew file mode 100755 index 0000000..66c42a1 --- /dev/null +++ b/html/images/flags/vg.png diff --git a/html/images/flags/vi.png b/html/images/flags/vi.png Binary files differnew file mode 100755 index 0000000..8ff456e --- /dev/null +++ b/html/images/flags/vi.png diff --git a/html/images/flags/vn.png b/html/images/flags/vn.png Binary files differnew file mode 100755 index 0000000..36e2155 --- /dev/null +++ b/html/images/flags/vn.png diff --git a/html/images/flags/vu.png b/html/images/flags/vu.png Binary files differnew file mode 100755 index 0000000..4962e7b --- /dev/null +++ b/html/images/flags/vu.png diff --git a/html/images/flags/wf.png b/html/images/flags/wf.png Binary files differnew file mode 100755 index 0000000..d4616ed --- /dev/null +++ b/html/images/flags/wf.png diff --git a/html/images/flags/ws.png b/html/images/flags/ws.png Binary files differnew file mode 100755 index 0000000..dd4e683 --- /dev/null +++ b/html/images/flags/ws.png diff --git a/html/images/flags/xx.png b/html/images/flags/xx.png Binary files differnew file mode 100755 index 0000000..cd2dafb --- /dev/null +++ b/html/images/flags/xx.png diff --git a/html/images/flags/ye.png b/html/images/flags/ye.png Binary files differnew file mode 100755 index 0000000..87463a8 --- /dev/null +++ b/html/images/flags/ye.png diff --git a/html/images/flags/yt.png b/html/images/flags/yt.png Binary files differnew file mode 100755 index 0000000..d4616ed --- /dev/null +++ b/html/images/flags/yt.png diff --git a/html/images/flags/yu.png b/html/images/flags/yu.png Binary files differnew file mode 100755 index 0000000..33ea6c1 --- /dev/null +++ b/html/images/flags/yu.png diff --git a/html/images/flags/za.png b/html/images/flags/za.png Binary files differnew file mode 100755 index 0000000..e10ff5a --- /dev/null +++ b/html/images/flags/za.png diff --git a/html/images/flags/zm.png b/html/images/flags/zm.png Binary files differnew file mode 100755 index 0000000..4fe4cbe --- /dev/null +++ b/html/images/flags/zm.png diff --git a/html/images/flags/zw.png b/html/images/flags/zw.png Binary files differnew file mode 100755 index 0000000..413ae62 --- /dev/null +++ b/html/images/flags/zw.png diff --git a/html/images/fonts/arbocrest.ttf b/html/images/fonts/arbocrest.ttf Binary files differnew file mode 100755 index 0000000..934f65e --- /dev/null +++ b/html/images/fonts/arbocrest.ttf diff --git a/html/images/fonts/arbocrest.txt b/html/images/fonts/arbocrest.txt new file mode 100755 index 0000000..ecc9bf4 --- /dev/null +++ b/html/images/fonts/arbocrest.txt @@ -0,0 +1,36 @@ +------------------------------------------------------------------------
+ShyFonts Freeware Terms of Use
+------------------------------------------------------------------------
+
+By downloading this font package you agree to the following terms
+of use:
+
+ - This FONT PACKAGE is freeware.
+
+ - This FONT PACKAGE may be distributed ONLY via the Internet for
+ FREE. Under NO circumstances may this FONT PACKAGE be sold for
+ a profit nor be included as part of another product or CD-ROM
+ compilation. If you wish to include this FONT PACKAGE for FREE
+ distribution on your Web Site, please include all of the fonts
+ and original documentation supplied with this FONT PACKAGE.
+
+ - You may install and use this FONT PACKAGE on an unlimited
+ amount of machines.
+
+ - You may NOT rename, edit, or create any alternate variations of
+ the fonts included in this FONT PACKAGE.
+
+ - This FONT PACKAGE comes "as is" with NO warranty whatsoever.
+ SHYFONTS accepts NO responsibility for any damages or loss of
+ any kind due to the use of this FONT PACKAGE. The use of this
+ FONT PACKAGE is solely your responsibility -- you use this FONT
+ PACKAGE at your own risk.
+
+ - Enjoy the fonts!
+
+If you have any question regarding this document or the usage of
+this font package, feel free to contact us at info@shyfonts.com.
+Thank you for downloading this font package and enjoy!
+
+------------------------------------------------------------------------
+Š1999 ShyFonts Type Foundry -- http://www.shyfonts.com
\ No newline at end of file diff --git a/html/images/fonts/index.htm b/html/images/fonts/index.htm new file mode 100755 index 0000000..e69de29 --- /dev/null +++ b/html/images/fonts/index.htm diff --git a/html/images/index.htm b/html/images/index.htm new file mode 100755 index 0000000..e69de29 --- /dev/null +++ b/html/images/index.htm diff --git a/html/images/magnify.gif b/html/images/magnify.gif Binary files differnew file mode 100755 index 0000000..18119f2 --- /dev/null +++ b/html/images/magnify.gif diff --git a/html/images/maps/blank.jpg b/html/images/maps/blank.jpg Binary files differnew file mode 100755 index 0000000..f63726c --- /dev/null +++ b/html/images/maps/blank.jpg diff --git a/html/images/maps/index.htm b/html/images/maps/index.htm new file mode 100755 index 0000000..e69de29 --- /dev/null +++ b/html/images/maps/index.htm diff --git a/html/images/ranks/1.png b/html/images/ranks/1.png Binary files differnew file mode 100755 index 0000000..8b89495 --- /dev/null +++ b/html/images/ranks/1.png diff --git a/html/images/ranks/2.png b/html/images/ranks/2.png Binary files differnew file mode 100755 index 0000000..5942ac0 --- /dev/null +++ b/html/images/ranks/2.png diff --git a/html/images/ranks/3.png b/html/images/ranks/3.png Binary files differnew file mode 100755 index 0000000..6c5b6d6 --- /dev/null +++ b/html/images/ranks/3.png diff --git a/html/images/ranks/down.png b/html/images/ranks/down.png Binary files differnew file mode 100755 index 0000000..e6a4976 --- /dev/null +++ b/html/images/ranks/down.png diff --git a/html/images/ranks/index.htm b/html/images/ranks/index.htm new file mode 100755 index 0000000..e69de29 --- /dev/null +++ b/html/images/ranks/index.htm diff --git a/html/images/ranks/same.png b/html/images/ranks/same.png Binary files differnew file mode 100755 index 0000000..81a5ed8 --- /dev/null +++ b/html/images/ranks/same.png diff --git a/html/images/ranks/up.png b/html/images/ranks/up.png Binary files differnew file mode 100755 index 0000000..8e8a64a --- /dev/null +++ b/html/images/ranks/up.png diff --git a/html/images/s_asc.png b/html/images/s_asc.png Binary files differnew file mode 100755 index 0000000..9990376 --- /dev/null +++ b/html/images/s_asc.png diff --git a/html/images/s_desc.png b/html/images/s_desc.png Binary files differnew file mode 100755 index 0000000..a03226d --- /dev/null +++ b/html/images/s_desc.png diff --git a/html/images/sidebar.gif b/html/images/sidebar.gif Binary files differnew file mode 100755 index 0000000..49d4efe --- /dev/null +++ b/html/images/sidebar.gif diff --git a/html/images/statslogo.gif b/html/images/statslogo.gif Binary files differnew file mode 100755 index 0000000..9557cd7 --- /dev/null +++ b/html/images/statslogo.gif diff --git a/html/images/templates/basic.png b/html/images/templates/basic.png Binary files differnew file mode 100755 index 0000000..7cf650a --- /dev/null +++ b/html/images/templates/basic.png diff --git a/html/images/templates/err_banned.png b/html/images/templates/err_banned.png Binary files differnew file mode 100755 index 0000000..53105cf --- /dev/null +++ b/html/images/templates/err_banned.png diff --git a/html/images/templates/err_disabled.png b/html/images/templates/err_disabled.png Binary files differnew file mode 100755 index 0000000..cd5f8bc --- /dev/null +++ b/html/images/templates/err_disabled.png diff --git a/html/images/templates/err_na.png b/html/images/templates/err_na.png Binary files differnew file mode 100755 index 0000000..d47ec58 --- /dev/null +++ b/html/images/templates/err_na.png diff --git a/html/images/templates/err_no_ft.png b/html/images/templates/err_no_ft.png Binary files differnew file mode 100755 index 0000000..6899499 --- /dev/null +++ b/html/images/templates/err_no_ft.png diff --git a/html/images/templates/err_no_gd.png b/html/images/templates/err_no_gd.png Binary files differnew file mode 100755 index 0000000..8f4f504 --- /dev/null +++ b/html/images/templates/err_no_gd.png diff --git a/html/images/templates/index.htm b/html/images/templates/index.htm new file mode 100755 index 0000000..e69de29 --- /dev/null +++ b/html/images/templates/index.htm diff --git a/html/images/unwatch.png b/html/images/unwatch.png Binary files differnew file mode 100755 index 0000000..724a95a --- /dev/null +++ b/html/images/unwatch.png diff --git a/html/images/utlogo.gif b/html/images/utlogo.gif Binary files differnew file mode 100755 index 0000000..4cc5c6e --- /dev/null +++ b/html/images/utlogo.gif diff --git a/html/images/watch.png b/html/images/watch.png Binary files differnew file mode 100755 index 0000000..3a1230d --- /dev/null +++ b/html/images/watch.png diff --git a/html/images/watermark.png b/html/images/watermark.png Binary files differnew file mode 100755 index 0000000..6ce8859 --- /dev/null +++ b/html/images/watermark.png diff --git a/html/images/weapons/avenger.jpg b/html/images/weapons/avenger.jpg Binary files differnew file mode 100755 index 0000000..8a7b949 --- /dev/null +++ b/html/images/weapons/avenger.jpg diff --git a/html/images/weapons/bio.jpg b/html/images/weapons/bio.jpg Binary files differnew file mode 100755 index 0000000..a43d0b0 --- /dev/null +++ b/html/images/weapons/bio.jpg diff --git a/html/images/weapons/blank.jpg b/html/images/weapons/blank.jpg Binary files differnew file mode 100755 index 0000000..c8fac8b --- /dev/null +++ b/html/images/weapons/blank.jpg diff --git a/html/images/weapons/chainsaw.jpg b/html/images/weapons/chainsaw.jpg Binary files differnew file mode 100755 index 0000000..0e52c9b --- /dev/null +++ b/html/images/weapons/chainsaw.jpg diff --git a/html/images/weapons/creepinator.jpg b/html/images/weapons/creepinator.jpg Binary files differnew file mode 100755 index 0000000..3a604ba --- /dev/null +++ b/html/images/weapons/creepinator.jpg diff --git a/html/images/weapons/deemer.jpg b/html/images/weapons/deemer.jpg Binary files differnew file mode 100755 index 0000000..9eab790 --- /dev/null +++ b/html/images/weapons/deemer.jpg diff --git a/html/images/weapons/enforcer.jpg b/html/images/weapons/enforcer.jpg Binary files differnew file mode 100755 index 0000000..398ae87 --- /dev/null +++ b/html/images/weapons/enforcer.jpg diff --git a/html/images/weapons/enforcer2.jpg b/html/images/weapons/enforcer2.jpg Binary files differnew file mode 100755 index 0000000..ccddb61 --- /dev/null +++ b/html/images/weapons/enforcer2.jpg diff --git a/html/images/weapons/fighter.jpg b/html/images/weapons/fighter.jpg Binary files differnew file mode 100755 index 0000000..3778819 --- /dev/null +++ b/html/images/weapons/fighter.jpg diff --git a/html/images/weapons/flak.jpg b/html/images/weapons/flak.jpg Binary files differnew file mode 100755 index 0000000..df163de --- /dev/null +++ b/html/images/weapons/flak.jpg diff --git a/html/images/weapons/gandi.jpg b/html/images/weapons/gandi.jpg Binary files differnew file mode 100755 index 0000000..8af7341 --- /dev/null +++ b/html/images/weapons/gandi.jpg diff --git a/html/images/weapons/impact.jpg b/html/images/weapons/impact.jpg Binary files differnew file mode 100755 index 0000000..d95a729 --- /dev/null +++ b/html/images/weapons/impact.jpg diff --git a/html/images/weapons/index.htm b/html/images/weapons/index.htm new file mode 100755 index 0000000..e69de29 --- /dev/null +++ b/html/images/weapons/index.htm diff --git a/html/images/weapons/ishock.jpg b/html/images/weapons/ishock.jpg Binary files differnew file mode 100755 index 0000000..e0c14bd --- /dev/null +++ b/html/images/weapons/ishock.jpg diff --git a/html/images/weapons/minigun.jpg b/html/images/weapons/minigun.jpg Binary files differnew file mode 100755 index 0000000..55ce638 --- /dev/null +++ b/html/images/weapons/minigun.jpg diff --git a/html/images/weapons/pulse.jpg b/html/images/weapons/pulse.jpg Binary files differnew file mode 100755 index 0000000..7f714c4 --- /dev/null +++ b/html/images/weapons/pulse.jpg diff --git a/html/images/weapons/ripper.jpg b/html/images/weapons/ripper.jpg Binary files differnew file mode 100755 index 0000000..d8cff4b --- /dev/null +++ b/html/images/weapons/ripper.jpg diff --git a/html/images/weapons/rockets.jpg b/html/images/weapons/rockets.jpg Binary files differnew file mode 100755 index 0000000..8dd9ce5 --- /dev/null +++ b/html/images/weapons/rockets.jpg diff --git a/html/images/weapons/shock.jpg b/html/images/weapons/shock.jpg Binary files differnew file mode 100755 index 0000000..7509301 --- /dev/null +++ b/html/images/weapons/shock.jpg diff --git a/html/images/weapons/slv.jpg b/html/images/weapons/slv.jpg Binary files differnew file mode 100755 index 0000000..16b3b3b --- /dev/null +++ b/html/images/weapons/slv.jpg diff --git a/html/images/weapons/sniper.jpg b/html/images/weapons/sniper.jpg Binary files differnew file mode 100755 index 0000000..0f00cdb --- /dev/null +++ b/html/images/weapons/sniper.jpg diff --git a/html/images/weapons/titan.jpg b/html/images/weapons/titan.jpg Binary files differnew file mode 100755 index 0000000..1bfb246 --- /dev/null +++ b/html/images/weapons/titan.jpg diff --git a/html/images/weapons/trans.jpg b/html/images/weapons/trans.jpg Binary files differnew file mode 100755 index 0000000..86e720e --- /dev/null +++ b/html/images/weapons/trans.jpg diff --git a/html/import.php b/html/import.php new file mode 100755 index 0000000..250e841 --- /dev/null +++ b/html/import.php @@ -0,0 +1,920 @@ +<?php
+function add_info($name, $value) {
+ if ($value == '' or $value === NULL) return('');
+ return(htmlentities($name) ." ". htmlentities($value) ."<br>");
+}
+
+?>
+<?php
+@ignore_user_abort(true);
+@set_time_limit(0);
+if (isset($_REQUEST['rememberkey'])) setcookie('uts_importkey', $_REQUEST['key'], time()+60*60*24*30*365);
+if (isset($_COOKIE['uts_importkey'])) $adminkey = $_REQUEST['uts_importkey'];
+require ("includes/config.php");
+require ("includes/functions.php");
+
+$compatible_actor_versions = array('0.4.0', '0.4.1', '0.4.2', 'beta 4.0', 'beta 4.1', 'beta 4.2');
+
+
+// Get key from web browser
+if (isset($_REQUEST['key'])) $adminkey = $_REQUEST['key'];
+if (!isset($adminkey)) $adminkey = '';
+
+// Debugging mode?
+$debug = isset($_REQUEST['debug']) ? $_REQUEST['debug'] : false;
+
+// Output HTML?
+$html = isset($_REQUEST['html']) ? $_REQUEST['html'] : true;
+
+
+
+
+// Were running from the command line (cron-jobs)
+if (php_sapi_name() == 'cli' or !isset($_SERVER['SERVER_PORT']) or !$_SERVER['SERVER_PORT']) {
+ // No password needed when in cli mode.
+ $adminkey = $import_adminkey;
+ // There is no time limit when running the cli. And no page to reload :)
+ $import_reload_after = 0;
+ // No browser, no HTML
+ $html = false;
+ // Chdir to our homedir
+ if (!empty($import_homedir)) chdir($import_homedir);
+}
+
+if ($html) include ("includes/header.php");
+
+DeBugMessage("Execute: import.php");
+
+if ($html) {
+ echo'<table class = "box" border="0" cellpadding="1" cellspacing="2" width="720">
+ <tr>
+ <td class="heading" align="center" colspan="2">Importing Latest Log Files</td>
+ </tr>';
+}
+
+
+IF (empty($import_adminkey)) {
+ if ($html) echo'<tr><td class="smheading" align="left" width="150">Error:</td><td class="grey" align="left">';
+ echo "\$import_adminkey not set in config.php!\n";
+ if ($html) {
+ echo '</td></tr></table>';
+ include("includes/footer.php");
+ }
+ return;
+}
+
+IF (!empty($adminkey) and $adminkey != $import_adminkey) {
+ if ($html) echo'<tr><td class="smheading" align="left" width="150">Error:</td><td class="grey" align="left">';
+ echo "Keys do not match\n";
+ $adminkey = '';
+ if (!$html) return;
+}
+
+IF (empty($adminkey)) {
+ if (!$html) die('Please provide the adminkey' ."\n");
+ echo'<tr>
+ <td class="smheading" align="left" width="150">Enter Admin key:</td>
+ <td class="grey" align="left"><form NAME="adminkey" ACTION="import.php">
+ <input TYPE="text" NAME="key" MAXLENGTH="35" SIZE="20" CLASS="searchform">
+ <input TYPE="submit" VALUE="Submit" CLASS="searchformb">
+ <input TYPE="checkbox" NAME="rememberkey"> Remember the key
+ </form></td>
+ </tr></table>';
+ include("includes/footer.php");
+ return;
+}
+
+
+IF (!@is_dir('logs')) {
+ if ($html) echo'<tr><td class="smheading" align="left" width="150">Error:</td><td class="grey" align="left">';
+ echo "Can't find the logs directory!\n";
+ if ($html) echo "<br>";
+ echo "Current working directory is: ". getcwd() ."\n";
+ if ($html) echo "<br>";
+ if (!$html) echo "You forgot to cd to my home directory? Take a look at \$import_homedir in config.php.\n";
+ if ($html) {
+ echo '</td></tr></table>';
+ include("includes/footer.php");
+ }
+ return;
+}
+
+
+
+if ($html) echo'</table><br>';
+echo "\n";
+
+$start_time = time();
+$files = isset($_REQUEST['files']) ? $_REQUEST['files'] : 0;
+$elapsed = isset($_REQUEST['elapsed']) ? $_REQUEST['elapsed'] : 0;
+
+if ($ftp_use and !isset($_GET['no_ftp'])) {
+ DeBugMessage("Use ftp: yes\n\$ftp_use: " . gettype($ftp_use) . ":". var_export($ftp_use, true));
+ require("includes/ftp.php");
+ $elapsed = $elapsed - (time() - $start_time);
+}
+else {
+ ob_flush();
+ DeBugMessage("Use ftp: no\n\$ftp_use: " . gettype($ftp_use) . ":". var_export($ftp_use, true));
+}
+
+
+$logdir = opendir('logs');
+
+DeBugMessage("Open logdir and read logs");
+
+while (false !== ($filename = readdir($logdir)))
+{
+// Our (self set) timelimit exceeded => reload the page to prevent srcipt abort
+ if (!empty($import_reload_after) and $start_time + $import_reload_after <= time()) {
+ if (!$html) die('Time limit exceeded - unable to reload page (no HTML output)' ."\n");
+
+ $elapsed = $elapsed + time() - $start_time;
+ $target = $PHP_SELF ."?key=". urlencode($adminkey) ."&".str_rand()."=".str_rand()."&no_ftp=1&debug=$debug&files=$files&elapsed=$elapsed";
+ echo '<meta http-equiv="refresh" content="2;URL='. $target .'">';
+
+ echo'<br><table class = "box" border="0" cellpadding="1" cellspacing="2" width="720">
+ <tr>
+ <td class="heading" align="center" colspan="2">Maximum execution time exeeded; restarting ...</td>
+ </tr>
+ </table>';
+
+ include("includes/footer.php");
+ return;
+ }
+
+ $oldfilename = $filename;
+ $filename = 'logs/' . $filename;
+ $backupfilename = 'logs/backup/' . $oldfilename;
+
+ // UTDC log: Move to logs/utdc/
+ if ($import_utdc_download_enable
+ and substr($filename, strlen($filename) - strlen($import_utdc_log_extension)) == $import_utdc_log_extension
+ and substr($oldfilename, 0, strlen($import_utdc_log_start)) == $import_utdc_log_start) {
+ if ($import_utdc_log_compress == 'no') $import_utdc_log_compress = 'yes';
+ if ($html) {
+ echo'<table class="box" border="0" cellpadding="1" cellspacing="2">
+ <tr>
+ <td class="smheading" align="center" height="25" width="550" colspan="2">UTDC log: '.$oldfilename.'</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="left" width="350">';
+ } else {
+ echo "UTDC log: $oldfilename:\n";
+ }
+ echo 'Moving to logs/utdc/: ';
+ if ($html) echo '</td><td class="grey" align="left" width="200">';
+ echo backup_logfile($import_utdc_log_compress, $filename, 'logs/utdc/'.$oldfilename, true) . "\n";
+ if ($html) echo '</td></tr></table><br>';
+ echo "\n\n";
+ unlink($filename);
+ continue;
+ }
+
+ // UTDC shot: Move to logs/utdc/
+ if ($import_utdc_download_enable
+ and substr($filename, strlen($filename) - strlen($import_utdc_screenshot_extension)) == $import_utdc_screenshot_extension
+ and substr($oldfilename, 0, strlen($import_utdc_screenshot_start)) == $import_utdc_screenshot_start) {
+ if ($import_utdc_log_compress == 'no') $import_utdc_log_compress = 'yes';
+ if ($html) {
+ echo'<table class="box" border="0" cellpadding="1" cellspacing="2">
+ <tr>
+ <td class="smheading" align="center" height="25" width="550" colspan="2">UTDC log: '.$oldfilename.'</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="left" width="350">';
+ } else {
+ echo "UTDC log: $oldfilename:\n";
+ }
+ echo 'Moving to logs/utdc/: ';
+ if ($html) echo '</td><td class="grey" align="left" width="200">';
+ echo backup_logfile("none", $filename, 'logs/utdc/'.$oldfilename, true) . "\n";
+ if ($html) echo '</td></tr></table><br>';
+ echo "\n\n";
+ unlink($filename);
+ continue;
+ }
+
+ // ACE log: Move to logs/ace/
+ if ($import_ace_download_enable
+ and substr($filename, strlen($filename) - strlen($import_ace_log_extension)) == $import_ace_log_extension
+ and substr($oldfilename, 0, strlen($import_ace_log_start)) == $import_ace_log_start) {
+ if ($import_ace_log_compress == 'no') $import_ace_log_compress = 'yes';
+ if ($html) {
+ echo'<table class="box" border="0" cellpadding="1" cellspacing="2">
+ <tr>
+ <td class="smheading" align="center" height="25" width="550" colspan="2">ACE log: '.$oldfilename.'</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="left" width="350">';
+ } else {
+ echo "ACE log: $oldfilename:\n";
+ }
+ echo 'Moving to logs/ace/: ';
+ if ($html) echo '</td><td class="grey" align="left" width="200">';
+ echo backup_logfile($import_ace_log_compress, $filename, 'logs/ace/'.$oldfilename, true) . "\n";
+ if ($html) echo '</td></tr></table><br>';
+ echo "\n\n";
+ unlink($filename);
+ continue;
+ }
+
+ if ($import_ace_download_enable
+ and substr($filename, strlen($filename) - strlen($import_ace_screenshot_extension)) == $import_ace_screenshot_extension
+ and substr($oldfilename, 0, strlen($import_ace_screenshot_start)) == $import_ace_screenshot_start) {
+ if ($html) {
+ echo'<table class="box" border="0" cellpadding="1" cellspacing="2">
+ <tr>
+ <td class="smheading" align="center" height="25" width="550" colspan="2">ACE Screenshot: '.$oldfilename.'</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="left" width="350">';
+ } else {
+ echo "ACE screenshot: $oldfilename:\n";
+ }
+ echo 'Moving to logs/ace/: ';
+ if ($html) echo '</td><td class="grey" align="left" width="200">';
+ echo backup_logfile("none", $filename, 'logs/ace/'.$oldfilename, false) . "\n";
+ if ($html) echo '</td></tr></table><br>';
+ echo "\n\n";
+ unlink($filename);
+ continue;
+ }
+
+
+
+ // AnthChecker log: Move to logs/ac/
+ if ($import_ac_download_enable
+ and substr($filename, strlen($filename) - strlen($import_ac_log_extension)) == $import_ac_log_extension
+ and substr($oldfilename, 0, strlen($import_ac_log_start)) == $import_ac_log_start) {
+ if ($import_ac_log_compress == 'no') $import_ac_log_compress = 'yes';
+ if ($html) {
+ echo'<table class="box" border="0" cellpadding="1" cellspacing="2">
+ <tr>
+ <td class="smheading" align="center" height="25" width="550" colspan="2">AC log: '.$oldfilename.'</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="left" width="350">';
+ } else {
+ echo "AC log: $oldfilename:\n";
+ }
+ echo 'Moving to logs/ac/: ';
+ if ($html) echo '</td><td class="grey" align="left" width="200">';
+ echo backup_logfile($import_ac_log_compress, $filename, 'logs/ac/'.$oldfilename, true) . "\n";
+ if ($html) echo '</td></tr></table><br>';
+ echo "\n\n";
+ unlink($filename);
+ continue;
+ }
+
+ if(substr($filename, strlen($filename) - strlen($import_log_extension)) != $import_log_extension) continue;
+ if(substr($oldfilename, 0, strlen($import_log_start)) != $import_log_start) continue;
+
+ // Create a unique ID
+ $uid = str_rand();
+
+ // Check if there are any logs to do ...
+
+ // Create our temp Table
+
+ for (;;) {
+ $sql = "CREATE ". ($import_use_temporary_tables ? 'TEMPORARY ' : '') ."TABLE `uts_temp_$uid` (
+ `id` mediumint(5) NOT NULL,
+ `col0` char(20) NOT NULL default '',
+ `col1` char(120) NOT NULL default '',
+ `col2` char(120) NOT NULL default '',
+ `col3` char(120) NOT NULL default '',
+ `col4` char(120) NOT NULL default '',
+ KEY `part1` (`col1` (20),`col2` (20)),
+ KEY `part2` (`col0` (20),`col1` (20),`col2` (20)),
+ KEY `full` (`col0` (20),`col1` (20),`col2` (20),`col3` (20),`col4` (20))
+ ) TYPE=". ($import_use_heap_tables ? 'HEAP' : 'MyISAM') .";";
+
+ $result = mysql_query($sql);
+ if ($result) break;
+
+ if (mysql_errno() == 1044 and $import_use_temporary_tables) {
+ echo "<br><strong>WARNING: Unable to create temporary table (". mysql_error() .")<br>";
+ echo "I'll retry without using MySQL's temporary table feature (see \$import_use_temporary_tables in config.php for details).<br><br></strong>";
+ $import_use_temporary_tables = false;
+ continue;
+ }
+ die("<br><strong>Unable to create the temporary table - are you allowed to create tables in this database?<br><br></strong>");
+ }
+ $id = 0;
+
+ if ($html) {
+ echo'<table class="box" border="0" cellpadding="1" cellspacing="2">
+ <tr>
+ <td class="smheading" align="center" height="25" width="550" colspan="2">Importing '.$oldfilename.'</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="left" width="350">';
+ } else {
+ echo "Importing $oldfilename:\n";
+ }
+ echo 'Creating Temp MySQL Table: ';
+ if ($html) echo '</td><td class="grey" align="left" width="200">';
+ echo "uts_temp_$uid\n";
+ if ($html) echo '</td></tr><tr><td class="smheading" align="left" width="350">';
+ echo 'Backing Up Log File: ';
+ if ($html) echo '</td><td class="grey" align="left" width="200">';
+
+ // Copy the file to backup folder first
+ echo backup_logfile($import_log_backup, $filename, $backupfilename, true) . "\n";
+
+ if ($html) echo '</td><tr><td class="smheading" align="left" width="350">';
+ echo 'Player Data Moved to Temp MySQL: ';
+ if ($html) echo '</td>';
+
+ // Create sql for NGLog
+ $row = 1;
+ $handle = fopen("$filename", "r");
+
+ while (($data = my_fgets($handle, 5000)) !== FALSE) {
+ if ($debug) debug_output('Raw input ', $data);
+ $data = preg_replace('/[\x00]/', '', $data);
+ if ($debug) debug_output('After preg_replace', $data);
+ $data = explode("\t", $data);
+
+ $num = count($data);
+ $row++;
+ for ($c=0; $c < 1; $c++) {
+
+ $col0 = addslashes($data[0]);
+ $col1 = addslashes($data[1]);
+ $col2 = addslashes($data[2]);
+ $col3 = addslashes($data[3]);
+ $col4 = addslashes($data[4]);
+
+ $col0 = trim($col0, " \n\r");
+ $col1 = trim($col1, " \n\r");
+ $col2 = trim($col2, " \n\r");
+ $col3 = trim($col3, " \n\r");
+ $col4 = trim($col4, " \n\r");
+
+ $id++;
+ mysql_query("INSERT INTO uts_temp_$uid VALUES ($id, '$col0', '$col1', '$col2', '$col3', '$col4');") or die(mysql_error());
+ }
+ }
+ fclose($handle);
+ $files++;
+
+ if ($html) echo'<td class="grey" align="left" width="200">';
+ echo "Yes\n";
+
+
+
+ $log_incompatible = false;
+ $actor_version = 'unknown';
+ $qm_logtype = small_query("SELECT col3 FROM uts_temp_$uid WHERE col1 = 'info' AND col2 = 'Log_Standard'");
+ if ($qm_logtype['col3'] == 'UTStats') {
+ $qm_logversion = small_query("SELECT col3 FROM uts_temp_$uid WHERE col1 = 'info' AND col2 = 'Log_Version'");
+ $actor_version = $qm_logversion['col3'];
+ }
+
+ if (!in_array($actor_version, $compatible_actor_versions)) {
+ if ($import_incompatible_logs) {
+ if ($html) echo '</td></tr><tr><td class="smheading" align="left" width="350" style="background-color: red;">';
+ echo "WARNING: ";
+ if ($html) echo '</td><td class="grey" align="left" width="200" style="background-color: red;">';
+ echo "This logfile was created using an incompatible UTStats server actor version ($actor_version). You may experience strange results and/or bugs!\n";
+ } else {
+ $log_incompatible = true;
+ }
+ }
+
+
+ if ($html) echo '</td></tr><tr><td class="smheading" align="left" width="350">';
+ echo "Match Data Created: ";
+ if ($html) echo '</td><td class="grey" align="left" width="200">';
+
+ // Get the match table info
+ $qm_time = small_query("SELECT col3 FROM uts_temp_$uid WHERE col1 = 'info' AND col2 = 'Absolute_Time'");
+ $qm_servername = small_query("SELECT col3 FROM uts_temp_$uid WHERE col1 = 'info' AND col2 = 'Server_ServerName'");
+ $qm_serverip = small_query("SELECT col3 FROM uts_temp_$uid WHERE col1 = 'info' AND col2 = 'True_Server_IP'");
+ $qm_serverport = small_query("SELECT col3 FROM uts_temp_$uid WHERE col1 = 'info' AND col2 = 'Server_Port'");
+ $qm_gamename = small_query("SELECT col3 FROM uts_temp_$uid WHERE col1 = 'game' AND col2 = 'GameName'");
+
+ $qm_gamestart = small_query("SELECT col0 FROM uts_temp_$uid WHERE col1 = 'game' AND col2 = 'realstart'");
+ $qm_gameend = small_query("SELECT col0 FROM uts_temp_$uid WHERE col1 = 'game_end'");
+
+ $qm_insta = small_query("SELECT col3 FROM uts_temp_$uid WHERE col1 = 'game' AND col2 = 'insta'");
+ $qm_tournament = small_query("SELECT col3 FROM uts_temp_$uid WHERE col1 = 'game' AND col2 = 'TournamentMode'");
+ $qm_teamgame = small_query("SELECT col3 FROM uts_temp_$uid WHERE col1 = 'game' AND col2 = 'TeamGame'");
+ $qm_mapname = small_query("SELECT col3 FROM uts_temp_$uid WHERE col1 = 'map' AND col2 = 'Title'");
+ $qm_mapfile = small_query("SELECT col3 FROM uts_temp_$uid WHERE col1 = 'map' AND col2 = 'Name'");
+ $qm_frags = small_query("SELECT SUM(col4) AS frags FROM uts_temp_$uid WHERE col1 = 'stat_player' AND col2 = 'frags'");
+ $qm_kills = small_query("SELECT SUM(col4) AS kills FROM uts_temp_$uid WHERE col1 = 'stat_player' AND col2 = 'kills'");
+ $qm_suicides = small_query("SELECT SUM(col4) AS suicides FROM uts_temp_$uid WHERE col1 = 'stat_player' AND col2 = 'suicides'");
+ $qm_deaths = small_query("SELECT SUM(col4) AS deaths FROM uts_temp_$uid WHERE col1 = 'stat_player' AND col2 = 'deaths'");
+ $qm_teamkills = small_query("SELECT SUM(col4) AS teamkills FROM uts_temp_$uid WHERE col1 = 'stat_player' AND col2 = 'teamkills'");
+
+ $qm_playercount = small_count("SELECT col3 FROM uts_temp_$uid WHERE col1 = 'player' AND col2 = 'rename' GROUP BY col3");
+
+ $s_frags = $qm_frags[frags];
+ $s_suicides = $qm_suicides[suicides];
+ $s_deaths = $qm_deaths[deaths];
+
+ // Add teamkills only if its a team game, else add them to kills total
+ IF ($qm_teamgame[col3] == "True") {
+ $s_kills = $qm_kills[kills];
+ $s_teamkills = $qm_teamkills[teamkills];
+ } else {
+ $s_kills = $qm_kills[kills]+$qm_teamkills[teamkills];
+ $s_teamkills = 0;
+ }
+
+ // Change the gamename to bunny track if needed:
+ if (($qm_gamename[col3] == "BunnyTrack2") || (($qm_gamename[col3] == "Capture the Flag") && (strtolower(substr($qm_mapfile[col3], 0, 7)) == "ctf-bt-"))) {
+ $qm_gamename[col3] = "Bunny Track";
+ }
+
+ // Check if anything happened, if it didnt stop everything now
+ //
+ IF (($qm_kills[kills] == 0 && $qm_deaths[deaths] == 0) && ($qm_gamename[col3] != "Bunny Track")) {
+ echo "No (Empty Match)\n";
+ if ($html) echo '</td></tr>';
+ } elseIF (($qm_playercount < 2) || (($qm_gamename == "Bunny Track") and ($qm_playercount < 1))) {
+ echo "No (Not Enough Players)\n";
+ if ($html) echo '</td></tr>';
+ } elseIF ($log_incompatible) {
+ echo "No (Logfile incompatible [created by UTStats $actor_version])\n";
+ if ($html) echo '</td></tr>';
+ } elseIF ($import_ignore_if_gametime_less_than != 0 and ceil(($qm_gameend[col0] - $qm_gamestart[col0]) / 60) < $import_ignore_if_gametime_less_than) {
+ echo "No (game too short [". ceil(($qm_gameend[col0] - $qm_gamestart[col0]) / 60) ." < $import_ignore_if_gametime_less_than minutes])\n";
+ if ($html) echo '</td></tr>';
+ } else {
+
+ $sql_mutators = "SELECT col3 FROM uts_temp_$uid WHERE col1 = 'game' AND col2 = 'GoodMutator'";
+ $q_mutators = mysql_query($sql_mutators);
+ while ($r_mutators = mysql_fetch_array($q_mutators)) {
+ $qm_mutators .= "".$r_mutators[col3].", ";
+ }
+
+
+ $qm_serveran = small_query("SELECT col3 FROM uts_temp_$uid WHERE col1 = 'info' AND col2 = 'Server_AdminName'");
+ $qm_serverae = small_query("SELECT col3 FROM uts_temp_$uid WHERE col1 = 'info' AND col2 = 'Server_AdminEmail'");
+ $qm_serverm1 = small_query("SELECT col3 FROM uts_temp_$uid WHERE col1 = 'info' AND col2 = 'Server_MOTDLine1'");
+ $qm_serverm2 = small_query("SELECT col3 FROM uts_temp_$uid WHERE col1 = 'info' AND col2 = 'Server_MOTDLine2'");
+ $qm_serverm3 = small_query("SELECT col3 FROM uts_temp_$uid WHERE col1 = 'info' AND col2 = 'Server_MOTDLine3'");
+ $qm_serverm4 = small_query("SELECT col3 FROM uts_temp_$uid WHERE col1 = 'info' AND col2 = 'Server_MOTDLine4'");
+
+ $qm_gameinfotl = small_query("SELECT col3 FROM uts_temp_$uid WHERE col1 = 'game' AND col2 = 'TimeLimit'");
+ $qm_gameinfofl = small_query("SELECT col3 FROM uts_temp_$uid WHERE col1 = 'game' AND col2 = 'FragLimit'");
+ $qm_gameinfogt = small_query("SELECT col3 FROM uts_temp_$uid WHERE col1 = 'game' AND col2 = 'GoalTeamScore'");
+ $qm_gameinfomp = small_query("SELECT col3 FROM uts_temp_$uid WHERE col1 = 'game' AND col2 = 'MaxPlayers'");
+ $qm_gameinfoms = small_query("SELECT col3 FROM uts_temp_$uid WHERE col1 = 'game' AND col2 = 'MaxSpectators'");
+ $qm_gameinfogs = small_query("SELECT col3 FROM uts_temp_$uid WHERE col1 = 'game' AND col2 = 'GameSpeed'");
+ $qm_gameinfout = small_query("SELECT col3 FROM uts_temp_$uid WHERE col1 = 'game' AND col2 = 'UseTranslocator'");
+ $qm_gameinfoff = small_query("SELECT col3 FROM uts_temp_$uid WHERE col1 = 'game' AND col2 = 'FriendlyFireScale'");
+ $qm_gameinfows = small_query("SELECT col3 FROM uts_temp_$uid WHERE col1 = 'game' AND col2 = 'WeaponsStay'");
+
+ $gametime = $qm_time[col3];
+ $servername = addslashes($qm_servername[col3]);
+ $serverip = $qm_serverip[col3];
+ $serverport = $qm_serverport[col3];
+ $gamename = addslashes($qm_gamename[col3]);
+ $servergametime = get_dp($qm_gameend[col0] - $qm_gamestart[col0]);
+ $gamestart = $qm_gamestart[col0];
+ $gameend = $qm_gameend[col0];
+
+
+ $tournament = $qm_tournament[col3];
+ $teamgame = $qm_teamgame[col3];
+ $mapname = addslashes($qm_mapname[col3]);
+ $mapfile = addslashes($qm_mapfile[col3]);
+
+ // Lazy Hack for unknown gametypes
+ $unknowngt = substr("$mapfile", 0, 3); // Gets first 3 characters
+
+ IF ($unknowngt == "JB-") {
+ $gamename = "JailBreak";
+ $teamgame = 'True';
+ }
+
+ // Append insta to game if it was an insta game
+ IF (($qm_insta[col3] == "True") && ($gamename != "Bunny Track")) { $gameinsta = 1; $gamename = "$gamename (insta)"; } else { $gameinsta = 0; }
+
+ // Get the unique ID of this gametype.
+ // Create a new one if it has none yet.
+ $r_gid = small_query("SELECT id FROM uts_games WHERE gamename = '$gamename'");
+ if ($r_gid) {
+ $gid = $r_gid['id'];
+ } else {
+ mysql_query("INSERT INTO uts_games SET gamename = '$gamename', name = '$gamename'") or die(mysql_error());
+ $gid = mysql_insert_id();
+ }
+
+
+ // Check wheter we want to override the gametype for this match
+ // (Useful if we want a server to have separate stats for one server or if we want to
+ // combine DM and TDM rankings or ...)
+
+ // Read all rules
+ if (!isset($overriderules)) {
+ $overriderules = array();
+ $sql_overriderules = "SELECT id, serverip, gamename, mutator, gid FROM uts_gamestype ORDER BY id ASC;";
+ $q_overriderules = mysql_query($sql_overriderules);
+ while ($r_overriderules = mysql_fetch_array($q_overriderules)) {
+ $overriderules[$r_overriderules['id']]['serverip'] = $r_overriderules['serverip'];
+ $overriderules[$r_overriderules['id']]['gamename'] = $r_overriderules['gamename'];
+ $overriderules[$r_overriderules['id']]['mutator'] = $r_overriderules['mutator'];
+ $overriderules[$r_overriderules['id']]['gid'] = $r_overriderules['gid'];
+ }
+ }
+
+ // Check if one of our overriderules applies to this match
+ foreach($overriderules as $rule) {
+ if ($rule['serverip'] != '*' and $rule['serverip'] != "$serverip:$serverport") continue;
+ if ($rule['gamename'] != '*' and $rule['gamename'] != $gamename) continue;
+ if ($rule['mutator'] != '*' and stristr($qm_mutators, $rule['mutator']) === false) continue;
+ $gid = $rule['gid'];
+ break;
+ }
+
+
+ $qm_firstblood = small_query("SELECT col2 FROM uts_temp_$uid WHERE col1 = 'first_blood'");
+
+ $firstblood = addslashes($qm_firstblood[col2]);
+
+
+ $serverinfo = addslashes("Admin: $qm_serveran[col3]<br>Email: $qm_serverae[col3] <br><br>
+ <u>MOTD</u><br>$qm_serverm1[col3]<br>$qm_serverm2[col3]<br>$qm_serverm3[col3]<br>$qm_serverm4[col3]");
+
+
+ $gameinfo = addslashes( add_info('Time Limit:', $qm_gameinfotl[col3]) .
+ add_info('Frag Limit:', $qm_gameinfofl[col3]) .
+ add_info('Goal Team Score:', $qm_gameinfogt[col3]) .
+ add_info('Max Players:', $qm_gameinfomp[col3]) .
+ add_info('Max Specs:', $qm_gameinfoms[col3]) .
+ add_info('Game Speed:', $qm_gameinfogs[col3]) .
+ add_info('Translocator:', $qm_gameinfout[col3]) .
+ add_info('Friendly Fire:', $qm_gameinfoff[col3]) .
+ add_info('Weapon Stay:', $qm_gameinfows[col3]) .
+ add_info('UTStats Actor Version:', $actor_version));
+
+ // Tidy Up The Info
+
+ $mutators = substr("$qm_mutators", 0, -2); // remove trailing ,
+ $mutators = un_ut($mutators); // Remove Class and BotPack. etc
+ $mutators = addslashes($mutators);
+
+ $gametime = utdate($gametime);
+
+
+ // Get Teams Info
+ $sql_tinfo = "SELECT col4 FROM uts_temp_$uid WHERE col1 = 'player' AND col2 = 'TeamName' GROUP BY col4 ORDER BY col4 ASC";
+ $q_tinfo = mysql_query($sql_tinfo) or die(mysql_error());
+
+ $t0info = 0;
+ $t1info = 0;
+ $t2info = 0;
+ $t3info = 0;
+
+ while ($r_tinfo = mysql_fetch_array($q_tinfo)) {
+ IF ($r_tinfo[col4] == "Red") { $t0info = 1; }
+ IF ($r_tinfo[col4] == "Blue") { $t1info = 1; }
+ IF ($r_tinfo[col4] == "Green") { $t2info = 1; }
+ IF ($r_tinfo[col4] == "Gold") { $t3info = 1; }
+ }
+
+ // Get Teamscores
+ $sql_tscore = "SELECT col2 AS team, col3 AS score FROM uts_temp_$uid WHERE col1 = 'teamscore'";
+ $q_tscore = mysql_query($sql_tscore) or die(mysql_error());
+
+ $t0score = 0;
+ $t1score = 0;
+ $t2score = 0;
+ $t3score = 0;
+
+ while ($r_tscore = mysql_fetch_array($q_tscore)) {
+ if ($r_tscore['team'] == "0") $t0score = $r_tscore['score'];
+ if ($r_tscore['team'] == "1") $t1score = $r_tscore['score'];
+ if ($r_tscore['team'] == "2") $t2score = $r_tscore['score'];
+ if ($r_tscore['team'] == "3") $t3score = $r_tscore['score'];
+ }
+
+
+// Insert Server Info Into Database
+$sql_serverinfo = "INSERT INTO uts_match (time, servername, serverip, gamename, gid, gametime, mutators, insta, tournament, teamgame, mapname, mapfile, serverinfo, gameinfo, frags, kills, suicides, teamkills, deaths,
+t0, t1, t2, t3, t0score, t1score, t2score, t3score)
+VALUES ('$gametime', '$servername', '$serverip:$serverport', '$gamename', '$gid', '$servergametime', '$mutators', '$gameinsta', '$tournament',
+'$teamgame', '$mapname', '$mapfile', '$serverinfo', '$gameinfo', '$s_frags', '$s_kills', '$s_suicides', '$s_teamkills', '$s_deaths',
+$t0info, $t1info, $t2info, $t3info, $t0score, $t1score, $t2score, $t3score);";
+
+ $q_serverinfo = mysql_query($sql_serverinfo) or die(mysql_error());
+ $matchid = mysql_insert_id(); // Get our Match ID
+
+
+
+ echo "Yes (ID: $matchid)\n";
+ if ($html) echo '</td></tr>';
+
+ // Process Player Stuff
+ $playerid2pid = array();
+ $ignored_players = array();
+ $imported_players = array();
+
+ if ($html) echo '<tr><td class="smheading" align="left" width="350">';
+ echo "Importing Players: ";
+ if ($html) echo '</td><td class="grey" align="left" width="200">';
+
+ // Get List of Player IDs and Process What They Have Done
+ $sql_player = "SELECT DISTINCT col4 FROM uts_temp_$uid WHERE col1 = 'player' AND col2 = 'rename' AND col4 <> ''";
+ $q_player = mysql_query($sql_player) or die(mysql_error());
+ while ($r_player = mysql_fetch_array($q_player)) {
+ $playerid = $r_player[col4];
+
+ // Get players last name used
+ $r_player2 = small_query("SELECT col3 FROM uts_temp_$uid WHERE col1 = 'player' AND col2 = 'rename' AND col4 = $playerid ORDER BY id DESC LIMIT 0,1");
+ $playername = addslashes($r_player2[col3]);
+
+
+ // Are they a Bot
+ $r_player1 = small_query("SELECT col4 FROM uts_temp_$uid WHERE col1 = 'player' AND col2 = 'IsABot' AND col3 = $playerid ORDER BY id DESC LIMIT 0,1");
+ $playertype = $r_player1[col4];
+ // This player is a bot
+ if ($playertype == 'True' and $import_ignore_bots) {
+ $ignored_players[] = $playername;
+ // We do not want to know who killed and who was killed by this bot...
+ mysql_query("DELETE FROM uts_temp_$uid WHERE (col1 = 'kill' OR col1 = 'teamkill') AND (col2 = '$playerid' OR col4 = '$playerid');") or die(mysql_error());
+ if ($html) echo "<span style='text-decoration: line-through;'>";
+ echo "Bot:$playername ";
+ if ($html) echo "</span>";
+ continue;
+ }
+
+ // Get players last team
+ $r_player3 = small_query("SELECT col4 FROM uts_temp_$uid WHERE col1 = 'player' AND col2 = 'TeamChange' AND col3 = $playerid AND col4 != 255 ORDER BY id DESC LIMIT 0,1");
+ $playerteam = $r_player3[col4];
+
+ $qc_kills = small_query("SELECT col4 FROM uts_temp_$uid WHERE col1 = 'stat_player' AND col2 = 'kills'AND col3 = $playerid");
+ $qc_teamkills = small_query("SELECT col4 FROM uts_temp_$uid WHERE col1 = 'stat_player' AND col2 = 'teamkills' AND col3 = $playerid");
+ $qc_deaths = small_query("SELECT col4 FROM uts_temp_$uid WHERE col1 = 'stat_player' AND col2 = 'deaths' AND col3 = $playerid");
+
+ // Player had no kills, deaths or teamkills => ignore
+ IF ($qc_kills[col4] == 0 && $qc_deaths[col4] == 0 && $qc_teamkills[col4] ==0 && $gamename != "Bunny Track") {
+ $ignored_players[] = $playername;
+ continue;
+ }
+
+ // Process all the other player information
+ include("import/import_playerstuff.php");
+
+ if ($playerbanned) {
+ // Banned players don't have a rank.
+ mysql_query("DELETE FROM uts_rank WHERE pid = '$pid'");
+
+ if ($import_ban_type == 2) {
+ // We do not want to know who killed and who was killed by this banned player
+ $ignored_players[] = $playername;
+ mysql_query("DELETE FROM uts_temp_$uid WHERE (col1 = 'kill' OR col1 = 'teamkill') AND (col2 = '$playerid' OR col4 = '$playerid');") or die(mysql_error());
+ if ($html) echo "<span style='text-decoration: line-through;'>";
+ echo "Banned:$playername ";
+ if ($html) echo "</span>";
+ continue;
+ }
+ }
+
+ // Get Gametype specific stuff done
+ IF ($gamename == "Assault" || $gamename == "Assault (insta)") { include("import/import_ass.php"); }
+ IF ($gamename == "Capture the Flag" || $gamename == "Capture the Flag (insta)") { include("import/import_ctf.php"); }
+ IF ($gamename == "Bunny Track") { include("import/import_bt.php"); }
+ IF ($gamename == "Domination" || $gamename == "Domination (insta)") { include("import/import_dom.php"); }
+ IF ($gamename == "Tournament Team Game" || $gamename == "Tournament Team Game (insta)") { include("import/import_tdm.php"); }
+ IF ($gamename == "JailBreak" || $gamename == "JailBreak (insta)") { include("import/import_jailbreak.php"); }
+ IF ($gamename == "Last Man Standing" || $gamename == "Last Man Standing (insta)") { include("import/import_lms.php"); }
+ IF ($gamename == "Extended Last Man Standing" || $gamename == "Extended Last Man Standing (insta)") { include("import/import_lms.php"); }
+ IF ($gamename == "Last Man Standing +" || $gamename == "Last Man Standing + (insta)") { include("import/import_lms.php"); }
+ IF ($gamename == "Last Man Standing++" || $gamename == "Last Man Standing++ (insta)") { include("import/import_lms.php"); }
+
+ // Do the rankings
+ include("import/import_ranking.php");
+
+ if ($playerbanned) {
+ if ($html) echo "<span style='font-style: italic;'>";
+ echo "Banned:";
+ }
+ echo $playername.' ';
+ if ($playerbanned and $html) echo "</span>";
+ if ($html) echo "<br>";
+ $imported_players[] = $playername;
+ }
+ if ($html) echo '</td></tr>';
+ // Check if theres any players left, if none or one delete the match (its possible ...)
+ $final_pcount = small_count("SELECT id FROM uts_player WHERE matchid = $matchid");
+
+ IF ($final_pcount == NULL || ($final_pcount == 1 && $gamename != "Bunny Track")) {
+ echo'<tr>
+ <td class="smheading" align="left" width="350">Deleting Match:</td>
+ <td class="grey" align="left" width="200">0 or 1 Player Entries Left</td>
+ </tr>';
+
+ $sql_radjust = "SELECT pid, gid, rank FROM uts_player WHERE matchid = $matchid";
+ $q_radjust = mysql_query($sql_radjust) or die(mysql_error());
+ while ($r_radjust = mysql_fetch_array($q_radjust)) {
+ $pid = $r_radjust[pid];
+ $gid = $r_radjust[gid];
+ $rank = $r_radjust[rank];
+
+ $sql_crank = small_query("SELECT id, rank, matches FROM uts_rank WHERE pid = $pid AND gid = $gid");
+ if (!$sql_crank) continue;
+
+ $rid = $sql_crank[id];
+ $newrank = $sql_crank[rank]-$rank;
+ $oldrank = $sql_crank[rank];
+ $matchcount = $sql_crank[matches]-1;
+
+ mysql_query("UPDATE uts_rank SET rank = $newrank, prevrank = $oldrank, matches = $matchcount WHERE id = $rid") or die(mysql_error());
+ }
+ mysql_query("DELETE FROM uts_rank WHERE matches = 0") or die(mysql_error());
+
+ $rem_mrecord = "DELETE FROM uts_match WHERE id = $matchid";
+ mysql_query($rem_mrecord);
+ $rem_precord = "DELETE FROM uts_player WHERE matchid = $matchid";
+ mysql_query($rem_precord);
+ $rem_precord = "DELETE FROM uts_events WHERE matchid = $matchid";
+ mysql_query($rem_precord);
+ } else {
+ // Make our weapons statistics
+ echo "\n";
+ if ($html) echo '<tr><td class="smheading" align="left" width="350">';
+ echo "Importing weapon statistics: ";
+ if ($html) echo '</td><td class="grey" align="left" width="200">';
+ include("import/import_weapons.php");
+ echo "Done\n";
+ if ($html) echo '</td></tr>';
+
+ // Make our kills matrix stuff ...
+ if ($html) echo '<tr><td class="smheading" align="left" width="350">';
+ echo "Building kills matrix: ";
+ if ($html) echo '</td><td class="grey" align="left" width="200">';
+ include("import/import_killsmatrix.php");
+ echo "Done\n";
+
+
+ if ($html) echo '</td></tr><tr><td class="smheading" align="left" width="350">';
+ echo "Combining Duplicate Player Entries: ";
+ if ($html) echo '</td><td class="grey" align="left" width="200">';
+
+ // Combine duplicate player entries ... very intensive :(
+ include("import/import_pcleanup.php");
+
+ echo "Done\n";
+ if ($html) echo'</td></tr>';
+
+
+ $updategameinfo = false;
+ if (count($ignored_players) > 0) {
+ // Maybe we imported the player and ignored another record of him?
+ $ignored_players = array_unique($ignored_players);
+ foreach($ignored_players as $t_id => $t_name) {
+ if (in_array($t_name, $imported_players)) unset($ignored_players[$t_id]);
+ }
+ if (count($ignored_players) > 0) {
+ $gameinfo .= addslashes(add_info('Ignored Players:', implode(', ', $ignored_players)));
+ $updategameinfo = true;
+ }
+ }
+ if ($updategameinfo) {
+ mysql_query("UPDATE uts_match SET gameinfo = '$gameinfo' WHERE id = '$matchid'");
+ $updategameinfo = false;
+ }
+ }
+ }
+
+ // Delete Temp MySQL Table
+ $droptable = "DROP TABLE uts_temp_$uid";
+ mysql_query($droptable) or die(mysql_error());
+
+ if ($html) echo'<tr><td class="smheading" align="left" width="350">';
+ echo "Deleting Temp MySQL Table: ";
+ if ($html) echo '</td><td class="grey" align="left" width="200">';
+ echo "uts_temp_$uid\n";
+ if ($html) echo '</td></tr></table><br>';
+ echo "\n\n";
+
+ // Clear variables
+
+ $asscode = "";
+ $assteam = "";
+ $asswin = "";
+ $avgping = "";
+ $data = "";
+ $domplayer = "";
+ $droptable = "";
+ $firstblood = "";
+ $gameinfo = "";
+ $gameinsta = "";
+ $gamename = "";
+ $gametime = "";
+ $highping = "";
+ $unknowngt = "";
+ $lowping = "";
+ $mapname = "";
+ $mapfile = "";
+ $matchid = "";
+ $mutators = "";
+ $num = "";
+ $playerid = "";
+ $playerfragscnt = "";
+ $playername = "";
+ $playerecordid = "";
+ $playerteam = "";
+ $qm_mutators = "";
+ $row = 1;
+ $servername = "";
+ $serverinfo = "";
+ $serverip = "";
+ $serverport = "";
+ $suicidecnt = "";
+ $t0info = "";
+ $t1info = "";
+ $t2info = "";
+ $t3info = "";
+ $t0score = "";
+ $t1score = "";
+ $t2score = "";
+ $t3score = "";
+ $teamgame = "";
+ $tournament = "";
+
+// Delete log file
+ unlink($filename);
+}
+closedir($logdir);
+
+if ($html) echo '<br>';
+echo "\n";
+
+// Import stats
+if ($files != 0) {
+ $elapsed = $elapsed + time() - $start_time;
+ if ($html) echo '<p class="pages">';
+ echo "Processed $files ". ($files == 1 ? 'file' : 'files') ." in $elapsed ". ($elapsed == 1 ? 'second' : 'seconds') ." ";
+ echo "(". get_dp($elapsed / $files) ." seconds/file)\n";
+ if ($html) echo '</p><br>';
+}
+
+
+// Optimise database
+if (rand(0, 5) == 0) {
+ if ($html) echo '<p class="pages">';
+ echo "Optimizing tables... ";
+ mysql_query("OPTIMIZE TABLE uts_match, uts_player, uts_rank, uts_killsmatrix, uts_weaponstats, uts_pinfo;") or die(mysql_error());
+ echo "Done\n";
+ if ($html) echo '</p>';
+}
+
+// Analyze Key distribution
+if (rand(0, 10) == 0) {
+ if ($html) echo '<p class="pages">';
+ echo "Analyzing tables... ";
+ mysql_query("ANALYZE TABLE uts_match, uts_player, uts_rank, uts_killsmatrix, uts_weaponstats, uts_pinfo;") or die(mysql_error());
+ echo "Done\n";
+ if ($html) echo '</p>';
+}
+
+
+// Purge old logs
+if ($purged = (purge_backups('logs/backup', $import_log_backups_purge_after))) {
+ if ($html) echo '<p class="pages">';
+ echo "Purged $purged old logfiles\n";
+ if ($html) echo '</p>';
+}
+
+// Purge old utdc logs
+if ($import_utdc_download_enable) {
+ if ($purged = (purge_backups('logs/utdc', $import_utdc_log_purge_after))) {
+ if ($html) echo '<p class="pages">';
+ echo "Purged $purged old UTDC logfiles\n";
+ if ($html) echo '</p>';
+ }
+}
+
+// Purge old AnthChecker logs
+if ($import_ac_download_enable) {
+ if ($purged = (purge_backups('logs/ac', $import_ac_log_purge_after))) {
+ if ($html) echo '<p class="pages">';
+ echo "Purged $purged old AC logfiles\n";
+ if ($html) echo '</p>';
+ }
+}
+
+// Purge old ACE logs
+if ($import_ace_download_enable) {
+ if ($purged = (purge_backups('logs/ace', $import_ace_log_purge_after))) {
+ if ($html) echo '<p class="pages">';
+ echo "Purged $purged old ACE logfiles\n";
+ if ($html) echo '</p>';
+ }
+}
+
+echo "\n\n";
+if ($html) echo '<br><table class = "box" border="0" cellpadding="1" cellspacing="2" width="720"><tr><td class="heading" align="center" colspan="2">';
+echo "Import Script Completed\n";
+if ($html) echo '</td></tr></table>';
+
+if ($html) include("includes/footer.php");
+?>
diff --git a/html/import/import_ass.php b/html/import/import_ass.php new file mode 100755 index 0000000..9539bc5 --- /dev/null +++ b/html/import/import_ass.php @@ -0,0 +1,34 @@ +<?php
+// Who did the objectives
+ $r_assobj = small_query("SELECT count(id) AS assobjcount FROM uts_temp_$uid WHERE col1 = 'assault_obj' AND col2 = $playerid");
+ $assobjcount = $r_assobj[assobjcount];
+ $upd_assobj = "UPDATE uts_player SET ass_obj = $assobjcount WHERE id = $playerecordid";
+ mysql_query($upd_assobj) or die(mysql_error());
+
+// Get assault game code (unique code give for the 2 games played)
+
+ $r_asscode = small_query("SELECT col2 FROM uts_temp_$uid WHERE col1 = 'assault_gamecode' LIMIT 0,1");
+ $asscode = $r_asscode[col2];
+ $updateasscode = "UPDATE uts_match SET assaultid = '$asscode' WHERE id = $matchid";
+ mysql_query($updateasscode) or die(mysql_error());
+
+// Get Which Teams Attacking
+
+ $r_assteam = small_query("SELECT col2 FROM uts_temp_$uid WHERE col1 = 'assault_attacker' LIMIT 0,1");
+ $assteam = $r_assteam[col2];
+ $updateassteam = "UPDATE uts_match SET ass_att = $assteam WHERE id = $matchid;";
+ mysql_query($updateassteam) or die(mysql_error());
+
+// Did they do it?
+
+ $sql_asswin = "SELECT col0 FROM uts_temp_$uid WHERE col1 = 'game_end' AND col2 = 'Assault succeeded!' LIMIT 0,1";
+ $q_asswin = mysql_query($sql_asswin) or die(mysql_error());
+ $asswin = 0;
+
+ while ($r_asswin = mysql_fetch_array($q_asswin)) {
+ IF ($r_asswin[col0] != NULL ) { $asswin = 1; }
+ }
+
+ $updateasswin = "UPDATE uts_match SET ass_win = $asswin WHERE id = $matchid;";
+ mysql_query($updateasswin) or die(mysql_error());
+?>
diff --git a/html/import/import_bt.php b/html/import/import_bt.php new file mode 100755 index 0000000..fe6a480 --- /dev/null +++ b/html/import/import_bt.php @@ -0,0 +1,46 @@ +<?php
+// get the caps, captimes and store them in the events database
+ $sql_capbt = "SELECT col0, col1, col2, col3, col4 FROM uts_temp_$uid WHERE (col1 = 'cap' OR col1 = 'btcap') AND col2 = $playerid";
+ $q_capbt = mysql_query($sql_capbt);
+
+ $cap_speed = 0;
+ $cap_time = 0;
+ $cap_gametime = 0;
+ $flag_capture = 0;
+
+ while ($r_capbt = mysql_fetch_array($q_capbt)) {
+ if ($cap_speed == 0 || $r_capbt['col3'] > $cap_speed) {
+ $cap_speed = $r_capbt['col3'];
+ $col0 = $r_capbt['col0']; // time
+ $col1 = $r_capbt['col1']; // cap
+ $col2 = $r_capbt['col2']; // playerid
+ $col3 = $r_capbt['col3']; // speed in 2000 - seconds (old system) or 600000 - hundreds of seconds (new system)
+ $col4 = $r_capbt['col4']; // date in seconds since epoch
+ }
+ $flag_capture++;
+ }
+
+ if ($cap_speed != 0) {
+ # use col2 to store the rank, col3 to store the captime in seconds and col4 to store the date of the record
+ $col2 = small_count("SELECT DISTINCT col2 FROM uts_temp_$uid WHERE col1 = 'cap' AND col3 > $col3") + 1;
+ if ($col1 == "btcap") {
+ $col3 = ceil(600000 - $col3) / 100;
+ }
+ else if ($col1 == "cap") {
+ $col3 = ceil((2000 - $col3-1)*100/1.1) / 100;
+ $col1 = "btcap";
+ }
+ $col3 = sprintf("%01.2f", $col3);
+ $sql_eventsbt = "INSERT INTO uts_events
+ (matchid, playerid, col0, col1, col2, col3, col4) VALUES
+ ($matchid, $playerid, '$col0', '$col1', '$col2', '$col3', '$col4')";
+ mysql_query($sql_eventsbt) or die (mysql_error());
+ }
+
+ if ($flag_capture > 0) {
+ $sql_playerflags = " UPDATE uts_player
+ SET flag_capture = $flag_capture
+ WHERE id = $playerecordid";
+ mysql_query($sql_playerflags) or die(mysql_error());
+ }
+?>
diff --git a/html/import/import_ctf.php b/html/import/import_ctf.php new file mode 100755 index 0000000..206cbb0 --- /dev/null +++ b/html/import/import_ctf.php @@ -0,0 +1,43 @@ +<?php
+// Get Player Flag Events Count
+ $sql_playerctf = "SELECT col1, COUNT(col1) AS flag_count FROM uts_temp_$uid WHERE (col1 LIKE 'flag_%' OR col1 = 'cover' OR col1 = 'seal') AND col2 = $playerid GROUP BY col1";
+ $q_playerctf = mysql_query($sql_playerctf);
+
+ $flag_taken = 0;
+ $flag_dropped = 0;
+ $flag_return = 0;
+ $flag_capture = 0;
+ $flag_cover = 0;
+ $flag_seal = 0;
+ $flag_assist = 0;
+ $flag_kill = 0;
+ $flag_pickedup = 0;
+
+ while ($r_playerctf = mysql_fetch_array($q_playerctf)) {
+
+ // Cycle through events and see what the player got
+
+ IF ($r_playerctf[col1] == "flag_taken") { $flag_taken = $r_playerctf[flag_count]; }
+ IF ($r_playerctf[col1] == "flag_dropped") { $flag_dropped = $r_playerctf[flag_count]; }
+ IF ($r_playerctf[col1] == "flag_returned") { $flag_return = $r_playerctf[flag_count]; }
+ IF ($r_playerctf[col1] == "flag_captured") { $flag_capture = $r_playerctf[flag_count]; }
+ IF ($r_playerctf[col1] == "flag_cover" or $r_playerctf[col1] == "Flag_cover" or $r_playerctf[col1] == "cover") { $flag_cover = $r_playerctf[flag_count]; }
+ IF ($r_playerctf[col1] == "flag_seal" or $r_playerctf[col1] == "Flag_seal" or $r_playerctf[col1] == "seal") { $flag_seal = $r_playerctf[flag_count]; }
+ IF ($r_playerctf[col1] == "flag_assist" or $r_playerctf[col1] == "Flag_assist") { $flag_assist = $r_playerctf[flag_count]; }
+ IF ($r_playerctf[col1] == "flag_kill" or $r_playerctf[col1] == "Flag_kill") { $flag_kill = $r_playerctf[flag_count]; }
+ IF ($r_playerctf[col1] == "flag_pickedup" or $r_playerctf[col1] == "flag_pickedup") { $flag_pickedup = $r_playerctf[flag_count]; }
+ }
+
+ $sql_playerflags = " UPDATE uts_player
+ SET flag_taken = $flag_taken,
+ flag_dropped = $flag_dropped,
+ flag_return = $flag_return,
+ flag_capture = $flag_capture,
+ flag_cover = $flag_cover,
+ flag_seal = $flag_seal,
+ flag_assist = $flag_assist,
+ flag_kill = $flag_kill,
+ flag_pickedup = $flag_pickedup
+ WHERE id = $playerecordid";
+ mysql_query($sql_playerflags) or die(mysql_error());
+?>
diff --git a/html/import/import_dom.php b/html/import/import_dom.php new file mode 100755 index 0000000..91106ac --- /dev/null +++ b/html/import/import_dom.php @@ -0,0 +1,19 @@ +<?php
+// Get dom player scores
+ $sql_domplayer = "SELECT col3 FROM uts_temp_$uid WHERE col1 = 'dom_playerscore_update' AND col2 = $playerid ORDER BY id DESC LIMIT 0,1";
+ $q_domplayer = mysql_query($sql_domplayer) or die(mysql_error());
+ $r_domplayer = mysql_fetch_array($q_domplayer);
+ $domplayer = $r_domplayer[col3];
+ if (empty($domplayer)) {
+ $domplayer = 0;
+ }
+ $updatedomplayer = "UPDATE uts_player SET ass_obj = $domplayer WHERE id = $playerecordid";
+ mysql_query($updatedomplayer) or die("Error idom1:" . mysql_error());
+
+// Who did the control points
+ $r_domcp = small_query("SELECT count(id) AS domcpcount FROM uts_temp_$uid WHERE col1 = 'controlpoint_capture' AND col3 = $playerid");
+ $domcpcount = $r_domcp[domcpcount];
+ $upd_domcp = "UPDATE uts_player SET dom_cp = $domcpcount WHERE id = $playerecordid";
+ mysql_query($upd_domcp) or die("Error idom2:" . mysql_error());
+
+?>
\ No newline at end of file diff --git a/html/import/import_jailbreak.php b/html/import/import_jailbreak.php new file mode 100755 index 0000000..6d6e0da --- /dev/null +++ b/html/import/import_jailbreak.php @@ -0,0 +1,22 @@ +<?php
+// Get team releases
+ $q_releases = small_query("SELECT COUNT(*) AS releases FROM uts_temp_$uid WHERE col1 = 'team_released' AND col3 = $playerid");
+ $r_releases = $q_releases['releases'];
+
+// Get the real suicide count
+// (Jail releases should not be counted as suicides)
+ $q_suicides = small_query("SELECT COUNT(*) AS suicides FROM uts_temp_$uid WHERE col1 = 'suicide' AND col2 = $playerid and col4 <> 'RedeemerDeath' and col4 <> 'JailRelease'");
+ $r_suicides = $q_suicides['suicides'];
+
+ $r_frags = $r_kills - $r_suicides;
+ $r_efficiency = get_dp(($r_kills / ($r_kills + $r_deaths + $r_suicides + $r_teamkills)) * 100);
+
+
+ mysql_query(" UPDATE uts_player
+ SET ass_obj = '$r_releases',
+ suicides = '$r_suicides',
+ frags = '$r_frags',
+ eff = '$r_efficiency'
+ WHERE id = $playerecordid;") or die(mysql_error());
+
+?>
\ No newline at end of file diff --git a/html/import/import_killsmatrix.php b/html/import/import_killsmatrix.php new file mode 100755 index 0000000..433a659 --- /dev/null +++ b/html/import/import_killsmatrix.php @@ -0,0 +1,22 @@ +<?php
+ $sql_killmatrix = "SELECT col2 AS killer,
+ col4 AS killed,
+ COUNT(*) AS kills
+ FROM uts_temp_$uid
+ WHERE col1 = 'kill'
+ OR col1 = 'teamkill'
+ GROUP BY col2, col4";
+
+ $q_killmatrix = mysql_query($sql_killmatrix) or die(mysql_error());
+ while ($r_killmatrix = mysql_fetch_array($q_killmatrix)) {
+
+ $sql = " INSERT
+ INTO uts_killsmatrix
+ SET matchid = '$matchid',
+ killer = '". $r_killmatrix['killer'] ."',
+ victim = '". $r_killmatrix['killed'] ."',
+ kills = '". $r_killmatrix['kills'] ."';";
+ mysql_query($sql) or die(mysql_error());
+
+ }
+?>
diff --git a/html/import/import_lms.php b/html/import/import_lms.php new file mode 100755 index 0000000..eb3ebd7 --- /dev/null +++ b/html/import/import_lms.php @@ -0,0 +1,46 @@ +<?php
+// get the caps, captimes and store them in the events database
+ $ttl = 0;
+ if ($qc_deaths[col4] + $q_suicides[col4] == $qm_gameinfofl[col3]) {
+ // echo " get out time ";
+ $outtime = small_query("SELECT col0, col1, col2 FROM uts_temp_$uid WHERE (col1 = 'kill' AND col4 = $playerid) or (col1 = 'suicide' AND col2 = $playerid) ORDER BY CONVERT(col0, UNSIGNED INTEGER) DESC LIMIT 0,1");
+ $col0 = $outtime[col0];
+ $col1 = 'out';
+ $col2 = intval($outtime[col0] - $gamestart); //time
+ $col3 = $outtime[col2]; // killer
+ $col4 = "";
+
+ $sql_eventslms = "INSERT INTO uts_events
+ (matchid, playerid, col0, col1, col2, col3, col4) VALUES
+ ($matchid, $playerid, '$col0', '$col1', '$col2', '$col3', '$col4')";
+ mysql_query($sql_eventslms) or die (mysql_error());
+
+ // Fix ttl
+ $ttl = ($outtime[col0] - $gamestart) / ($qc_deaths[col4] + $q_suicides[col4]);
+
+ mysql_query("UPDATE uts_player SET ttl = $ttl WHERE id = $playerecordid") or die(mysql_error());
+ }
+ else {
+ $disconnect = small_query("SELECT col0 FROM uts_temp_$uid WHERE col1 = 'player' AND col2 = 'Disconnect' AND col3 = $playerid");
+ if ((!empty($disconnect[col0])) and (intval($disconnect[col0]) < intval($gameend))) {
+ // echo " get out time ";
+ $outtime = $player_left - $gamestart;
+ $q_out = mysql_query($sql_out);
+ $col0 = $disconnect[col0];
+ $col1 = 'out';
+ $col2 = intval($disconnect[col0] - $gamestart); //time
+ $col3 = "Disconnect";
+ $col4 = "";
+
+ $sql_eventslms = "INSERT INTO uts_events
+ (matchid, playerid, col0, col1, col2, col3, col4) VALUES
+ ($matchid, $playerid, '$col0', '$col1', '$col2', '$col3', '$col4')";
+ mysql_query($sql_eventslms) or die (mysql_error());
+
+ // Update ttl and set score to 0
+ $ttl = ($disconnect[col0] - $gamestart) / ($qc_deaths[col4] + $q_suicides[col4]);
+
+ mysql_query("UPDATE uts_player SET ttl = $ttl, gamescore = 0 WHERE id = $playerecordid") or die(mysql_error());
+ }
+ }
+?>
diff --git a/html/import/import_pcleanup.php b/html/import/import_pcleanup.php new file mode 100755 index 0000000..3e1be8a --- /dev/null +++ b/html/import/import_pcleanup.php @@ -0,0 +1,256 @@ +<?php
+$sql_tgame = small_query("SELECT teamgame FROM uts_match WHERE id = $matchid");
+IF($sql_tgame == "True") {
+ $rem_srecord = "DELETE FROM uts_player WHERE matchid = $matchid AND team > 3";
+ mysql_query($rem_srecord);
+}
+
+$cleaned = false;
+// Get list of players
+$sql_pname = "SELECT pid, name FROM uts_player, uts_pinfo AS pi WHERE matchid = $matchid AND pid = pi.id";
+$q_pname = mysql_query($sql_pname);
+while ($r_pname = mysql_fetch_array($q_pname)) {
+ $playername = addslashes($r_pname[name]);
+ $pid = $r_pname['pid'];
+
+
+ // Check if player has more than 1 record
+ $q_ids = mysql_query("SELECT playerid FROM uts_player WHERE pid = '$pid' AND matchid = $matchid");
+
+ IF (mysql_num_rows($q_ids) > 1) {
+ $numrecords = mysql_num_rows($q_ids);
+ echo $r_pname[name] .' ';
+ // get all the ids this player had
+ $playerids = array();
+ while ($r_ids = mysql_fetch_array($q_ids)) {
+ $playerids[] = $r_ids['playerid'];
+ }
+
+ $r_newplayerid = small_query("SELECT (MAX(playerid) + 1) AS newplayerid FROM uts_player WHERE matchid = $matchid");
+ $newplayerid = $r_newplayerid['newplayerid'];
+
+ // Fix the events table
+ foreach ($playerids as $i => $oldplayerid) {
+ mysql_query("UPDATE uts_events SET playerid = $newplayerid WHERE playerid = $oldplayerid AND matchid = $matchid");
+ }
+
+ // Fix matchcount in ranking table
+ // mysql_query("UPDATE uts_rank SET matches = matches - ". ($numrecords - 1) ." WHERE pid = '$pid' AND gid = '$gid'") or die(mysql_error());
+
+ // ***********************
+ // UPDATE THE KILLS MATRIX
+ $sql_kmupdate = " SELECT victim,
+ SUM(kills) AS kills
+ FROM uts_killsmatrix
+ WHERE matchid = $matchid
+ AND killer IN (". implode(",", $playerids) .")
+ GROUP BY victim;";
+
+ $q_kmupdate = mysql_query($sql_kmupdate);
+ while ($r_kmupdate = mysql_fetch_array($q_kmupdate)) {
+ mysql_query(" INSERT
+ INTO uts_killsmatrix
+ SET matchid = $matchid,
+ killer = $newplayerid,
+ victim = ${r_kmupdate['victim']},
+ kills = ${r_kmupdate['kills']};");
+ }
+
+ $sql_kmupdate = " SELECT killer,
+ SUM(kills) AS kills
+ FROM uts_killsmatrix
+ WHERE matchid = $matchid
+ AND victim IN (". implode(",", $playerids) .")
+ GROUP BY killer;";
+
+ $q_kmupdate = mysql_query($sql_kmupdate);
+ while ($r_kmupdate = mysql_fetch_array($q_kmupdate)) {
+ mysql_query(" INSERT
+ INTO uts_killsmatrix
+ SET matchid = $matchid,
+ killer = ${r_kmupdate['killer']},
+ victim = $newplayerid,
+ kills = ${r_kmupdate['kills']};");
+ }
+
+ mysql_query(" DELETE
+ FROM uts_killsmatrix
+ WHERE matchid = $matchid
+ AND (killer IN (". implode(",", $playerids) .")
+ OR victim IN (". implode(",", $playerids) ."));");
+
+
+ // FINISHED UPDATING THE KILLS MATRiX
+ // **********************************
+
+
+ // Get non summed information
+
+ $r_truepinfo1 = small_query("SELECT insta, pid, team, isabot, country, ip, gid FROM uts_player WHERE pid = '$pid' AND matchid = $matchid LIMIT 0,1");
+ // fix rejoin as spec
+ if ($r_treupinfo1['team'] == 255) {
+ $r_trueteam = small_query("SELECT team FROM uts_player WHERE pid = '$pid' AND matchid = $matchid AND team != 255 LIMIT 0,1");
+ if ($r_trueteam['team'] < 255) {
+ $r_truepinfo1['team'] = $r_trueteam['team'];
+ }
+ }
+
+ // Group Player Stuff so we only have 1 player record per match
+ if ($gamename == "Bunny Track") {
+ // In bunnytrack the gamescore is 2000 - fastest time in seconds so use MAX gamescore rather then SUM
+ $r_truepinfo2 = small_query("SELECT
+ SUM(gametime) AS gametime,
+ MAX(gamescore) AS gamescore,
+ AVG(lowping) AS lowping,
+ AVG(highping) AS highping,
+ AVG(avgping) AS avgping,
+ SUM(frags) AS frags,
+ SUM(deaths) AS deaths,
+ SUM(kills) AS kills,
+ SUM(suicides) AS suicides,
+ SUM(teamkills) AS teamkills,
+ AVG(eff) AS eff,
+ AVG(accuracy) AS accuracy,
+ AVG(ttl) AS ttl,
+ SUM(flag_taken) AS flag_taken,
+ SUM(flag_pickedup) AS flag_pickedup,
+ SUM(flag_dropped) AS flag_dropped,
+ SUM(flag_return) AS flag_return,
+ SUM(flag_capture) AS flag_capture,
+ SUM(flag_cover) AS flag_cover,
+ SUM(flag_seal) AS flag_seal,
+ SUM(flag_assist) AS flag_assist,
+ SUM(flag_kill) AS flag_kill,
+ SUM(dom_cp) AS dom_cp,
+ SUM(ass_obj) AS ass_obj,
+ SUM(spree_double) AS spree_double,
+ SUM(spree_triple) AS spree_triple,
+ SUM(spree_multi) AS spree_multi,
+ SUM(spree_mega) AS spree_mega,
+ SUM(spree_ultra) AS spree_ultra,
+ SUM(spree_monster) AS spree_monster,
+ SUM(spree_kill) AS spree_kill,
+ SUM(spree_rampage) AS spree_rampage,
+ SUM(spree_dom) AS spree_dom,
+ SUM(spree_uns) AS spree_uns,
+ SUM(spree_god) AS spree_god,
+ SUM(pu_pads) AS pu_pads,
+ SUM(pu_armour) AS pu_armour,
+ SUM(pu_keg) AS pu_keg,
+ SUM(pu_invis) AS pu_invis,
+ SUM(pu_belt) AS pu_belt,
+ SUM(pu_amp) AS pu_amp,
+ SUM(rank) AS rank
+ FROM uts_player WHERE matchid = $matchid AND pid = '$pid'");
+ }
+ else {
+ $r_truepinfo2 = small_query("SELECT
+ SUM(gametime) AS gametime,
+ SUM(gamescore) AS gamescore,
+ AVG(lowping) AS lowping,
+ AVG(highping) AS highping,
+ AVG(avgping) AS avgping,
+ SUM(frags) AS frags,
+ SUM(deaths) AS deaths,
+ SUM(kills) AS kills,
+ SUM(suicides) AS suicides,
+ SUM(teamkills) AS teamkills,
+ AVG(eff) AS eff,
+ AVG(accuracy) AS accuracy,
+ AVG(ttl) AS ttl,
+ SUM(flag_taken) AS flag_taken,
+ SUM(flag_pickedup) AS flag_pickedup,
+ SUM(flag_dropped) AS flag_dropped,
+ SUM(flag_return) AS flag_return,
+ SUM(flag_capture) AS flag_capture,
+ SUM(flag_cover) AS flag_cover,
+ SUM(flag_seal) AS flag_seal,
+ SUM(flag_assist) AS flag_assist,
+ SUM(flag_kill) AS flag_kill,
+ SUM(dom_cp) AS dom_cp,
+ SUM(ass_obj) AS ass_obj,
+ SUM(spree_double) AS spree_double,
+ SUM(spree_triple) AS spree_triple,
+ SUM(spree_multi) AS spree_multi,
+ SUM(spree_mega) AS spree_mega,
+ SUM(spree_ultra) AS spree_ultra,
+ SUM(spree_monster) AS spree_monster,
+ SUM(spree_kill) AS spree_kill,
+ SUM(spree_rampage) AS spree_rampage,
+ SUM(spree_dom) AS spree_dom,
+ SUM(spree_uns) AS spree_uns,
+ SUM(spree_god) AS spree_god,
+ SUM(pu_pads) AS pu_pads,
+ SUM(pu_armour) AS pu_armour,
+ SUM(pu_keg) AS pu_keg,
+ SUM(pu_invis) AS pu_invis,
+ SUM(pu_belt) AS pu_belt,
+ SUM(pu_amp) AS pu_amp,
+ SUM(rank) AS rank
+ FROM uts_player WHERE matchid = $matchid AND pid = '$pid'");
+ }
+
+ // Remove all of this player's records
+ $rem_precord = "DELETE FROM uts_player WHERE matchid = $matchid AND pid = '$pid'";
+ mysql_query($rem_precord);
+
+ // Add this new record to match
+ $upd_precord = " INSERT
+ INTO uts_player
+ SET matchid = $matchid,
+ insta = '$r_truepinfo1[insta]',
+ playerid = '$newplayerid',
+ pid = '$pid',
+ team = '$r_truepinfo1[team]',
+ isabot = '$r_truepinfo1[isabot]',
+ country = '$r_truepinfo1[country]',
+ ip = '$r_truepinfo1[ip]',
+ gid = '$r_truepinfo1[gid]',
+ gametime = '$r_truepinfo2[gametime]',
+ gamescore = '$r_truepinfo2[gamescore]',
+ lowping = '".(int)$r_truepinfo2[lowping]."',
+ highping = '".(int)$r_truepinfo2[highping]."',
+ avgping = '".(int)$r_truepinfo2[avgping]."',
+ frags = '$r_truepinfo2[frags]',
+ deaths = '$r_truepinfo2[deaths]',
+ kills = '$r_truepinfo2[kills]',
+ suicides = '$r_truepinfo2[suicides]',
+ teamkills = '$r_truepinfo2[teamkills]',
+ eff = '$r_truepinfo2[eff]',
+ accuracy = '$r_truepinfo2[accuracy]',
+ ttl = '$r_truepinfo2[ttl]',
+ flag_taken = '$r_truepinfo2[flag_taken]',
+ flag_dropped = '$r_truepinfo2[flag_dropped]',
+ flag_return = '$r_truepinfo2[flag_return]',
+ flag_capture = '$r_truepinfo2[flag_capture]',
+ flag_cover = '$r_truepinfo2[flag_cover]',
+ flag_seal = '$r_truepinfo2[flag_seal]',
+ flag_assist = '$r_truepinfo2[flag_assist]',
+ flag_kill = '$r_truepinfo2[flag_kill]',
+ flag_pickedup = '$r_truepinfo2[flag_pickedup]',
+ dom_cp = '$r_truepinfo2[dom_cp]',
+ ass_obj = '$r_truepinfo2[ass_obj]',
+ spree_double = '$r_truepinfo2[spree_double]',
+ spree_triple = '$r_truepinfo2[spree_triple]',
+ spree_multi = '$r_truepinfo2[spree_multi]',
+ spree_mega = '$r_truepinfo2[spree_mega]',
+ spree_ultra = '$r_truepinfo2[spree_ultra]',
+ spree_monster = '$r_truepinfo2[spree_monster]',
+ spree_kill = '$r_truepinfo2[spree_kill]',
+ spree_rampage = '$r_truepinfo2[spree_rampage]',
+ spree_dom = '$r_truepinfo2[spree_dom]',
+ spree_uns = '$r_truepinfo2[spree_uns]',
+ spree_god = '$r_truepinfo2[spree_god]',
+ pu_pads = '$r_truepinfo2[pu_pads]',
+ pu_armour = '$r_truepinfo2[pu_armour]',
+ pu_keg = '$r_truepinfo2[pu_keg]',
+ pu_invis = '$r_truepinfo2[pu_invis]',
+ pu_belt = '$r_truepinfo2[pu_belt]',
+ pu_amp = '$r_truepinfo2[pu_amp]',
+ rank = '$r_truepinfo2[rank]';";
+ mysql_query($upd_precord) or die(mysql_error());
+ $cleaned = true;
+ }
+}
+if ($cleaned and $html) echo "<br />";
+?>
\ No newline at end of file diff --git a/html/import/import_playerstuff.php b/html/import/import_playerstuff.php new file mode 100755 index 0000000..73714e4 --- /dev/null +++ b/html/import/import_playerstuff.php @@ -0,0 +1,182 @@ +<?php
+ include_once("includes/geoip.inc");
+ $gi = geoip_open("GeoIP.dat",GEOIP_STANDARD);
+
+ // Get the unique ID of this player.
+ // Create a new one if he has none yet.
+ $r_pid = small_query("SELECT id, country, banned FROM uts_pinfo WHERE name = '$playername'");
+ if ($r_pid) {
+ $pid = $r_pid['id'];
+ $pid_country = $r_pid['country'];
+ $playerbanned = ($r_pid['banned'] == 'Y') ? true : false;
+ } else {
+ mysql_query("INSERT INTO uts_pinfo SET name = '$playername'") or die(mysql_error());
+ $pid = mysql_insert_id();
+ $pid_country = false;
+ $playerbanned = false;
+ }
+ $playerid2pid[$playerid] = $pid;
+
+ // Do we import banned players?
+ if ($playerbanned and $import_ban_type == 2) return;
+
+
+ // Did the player do first blood?
+ IF($playerid == $firstblood) {
+ $upd_firstblood = "UPDATE uts_match SET firstblood = '$pid' WHERE id = $matchid";
+ mysql_query($upd_firstblood) or die(mysql_error());
+ }
+
+ // Get player's IP
+ $q_playerip = small_query("SELECT INET_ATON(col4) AS ip FROM uts_temp_$uid WHERE col1 = 'player' AND col2 = 'IP' and col3 = '$playerid' ORDER BY id ASC LIMIT 0,1");
+ $playerip = ($q_playerip) ? $q_playerip['ip'] : 0;
+ if (empty($playerip)) $playerip = 0;
+
+ // Map the IP to a country
+ $playercountry = strtolower(geoip_country_code_by_addr($gi,long2ip($playerip)));
+
+ if ($playercountry != $pid_country)
+ {
+ mysql_query("UPDATE uts_pinfo SET country = '$playercountry' WHERE id = '$pid'") or die(mysql_error());
+ }
+
+
+ // Get Sprees
+ $q_spree_dbl = small_count("SELECT id FROM uts_temp_$uid WHERE col1 = 'spree' AND col2 = 'spree_dbl' AND col3 = '$playerid'");
+ $q_spree_mult = small_count("SELECT id FROM uts_temp_$uid WHERE col1 = 'spree' AND col2 = 'spree_mult' AND col3 = '$playerid'");
+ $q_spree_ult = small_count("SELECT id FROM uts_temp_$uid WHERE col1 = 'spree' AND col2 = 'spree_ult' AND col3 = '$playerid'");
+ $q_spree_mon = small_count("SELECT id FROM uts_temp_$uid WHERE col1 = 'spree' AND col2 = 'spree_mon' AND col3 = '$playerid'");
+
+ $q_spree_kill = small_count("SELECT id FROM uts_temp_$uid WHERE col1 = 'spree' AND col2 = 'spree_kill' AND col3 = '$playerid'");
+ $q_spree_rampage = small_count("SELECT id FROM uts_temp_$uid WHERE col1 = 'spree' AND col2 = 'spree_rampage' AND col3 = '$playerid'");
+ $q_spree_dom = small_count("SELECT id FROM uts_temp_$uid WHERE col1 = 'spree' AND col2 = 'spree_dom' AND col3 = '$playerid'");
+ $q_spree_uns = small_count("SELECT id FROM uts_temp_$uid WHERE col1 = 'spree' AND col2 = 'spree_uns' AND col3 = '$playerid'");
+ $q_spree_god = small_count("SELECT id FROM uts_temp_$uid WHERE col1 = 'spree' AND col2 = 'spree_god' AND col3 = '$playerid'");
+
+
+ // Get Count of Pickups
+ $sql_player7 = "SELECT col2, COUNT(col2) AS pu_count FROM uts_temp_$uid WHERE col1 = 'item_get' AND col3 = $playerid GROUP BY col2";
+ $q_player7 = mysql_query($sql_player7);
+
+ $pu_pads = 0;
+ $pu_armour = 0;
+ $pu_keg = 0;
+ $pu_belt = 0;
+ $pu_amp = 0;
+ $pu_invis = 0;
+
+ while ($r_player7 = mysql_fetch_array($q_player7)) {
+ // Cycle through pickups and see what the player got
+ IF ($r_player7[col2] == "Thigh Pads") { $pu_pads = $r_player7[pu_count]; }
+ IF ($r_player7[col2] == "Body Armor") { $pu_armour = $r_player7[pu_count]; }
+ IF ($r_player7[col2] == "Super Health Pack") { $pu_keg = $r_player7[pu_count]; }
+ IF ($r_player7[col2] == "ShieldBelt") { $pu_belt = $r_player7[pu_count]; }
+ IF ($r_player7[col2] == "Damage Amplifier") { $pu_amp = $r_player7[pu_count]; }
+ IF ($r_player7[col2] == "Invisibility") { $pu_invis = $r_player7[pu_count]; }
+ }
+
+ // Get ping information
+ $r_player9 = small_query("SELECT MIN(col4 * 1) AS lowping, MAX(col4 * 1) AS highping, AVG(col4 * 1) AS avgping FROM uts_temp_$uid WHERE col1 = 'Player' AND col2 = 'Ping' AND col3 = $playerid AND col4 > 0");
+ $lowping = $r_player9[lowping];
+ $highping = $r_player9[highping];
+ $avgping = (int)$r_player9[avgping];
+
+ // People who join at the end error the import, this stops it
+ IF ($lowping == NULL) { $lowping = 0; }
+ IF ($highping == NULL) { $highping = 0; }
+ IF ($avgping == NULL) { $avgping = 0; }
+
+ // Get accuracy, ttl etc
+ $r_acc = 0;
+ $r_deaths = 0;
+ $r_efficiency = 0;
+ $r_frags = 0;
+ $r_kills = 0;
+ $r_teamkills = 0;
+ $r_suicides = 0;
+ $r_tos = 0;
+ $r_ttl = 0;
+
+ $q_acc = small_query("SELECT col4 FROM uts_temp_$uid WHERE col1 = 'stat_player' AND col2 = 'accuracy' AND col3 = $playerid");
+ $q_deaths = small_query("SELECT col4 FROM uts_temp_$uid WHERE col1 = 'stat_player' AND col2 = 'deaths' AND col3 = $playerid");
+ $q_kills = small_query("SELECT col4 FROM uts_temp_$uid WHERE col1 = 'stat_player' AND col2 = 'kills' AND col3 = $playerid");
+ $q_teamkills = small_query("SELECT col4 FROM uts_temp_$uid WHERE col1 = 'stat_player' AND col2 = 'teamkills' AND col3 = $playerid");
+ $q_efficiency = small_query("SELECT col4 FROM uts_temp_$uid WHERE col1 = 'stat_player' AND col2 = 'efficiency' AND col3 = $playerid");
+ $q_suicides = small_query("SELECT col4 FROM uts_temp_$uid WHERE col1 = 'stat_player' AND col2 = 'suicides' AND col3 = $playerid");
+ $q_tos = small_query("SELECT col4 FROM uts_temp_$uid WHERE col1 = 'stat_player' AND col2 = 'time_on_server' AND col3 = $playerid");
+ $q_ttl = small_query("SELECT col4 FROM uts_temp_$uid WHERE col1 = 'stat_player' AND col2 = 'ttl' AND col3 = $playerid");
+ $q_score = small_query("SELECT col4 FROM uts_temp_$uid WHERE col1 = 'stat_player' AND col2 = 'score' AND col3 = $playerid");
+
+ IF ($teamgame == "True") {
+ $r_kills = $q_kills[col4];
+ $r_teamkills = $q_teamkills[col4];
+ }
+ IF ($teamgame == "False") {
+ $r_kills = $q_kills[col4] + $q_teamkills[col4];
+ $r_teamkills = 0;
+ }
+
+ $r_acc = get_dp($q_acc[col4]);
+ $r_efficiency = get_dp($q_efficiency[col4]);
+ $r_deaths = $q_deaths[col4];
+ $r_suicides = $q_suicides[col4];
+ $r_frags = $r_kills-$r_suicides-$r_teamkills;
+
+ $r_tos = get_dp($q_tos[col4]);
+ // time on server can't be longer then the server game time!
+ if ($r_tos > $servergametime) {
+ $r_tos = get_dp($servergametime);
+ }
+ $r_ttl = get_dp($q_ttl[col4]);
+ $r_score = $q_score[col4];
+
+ // Generate player record
+ $sql_playerid = " INSERT
+ INTO uts_player
+ SET matchid = '$matchid',
+ playerid = '$playerid',
+ pid = '$pid',
+ team = '$playerteam',
+ gid = '$gid',
+ insta = '$gameinsta',
+ country = '$playercountry',
+ ip = '$playerip',
+
+
+ spree_double = '$q_spree_dbl',
+ spree_multi = '$q_spree_mult',
+ spree_ultra = '$q_spree_ult',
+ spree_monster = '$q_spree_mon',
+ spree_kill = '$q_spree_kill',
+ spree_rampage = '$q_spree_rampage',
+ spree_dom = '$q_spree_dom',
+ spree_uns = '$q_spree_uns',
+ spree_god = '$q_spree_god',
+
+ pu_pads = '$pu_pads',
+ pu_armour = '$pu_armour',
+ pu_keg = '$pu_keg',
+ pu_belt = '$pu_belt',
+ pu_amp = '$pu_amp',
+ pu_invis = '$pu_invis',
+
+ lowping = '$lowping',
+ highping = '$highping',
+ avgping = '$avgping',
+
+ accuracy = '$r_acc',
+ frags = '$r_frags',
+ deaths = '$r_deaths',
+ kills = '$r_kills',
+ suicides = '$r_suicides',
+ teamkills = '$r_teamkills',
+ eff = '$r_efficiency',
+ gametime = '$r_tos',
+ ttl = '$r_ttl',
+ gamescore= '$r_score'";
+
+ $q_playerid = mysql_query($sql_playerid) or die(mysql_error());
+ $playerecordid = mysql_insert_id();
+
+
+?>
diff --git a/html/import/import_ranking.php b/html/import/import_ranking.php new file mode 100755 index 0000000..9ad18a2 --- /dev/null +++ b/html/import/import_ranking.php @@ -0,0 +1,127 @@ +<?php
+ if ($playerbanned) return;
+// Get sums of different events
+
+ // Work out all possible ranking scores
+ $r_cnt = small_query("SELECT
+ SUM(frags*0.5) AS frags, SUM(deaths*0.25) AS deaths, SUM(suicides*0.25) AS suicides, SUM(teamkills*2) AS teamkills,
+ SUM(flag_taken*1) AS flag_taken, SUM(flag_pickedup*1) AS flag_pickedup, SUM(flag_return*1) AS flag_return, SUM(flag_capture*10) AS flag_capture, SUM(flag_cover*3) AS flag_cover,
+ SUM(flag_seal*2) AS flag_seal, SUM(flag_assist*5) AS flag_assist, SUM(flag_kill*2) AS flag_kill,
+ SUM(dom_cp*10) AS dom_cp, SUM(ass_obj*10) AS ass_obj,
+ SUM(spree_double*1) AS spree_double, SUM(spree_multi*1) AS spree_multi, SUM(spree_ultra*1) AS spree_ultra, SUM(spree_monster*2) AS spree_monster,
+ SUM(spree_kill*1) AS spree_kill, SUM(spree_rampage*1) AS spree_rampage, SUM(spree_dom*1.5) AS spree_dom, SUM(spree_uns*2) AS spree_uns, SUM(spree_god*3) AS spree_god,
+ SUM(gametime) AS gametime
+ FROM uts_player WHERE pid = $pid and gid = $gid and matchid <= $matchid");
+
+ // Work out per game ranking amounts
+ $rank_ctf = $r_cnt[flag_taken]+$r_cnt[flag_pickedup]+$r_cnt[flag_return]+$r_cnt[flag_capture]+$r_cnt[flag_cover]+$r_cnt[flag_seal]+$r_cnt[flag_assist]+$r_cnt[flag_kill];
+ $rank_ass = $r_cnt[ass_obj];
+ $rank_dom = $r_cnt[com_cp];
+ $rank_jb = $r_cnt[ass_obj] * 0.15;
+ $rank_bt = $r_cnt[flag_capture];
+ $rank_fpos = $r_cnt[frags]+$r_cnt[spree_double]+$r_cnt[spree_multi]+$r_cnt[spree_ultra]+$r_cnt[spree_monster]+$r_cnt[spree_kill]+$r_cnt[spree_rampage]+$r_cnt[spree_dom]+$r_cnt[spree_uns]+$r_cnt[spree_god];
+ $rank_fneg = $r_cnt[deaths]+$r_cnt[suicides]+$r_cnt[teamkills];
+ $r_gametime = ceil($r_cnt[gametime]/60);
+
+
+ // Select rank record
+ $r_rankp = small_query("SELECT id, time, rank, matches FROM uts_rank WHERE pid = '$pid' AND gid = '$gid'");
+ $rank_id = $r_rankp[id];
+ $rank_gametime = $r_rankp[time];
+ $rank_crank = $r_rankp[rank];
+ $rank_matches = $r_rankp[matches];
+
+ // Work out initial rank dependant on game, if no game known use DM ranking
+ IF ($gamename == "Assault" || $gamename == "Assault (insta)") {
+ $rank_nrank = $rank_ass+$rank_fpos-$rank_fneg;
+ } elseIF ($gamename == "Capture the Flag" || $gamename == "Capture the Flag (insta)") {
+ $rank_nrank = $rank_ctf+$rank_fpos-$rank_fneg;
+ } elseIF ($gamename == "Domination" || $gamename == "Domination (insta)") {
+ $rank_nrank = $rank_dom+$rank_fpos-$rank_fneg;
+ } elseIF ($gamename == "JailBreak" || $gamename == "JailBreak (insta)") {
+ $rank_nrank = $rank_jb+$rank_fpos-$rank_fneg;
+ } elseIF ($gamename == "Bunny Track") {
+ // The complain about the old system which was based on captures/time only was that noobs
+ // would vote easy maps only and therefore get many caps/hour. This mean much points for the
+ // noobs and fewer for the good players. The new ranking would be based on the fastest captime.
+ $rank_bt = 0;
+ $sql_btmaprank = "SELECT e.col2 AS no, COUNT(e.col2) AS count FROM uts_events AS e, uts_player AS p WHERE p.pid = $pid AND p.gid = $gid AND p.playerid = e.playerid AND e.matchid = p.matchid AND e.matchid <= $matchid AND e.col2 > 0 AND e.col2 <= 5 GROUP BY e.col2";
+ $q_btmaprank = mysql_query($sql_btmaprank) or die ("Can't retrieve \$q_btmaprank: ". mysql_error());
+ while($r_btmaprank = mysql_fetch_assoc($q_btmaprank)) {
+ IF ($r_btmaprank[no] == 1) {
+ $rank_bt += $r_btmaprank[count] * 10;
+ } elseIF ($r_btmaprank[no] == 2) {
+ $rank_bt += $r_btmaprank[count] * 8;
+ } elseIF ($r_btmaprank[no] == 3) {
+ $rank_bt += $r_btmaprank[count] * 6;
+ } elseIF ($r_btmaprank[no] == 4) {
+ $rank_bt += $r_btmaprank[count] * 4;
+ } elseIF ($r_btmaprank[no] == 5) {
+ $rank_bt += $r_btmaprank[count] * 2;
+ }
+ // if ($dbg) echo "| pid: $r_btmaprank[no]*$r_btmaprank[count] => $rank_bt<br>";
+ }
+
+ $rank_nrank = $rank_bt;
+ } else {
+ $rank_nrank = $rank_fpos-$rank_fneg;
+ }
+
+ // Average the rank over game minutes
+ if ($r_gametime == 0) {
+ // some bug occured, ignore
+ if ($dbg) echo "Skip ranking. " ;
+
+ return;
+ }
+
+ $rank_nrank = ($rank_nrank/$r_gametime) * 600;
+ if ($dbg) echo "Points: $rank_nrank<br>Time: $r_gametime<br>";
+
+ // Add rank gametime to previous amount
+ $rank_gametime = $r_gametime;
+
+ // Reduce ranking if player hasnt played that much
+ IF ($rank_gametime < 10) return;
+
+ IF ($rank_gametime < 50) {
+ $rank_nrank = $rank_nrank*.25;
+ }
+
+ IF ($rank_gametime >= 50 && $rank_gametime < 100) {
+ $rank_nrank = $rank_nrank*.50;
+ }
+
+ IF ($rank_gametime >= 100 && $rank_gametime < 200) {
+ $rank_nrank = $rank_nrank*.70;
+ }
+
+ IF ($rank_gametime >= 200 && $rank_gametime < 300) {
+ $rank_nrank = $rank_nrank*.85;
+ }
+
+ if ($dbg) echo "Reduced: $rank_nrank<br>";
+
+ // Add new rank record if one does not exist
+ IF($rank_id == NULL) {
+ mysql_query("INSERT INTO uts_rank SET time = '$r_gametime', pid = '$pid', gid = '$gid', rank = '0', matches = '0';") or die(mysql_error());
+ $rank_id = mysql_insert_id();
+ $rank_gametime = 0;
+ $rank_crank = 0;
+ $rank_matches = 0;
+ }
+
+ // Add number of matches played
+ $rank_matches = $rank_matches+1;
+
+ // Work out effective rank given
+ $eff_rank = $rank_nrank-$rank_crank;
+
+ // if ($dbg) echo "", intval($rank_crank), "-", intval($rank_nrank). "-", $rank_matches, " ";
+
+ // Add effective rank points given to uts_player record
+ mysql_query("UPDATE uts_player SET rank = $eff_rank WHERE id = $playerecordid") or die(mysql_error());
+
+ // Update the rank
+ mysql_query("UPDATE uts_rank SET time = '$rank_gametime', rank = '$rank_nrank', prevrank = '$rank_crank', matches = '$rank_matches' WHERE id = $rank_id;") or die(mysql_error());
+?>
diff --git a/html/import/import_tdm.php b/html/import/import_tdm.php new file mode 100755 index 0000000..6595072 --- /dev/null +++ b/html/import/import_tdm.php @@ -0,0 +1,2 @@ +<?php
+?>
diff --git a/html/import/import_weapons.php b/html/import/import_weapons.php new file mode 100755 index 0000000..5d59a3f --- /dev/null +++ b/html/import/import_weapons.php @@ -0,0 +1,209 @@ +<?php + +// Read all available weapons, we'll need them later +if (!isset($weaponnames)) { + $sql_weaponnames = "SELECT id, name FROM uts_weapons"; + $q_weaponnames = mysql_query($sql_weaponnames); + while ($r_weaponnames = mysql_fetch_array($q_weaponnames)) { + $weaponnames[$r_weaponnames['name']] = $r_weaponnames['id']; + } +} + + +// Get all kills by weapon +$sql_weapons = " SELECT col2 AS player, + col3 AS weaponname, + COUNT(*) AS kills + FROM uts_temp_$uid + WHERE col1 = 'kill' + OR col1 = 'teamkill' + GROUP BY weaponname, player"; + +$q_weapons = mysql_query($sql_weapons) or die(mysql_error()); +$weapons = array(); +while ($r_weapons = mysql_fetch_array($q_weapons)) { + + // Get the wepon's id or assign a new one + if (empty($r_weapons['weaponname'])) continue; + if (isset($weaponnames[$r_weapons['weaponname']])) { + $weaponid = $weaponnames[$r_weapons['weaponname']]; + } else { + mysql_query("INSERT INTO uts_weapons SET name = '". addslashes($r_weapons['weaponname']) ."'") or die(mysql_error()); + $weaponid = mysql_insert_id(); + $weaponnames[$r_weapons['weaponname']] = $weaponid; + } + + // Get the unique pid of this player + if (!isset($playerid2pid[$r_weapons['player']])) { + continue; + } else { + $pid = $playerid2pid[$r_weapons['player']]; + } + + $weapons[$pid][$weaponid] = array( + 'weap_kills' => $r_weapons['kills'], + 'weap_shotcount' => 0, + 'weap_hitcount' => 0, + 'weap_damagegiven' => 0, + 'weap_accuracy' => 0 + ); + + +} + + +// Get the weapon statistics +$sql_weapons = " SELECT col1 AS type, + col2 AS weaponname, + col3 AS player, + col4 AS value + FROM uts_temp_$uid + WHERE col1 LIKE 'weap_%'"; + +$q_weapons = mysql_query($sql_weapons) or die(mysql_error()); +while ($r_weapons = mysql_fetch_array($q_weapons)) { + // Get the wepon's id or assign a new one + if (empty($r_weapons['weaponname'])) continue; + if (isset($weaponnames[$r_weapons['weaponname']])) { + $weaponid = $weaponnames[$r_weapons['weaponname']]; + } else { + mysql_query("INSERT INTO uts_weapons SET name = '". addslashes($r_weapons['weaponname']) ."'") or die(mysql_error()); + $weaponid = mysql_insert_id(); + $weaponnames[$r_weapons['weaponname']] = $weaponid; + } + + // Get the unique pid of this player + if (!isset($playerid2pid[$r_weapons['player']])) { +// Happens if we're ignoring bots or banned players + continue; + } else { + $pid = $playerid2pid[$r_weapons['player']]; + } + + if (!isset($weapons[$pid][$weaponid]['weap_kills'])) { + $weapons[$pid][$weaponid] = array( + 'weap_kills' => 0, + 'weap_shotcount' => 0, + 'weap_hitcount' => 0, + 'weap_damagegiven' => 0, + 'weap_accuracy' => 0 + ); + } + + $weapons[$pid][$weaponid][$r_weapons['type']] = $r_weapons['value']; +} + + +// Finally write the weapon statistics for this match +$s_weapons = array(); +foreach($weapons as $playerid => $weapon) { + foreach($weapon as $weaponid => $infos) { + if ($infos['weap_kills'] == 0 and $infos['weap_shotcount'] == 0) continue; + mysql_query(" INSERT + INTO uts_weaponstats + SET matchid = '$matchid', + pid = '$playerid', + weapon = '$weaponid', + kills = '${infos['weap_kills']}', + shots = '${infos['weap_shotcount']}', + hits= '${infos['weap_hitcount']}', + damage = '${infos['weap_damagegiven']}', + acc = '". round($infos['weap_accuracy'], 2) ."';") or die(mysql_error()); + + // Summarize totals for this match + if (!isset($s_weapons[$weaponid]['weap_kills'])) { + $s_weapons[$weaponid]['weap_kills'] = $infos['weap_kills']; + $s_weapons[$weaponid]['weap_shotcount'] = $infos['weap_shotcount']; + $s_weapons[$weaponid]['weap_hitcount'] = $infos['weap_hitcount']; + $s_weapons[$weaponid]['weap_damagegiven'] = $infos['weap_damagegiven']; + $s_weapons[$weaponid]['weap_accuracy'] = $infos['weap_accuracy']; + } else { + $s_weapons[$weaponid]['weap_kills'] += $infos['weap_kills']; + $s_weapons[$weaponid]['weap_shotcount'] += $infos['weap_shotcount']; + $s_weapons[$weaponid]['weap_hitcount'] += $infos['weap_hitcount']; + $s_weapons[$weaponid]['weap_damagegiven'] += $infos['weap_damagegiven']; + $s_weapons[$weaponid]['weap_accuracy'] = ($s_weapons[$weaponid]['weap_accuracy'] + $infos['weap_accuracy']) / 2; + } + } +} + + +// Update the player's weapon statistics (matchid 0); +foreach($weapons as $playerid => $weapon) { + foreach($weapon as $weaponid => $infos) { + if ($infos['weap_kills'] == 0 and $infos['weap_shotcount'] == 0) continue; + // Check whether a record for this player and weapon already + // exists + $r_pstat = small_query(" SELECT pid + FROM uts_weaponstats + WHERE matchid = '0' + AND pid = '$playerid' + AND weapon = '$weaponid'"); + // No -> create + if (!$r_pstat) { + mysql_query(" INSERT + INTO uts_weaponstats + SET matchid = '0', + pid = '$playerid', + weapon = '$weaponid', + kills = '${infos['weap_kills']}', + shots = '${infos['weap_shotcount']}', + hits= '${infos['weap_hitcount']}', + damage = '${infos['weap_damagegiven']}', + acc = '". round($infos['weap_accuracy'], 2) ."';") or die(mysql_error()); + // Yes -> update + } else { + mysql_query(" UPDATE uts_weaponstats + SET weapon = '$weaponid', + kills = kills + '${infos['weap_kills']}', + shots = shots + '${infos['weap_shotcount']}', + hits = hits + '${infos['weap_hitcount']}', + damage = damage + '${infos['weap_damagegiven']}', + acc = (acc + '". round($infos['weap_accuracy'], 2) ."') / 2 + WHERE matchid = '0' + AND pid = '$playerid' + AND weapon = '$weaponid';") or die(mysql_error()); + } + } +} + +// Update the global weapon statistics (matchid 0, playerid 0 ); +foreach($s_weapons as $weaponid => $infos) { + if ($infos['weap_kills'] == 0 and $infos['weap_shotcount'] == 0) continue; + // Check whether the global record for this weapon already exists + $r_pstat = small_query(" SELECT pid + FROM uts_weaponstats + WHERE matchid = '0' + AND pid = '0' + AND weapon = '$weaponid'"); + // No -> create + if (!$r_pstat) { + mysql_query(" INSERT + INTO uts_weaponstats + SET matchid = '0', + pid = '0', + weapon = '$weaponid', + kills = '${infos['weap_kills']}', + shots = '${infos['weap_shotcount']}', + hits= '${infos['weap_hitcount']}', + damage = '${infos['weap_damagegiven']}', + acc = '". round($infos['weap_accuracy'], 2) ."';") or die(mysql_error()); + // Yes -> update + } else { + mysql_query(" UPDATE uts_weaponstats + SET weapon = '$weaponid', + kills = kills + '${infos['weap_kills']}', + shots = shots + '${infos['weap_shotcount']}', + hits = hits + '${infos['weap_hitcount']}', + damage = damage + '${infos['weap_damagegiven']}', + acc = (acc + '". round($infos['weap_accuracy'], 2) ."') / 2 + WHERE matchid = '0' + AND pid = '0' + AND weapon = '$weaponid';") or die(mysql_error()); + } +} + + + + +?>
\ No newline at end of file diff --git a/html/import/index.htm b/html/import/index.htm new file mode 100755 index 0000000..e69de29 --- /dev/null +++ b/html/import/index.htm diff --git a/html/includes/clanbase.php b/html/includes/clanbase.php new file mode 100755 index 0000000..5ad7640 --- /dev/null +++ b/html/includes/clanbase.php @@ -0,0 +1,90 @@ +<?php
+/*
+ This function is to get the players from a clan.
+ It will return an array with all the information.
+*/
+
+function get_players($cid) {
+ //Load the page where all players are listed into a var.
+
+ $url = 'http://www.clanbase.com/claninfo.php?cid='.$cid.'&frame=1';
+ $file = implode('', file($url));
+
+
+ //Use an expression to get the pid + name from each player
+
+ preg_match_all("/personinfo\.php\?pid+=(.*)(<.a>| )/U", $file, $out, PREG_SET_ORDER);
+
+
+ //for each player split the information and put all info in one array
+
+ for ($x=0;$x<count($out);$x++) {
+ $player[$x]=explode('" class="slink">',$out[$x][1]);
+ }
+
+ //return the array
+
+ return ($player);
+
+ //All players are listed as:
+ //$player[0]
+ //$player[1]
+ //$player[2]
+ //etc.
+
+ //the info for each player is listed as:
+ //$player[0][0] = pid;
+ //$player[0][1] = name;
+}
+
+
+/*
+ This function is to get the clans from a war.
+ It will return an array with all the information.
+*/
+
+function get_clans($wid) {
+ //Load the page where all players are listed into a var.
+
+ $url = 'http://www.clanbase.com/warinfo.php?wid='.$wid.'&frame=1';
+ $file = implode('', file($url));
+
+ //Use an expression to get the tags from each clan
+
+ preg_match_all("/pagetitle'>Match (.*)vs (.*)<.div>/U", $file, $out, PREG_SET_ORDER);
+
+ //Add the information to one array
+
+ $clan[0][0]=$out[0][1];
+ $clan[1][0]=$out[0][2];
+
+ //Use an expression to get the cid + full name from each clan
+
+ preg_match_all("/claninfo\.php\?cid+=(.*)<.a>/U", $file, $out, PREG_SET_ORDER);
+
+ //Add the information to one array
+
+ $temp = explode('" class="slink">', $out[0][1]);
+ $clan[0][1]=$temp[0];
+ $clan[0][2]=$temp[1];
+
+ $temp = explode('" class="slink">', $out[1][1]);
+ $clan[1][1]=$temp[0];
+ $clan[1][2]=$temp[1];
+
+ //return the array
+
+ return ($clan);
+
+
+ //The clans are listed as:
+ //$clan[0]
+ //$clan[1]
+
+ //the info for each clan is listed as:
+ //$clan[0][0] = tag
+ //$clan[0][1] = cid
+ //$clan[0][2] = full name
+
+}
+?>
\ No newline at end of file diff --git a/html/includes/config.php b/html/includes/config.php new file mode 100755 index 0000000..7e9bd6f --- /dev/null +++ b/html/includes/config.php @@ -0,0 +1,188 @@ +<?php
+// Database connection details
+$dbname = "";
+$hostname = "";
+$uname = "";
+$upass = "";
+
+$dbconnect = mysql_connect($hostname,$uname,$upass);
+$dbconnect2 = mysql_select_db($dbname);
+
+// The key needed to run the import script
+$import_adminkey = 'fietsbel';
+
+// When runnning from the command-line (cron jobs):
+// The absolute path to UTStats's home directory.
+// Only needed if you're starting the importer from another directory
+// Leave emtpy if unsure
+$import_homedir = '';
+
+// Use the MySQL temporary tables feature?
+// Available since MySQL 3.23 - requires CREATE TEMPORARY TABLE privilege since 4.0.2
+$import_use_temporary_tables = true; // set to true if available
+
+// Use temporary heap tables?
+// This will (at any cost) keep the entire table in RAM and may speed and/or fuck things up
+$import_use_heap_tables = false; // DON'T USE IF YOU DON'T KNOW WHAT YOU'RE DOING!
+
+// Log files start with...
+$import_log_start = "Unreal.ngLog";
+
+// Log files end with...
+$import_log_extension = ".log";
+
+// How to backup logfiles?
+// Possible values: yes - move logfiles to the backup directory
+// no - don't make a backup. The file will be lost after it was imported
+// compress - will compress the logfile and move it to the backup directory
+// It'll first try bzip2 compression, then gzip (your php must be
+// compiled to support these)
+// If both fail, it will backup the uncompressed log
+// gzip - same as compress but will only try to gzip the file
+$import_log_backup = "yes";
+
+// Purge old logs after x days. 0 to disable.
+$import_log_backups_purge_after = 0;
+
+
+// After how many seconds should we reload the import page?
+// This is to prevent the 'maximum execution time exeeded' error. It will reload
+// the page after the amount of seconds you specify in order to bypass php's time limit.
+// Set to 0 to disable (f.e. if your php does not run in safe mode)
+$import_reload_after = 22;
+
+// Ignore bots and bot kills/deaths?
+$import_ignore_bots = true;
+
+// How to deal with banned players?
+// 1 - (recommended) import the player and display him/her on matchpages (without values :D)
+// but don't include him/her in rankings and don't allow to show individual player stats
+// You may unban a player banned with this setting and all stuff will display again
+// 2 - don't import at all
+// will lead to 'strange' results on matchpages because kills of and against this player
+// won't be shown; efficiency etc. will be calculated including these kills though.
+$import_ban_type = 1;
+
+// Try to import logs from previous versions of UTStats
+// Set this to true and you'll probably some strange results - You've been warned ;)
+$import_incompatible_logs = false;
+
+// Don't import if the gametime was less than x minutes. Set to 0 to import all logs.
+$import_ignore_if_gametime_less_than = 0;
+
+
+// UTStats can download and manage your UTDC logs
+// Enable downloading of UTDC logs?
+$import_utdc_download_enable = false;
+
+// Log files start with...
+$import_utdc_log_start = "[UTDC]";
+
+// Log files end with...
+$import_utdc_log_extension = ".log";
+
+// Screenshot files start with...
+$import_utdc_screenshot_start = "[UTDC]";
+
+// Screenshot files end with...
+$import_utdc_screenshot_extension = ".enc";
+
+// Compress UTDC logfiles after download? [compress/gzip/no]
+// (see $import_log_backup for available options)
+$import_utdc_log_compress = "compress";
+
+// Purge old UTDC logs after x days. 0 to disable.
+$import_utdc_log_purge_after = 0;
+
+// UTStats can download and manage your AnthChecker logs
+// Enable downloading of AC logs?
+$import_ac_download_enable = true;
+
+// Log files start with...
+$import_ac_log_start = "[AC]";
+
+// Log files end with...
+$import_ac_log_extension = ".log";
+
+// Compress AnthChecker logfiles after download? [compress/gzip/no]
+// (see $import_log_backup for available options)
+$import_ac_log_compress = "compress";
+
+// Purge old AnthChecker logs after x days. 0 to disable.
+$import_ac_log_purge_after = 0;
+
+// UTStats can download and manage your ACE logs
+// Enable downloading of ACE logs?
+$import_ace_download_enable = true;
+
+// Log files start with...
+$import_ace_log_start = "[ACE]";
+
+// Log files end with...
+$import_ace_log_extension = ".log";
+
+// Log files start with...
+$import_ace_screenshot_start = "[ACE]";
+
+// Log files end with...
+$import_ace_screenshot_extension = ".jpg";
+
+// Compress ACE logfiles after download? [compress/gzip/no]
+// (see $import_log_backup for available options)
+$import_ace_log_compress = "compress";
+
+// Purge old ACE logs after x days. 0 to disable.
+$import_ace_log_purge_after = 0;
+
+// Enable the creation of pictures? (Signature pictures for users where they can see their current ranking and stuff)
+// Requires GD- and FreeType support.
+// see config_pic.php for picture configuration options
+$pic_enable = true;
+
+
+// FTP Connection Details
+$ftp_use = false; // Whether to auto get the log files
+$ftp_interval = 0; // How often in minutes to allow stats update
+$ftp_type = 'sockets'; // Which FTP module do you want to use?
+ // sockets - (recommended)
+ // Use PHP's socket extension to connect to the FTP server
+ // will fallback to 'pure' if no sockets available
+ // pure - Use fsockopen() to connnect to the FTP server
+ // should work with any php version
+ // php - Use PHP's FTP extension (must be compiled in)
+ // Debugging will not be available with this module and
+ // error handling may not be as good as with the other modules
+
+$ftp_debug = false; // Debugging output that may help you to resolve ftp problems
+
+
+// UT Server 1
+$i = 0;
+$ftp_hostname[$i] = ''; // FTP server location here
+$ftp_port[$i] = 21; // FTP Port - do not remove this even if you do not use ftp
+ // Do not add '' around the port either
+$ftp_uname[$i] = ''; // FTP Username
+$ftp_upass[$i] = ''; // FTP Password
+$ftp_dir[$i][] = '/'; // Directory of the log files - MUST NOT end with a /
+//$ftp_dir[$i][] = '/'; // You may repeat this entry as often as you wish but please remember
+//$ftp_dir[$i][] = '/'; // to enter the directory relative to the last one
+//$ftp_dir[$i][] = '/'; // (or use an absolute path)
+$ftp_passive[$i] = true; // Use passive transfer mode for this connection?
+$ftp_delete[$i] = true; // Delete logs after download?
+
+/*
+// UT Server 2 --- Uncomment this one if needed, or copy/paste the block above if more servers are needed.
+$i++;
+$ftp_hostname[$i] = ''; // FTP server location here
+$ftp_port[$i] = 21; // FTP Port - do not remove this even if you do not use ftp
+ // Do not add '' around the port either
+$ftp_uname[$i] = ''; // FTP Username
+$ftp_upass[$i] = ''; // FTP Password
+$ftp_dir[$i][] = '/'; // Directory of the log files - MUST NOT end with a /
+//$ftp_dir[$i][] = '/'; // You may repeat this entry as often as you wish but please remember
+//$ftp_dir[$i][] = '/'; // to enter the directory relative to the last one
+//$ftp_dir[$i][] = '/'; // (or use an absolute path)
+$ftp_passive[$i] = true; // Use passive transfer mode for this connection?
+$ftp_delete[$i] = true; // Delete logs after download?
+*/
+?>
\ No newline at end of file diff --git a/html/includes/config_pic.php b/html/includes/config_pic.php new file mode 100755 index 0000000..e70aee5 --- /dev/null +++ b/html/includes/config_pic.php @@ -0,0 +1,239 @@ +<?php
+// Picture configuration file
+
+
+// General note about colors:
+// When specifying a color, you specify it's RGB values in hex (like you do in HTML).
+// Example: 00FF00 = green (0 red, 255 green, 0 blue)
+//
+// One speciality:
+// You may also add a fourth 'color', the alpha value.
+// It determines the transparency of your color.
+// Acceptable values are 00 (completely opaque) to 7F (completely transparent)
+// FFFF003F will become half transparent yellow
+
+
+
+
+$i=0;
+// Enable users to use this picutre or (temporary) disable it?
+$pic[$i]['enabled'] = true;
+
+// Set to true if a gid is required for this image
+// (if you're using game related stuff such as rankings or gamename
+// or if you want to be the values limited to one game)
+$pic[$i]['gidrequired'] = true;
+
+// The template picture where we're going to write stuff at
+// We're searching for it in images/templates.
+$pic[$i]['load']['template'] = 'basic.png';
+// Create a copy of the picture and work with that copy?
+// That's needed f.e. if you're using a picture with a palette of colors and want
+// to use colors that aren't in the current palette of that picture
+$pic[$i]['load']['recreate'] = true;
+// If recreating the picture: What shall the background color of the new picture be
+// before we copy the template over it?
+// (Probably only useful if your template contains transparency)
+$pic[$i]['load']['bgcolor'] = 'AAAAAA';
+// Do you want to be this background color to become the transparent color?
+// (if set to yes, everything painted in this color will be transparent)
+$pic[$i]['load']['bgtransparent'] = false;
+
+// What picture type shall we output? (png/jpg/gif)
+$pic[$i]['output']['type'] = 'png';
+
+// You may set some defaults here (explanation of the values in the next block)
+// If a standard is set, you may omit it in the process blocks -- or use it there to
+// override the standard ;)
+$pic[$i]['default']['align'] = 'left';
+$pic[$i]['default']['angle'] = 0;
+$pic[$i]['default']['font'] = 'arbocrest.ttf';
+$pic[$i]['default']['fontcolor'] = 'FFFFFF';
+$pic[$i]['default']['fontsize'] = 12;
+
+
+
+// Now we've loaded the picture and know how to output it.
+// Let's place some fancy stuff on it:
+
+// We use 'process' blocks to place things on our image.
+// You may use as many process blocks as you like
+// Explanation of the possible values:
+//
+// type - the type of the process block (currently only allowed: text)
+//
+// The text-block:
+// value - The text to place on the picure
+// inline variables are available (see below)
+// align - The alignment of the text (left, center, right)
+// (optional, default: left)
+// fontname - The name of the TTF file (must be in images/fonts)
+// (optional if you specified a default value)
+// fontsize - The font size. Depending on your version of GD, this should be specified
+// as the pixel size (GD1) or point size (GD2).
+// (optional, default: 12 [or your default value])
+// fontcolor - The font color :)
+// (optional, default: FFFFFF [or your default value])
+// x_from
+// y_from - The basepoint (roughly the lower-left corner) of the text you want to place
+// x_to - You need to specify this value if you want to alinments center or right
+// we will use an imaginary box, the left corner being x_from and the right corner beiong x_to
+// and then place the text with the alignment you specified into that box
+// angle - The angle in degrees, with 0 degrees being left-to-right reading text. Higher values represent
+// a counter-clockwise rotation. For example, a value of 90 would result in bottom-to-top reading text.
+// Only supported for left aligned text
+// (optional, default: 0 [or your default value])
+
+// It is possible to use inline variables in the 'value' property
+// The following texts will be replaced by their appropriate values:
+// (333 total ;))
+//
+//
+// %GID% - The game id
+// %PID% - The player id
+// %GAMENAME% - The gamename (CTF, DM, ...)
+// %PLAYERNAME% - The player's name
+// %PLAYERCOUNTRY% - Two letter ISO-code of the player's country
+// %LM_GAMEDATE% - Date of the last match
+//
+// %RT% - Rank text (1st, 2nd, ...)
+// %RN% - Rank number (1, 2, ...)
+// %RP% - Ranking points (1934.34)
+//
+// The following values are available for different groups of matches:
+// %xxx_GAMES% - number of games in this category
+// %xxx_GAMESCORE%
+// %xxx_FRAGS%
+// %xxx_KILLS%
+// %xxx_DEATHS%
+// %xxx_SUICIDES%
+// %xxx_EFF% - Efficiency (%)
+// %xxx_ACC% - Accuracy (%)
+// %xxx_TTL% - Time to Live (mm:ss)
+// %xxx_GAMETIME% - Time played (hours as 9,99)
+// %xxx_FLAG_CAPTURE% - Flag events:
+// %xxx_FLAG_COVER%
+// %xxx_FLAG_SEAL%
+// %xxx_FLAG_ASSIST%
+// %xxx_FLAG_KILL%
+// %xxx_FLAG_PICKEDUP%
+// %xxx_DOM_CP% - DOM ControlPoint captures
+// %xxx_ASS_OBJ% - Assault objectives
+// %xxx_SPREE_DOUBLE% - xxx kills
+// %xxx_SPREE_TRIPLE%
+// %xxx_SPREE_MULTI%
+// %xxx_SPREE_MEGA%
+// %xxx_SPREE_ULTRA%
+// %xxx_SPREE_MONSTER%
+// %xxx_SPREE_KILL% - Killing sprees:
+// %xxx_SPREE_RAMPAGE%
+// %xxx_SPREE_DOM%
+// %xxx_SPREE_UNS%
+// %xxx_SPREE_GOD%
+// %xxx_PU_PADS% - Pickups
+// %xxx_PU_ARMOUR%
+// %xxx_PU_KEG%
+// %xxx_PU_INVIS%
+// %xxx_PU_BELT%
+// %xxx_PU_AMP%
+// %xxx_RANKMOVEMENT% - Rank movement (+/- 9.99)
+//
+// replace xxx with:
+// LM for the last match
+// WEEK for all matches of the current week
+// LWEEK for all matches of the last week
+// MONTH for all matches of the current month
+// LMONTH for all matches of the last month
+// YEAR for all matches of the current year
+// LYEAR for all matches of the last year
+// TOTAL for all matches played
+// (the above values are always limited to the GID the user specified)
+// GTOTAL for all matches played regardless of GID
+//
+//
+// Examples: '%PLAYERNAME% has played a total of %TOTAL_GAMES% %GAMENAME% games.'
+// ==> 'Player has played a total of 57 Capture the Flag games.'
+//
+// '%PLAYERNAME%'s overall accuracy this month was %MONTH_ACC% % while it was %LMONTH_ACC% last month!'
+// ==> 'Player's overall accuracy this month was 42.22 % while it was 27.52 % last month!'
+
+
+$j=0;
+$pic[$i]['process'][$j]['type'] = 'text';
+$pic[$i]['process'][$j]['value'] = '%PLAYERNAME%';
+$pic[$i]['process'][$j]['fontcolor'] = '000000';
+$pic[$i]['process'][$j]['fontsize'] = 18;
+$pic[$i]['process'][$j]['x_from'] = 9;
+$pic[$i]['process'][$j]['y_from'] = 23;
+$j++;
+$pic[$i]['process'][$j]['type'] = 'text';
+$pic[$i]['process'][$j]['value'] = '%GAMENAME%';
+$pic[$i]['process'][$j]['fontsize'] = 14;
+$pic[$i]['process'][$j]['x_from'] = 9;
+$pic[$i]['process'][$j]['y_from'] = 43;
+$j++;
+$pic[$i]['process'][$j]['type'] = 'text';
+$pic[$i]['process'][$j]['value'] = 'Rank:';
+$pic[$i]['process'][$j]['fontcolor'] = 'DDDD20';
+$pic[$i]['process'][$j]['x_from'] = 9;
+$pic[$i]['process'][$j]['y_from'] = 69;
+$j++;
+$pic[$i]['process'][$j]['type'] = 'text';
+$pic[$i]['process'][$j]['align'] = 'left';
+$pic[$i]['process'][$j]['value'] = '%RT%';
+$pic[$i]['process'][$j]['x_from'] = 65;
+$pic[$i]['process'][$j]['y_from'] = 69;
+$j++;
+$pic[$i]['process'][$j]['type'] = 'text';
+$pic[$i]['process'][$j]['value'] = 'Hours:';
+$pic[$i]['process'][$j]['fontcolor'] = '000000';
+$pic[$i]['process'][$j]['x_from'] = 9;
+$pic[$i]['process'][$j]['y_from'] = 91;
+$j++;
+$pic[$i]['process'][$j]['type'] = 'text';
+$pic[$i]['process'][$j]['align'] = 'left';
+$pic[$i]['process'][$j]['value'] = '%TOTAL_GAMETIME%';
+$pic[$i]['process'][$j]['x_from'] = 75;
+$pic[$i]['process'][$j]['y_from'] = 91;
+$j++;
+
+
+
+
+
+
+
+
+// The next picture
+
+$i++;
+$pic[$i]['enabled'] = false;
+$pic[$i]['gidrequired'] = false;
+$pic[$i]['load']['template'] = 'basic.png';
+$pic[$i]['load']['recreate'] = true;
+$pic[$i]['load']['bgcolor'] = 'AAAAAA';
+$pic[$i]['load']['bgtransparent'] = false;
+
+$pic[$i]['output']['type'] = 'png';
+
+$pic[$i]['default']['align'] = 'left';
+$pic[$i]['default']['angle'] = 0;
+$pic[$i]['default']['font'] = 'microsbe.ttf';
+$pic[$i]['default']['fontcolor'] = 'FFFFFF';
+$pic[$i]['default']['fontsize'] = 10;
+
+$j=0;
+$pic[$i]['process'][$j]['type'] = 'text';
+$pic[$i]['process'][$j]['value'] = '%PLAYERNAME% sucks!';
+$pic[$i]['process'][$j]['x_from'] = 9;
+$pic[$i]['process'][$j]['y_from'] = 23;
+$j++;
+$pic[$i]['process'][$j]['type'] = 'text';
+$pic[$i]['process'][$j]['value'] = 'in %GAMENAME% games that is...';
+$pic[$i]['process'][$j]['x_from'] = 9;
+$pic[$i]['process'][$j]['y_from'] = 43;
+$j++;
+
+
+
+?>
\ No newline at end of file diff --git a/html/includes/countries.php b/html/includes/countries.php new file mode 100755 index 0000000..4de8dde --- /dev/null +++ b/html/includes/countries.php @@ -0,0 +1,244 @@ +<?php +$a_countries = array( + 'af' => 'Afghanistan', + 'al' => 'Albania, People\'s Socialist Republic of', + 'dz' => 'Algeria, People\'s Democratic Republic of', + 'as' => 'American Samoa', + 'ad' => 'Andorra, Principality of', + 'ao' => 'Angola, Republic of', + 'ai' => 'Anguilla', + 'aq' => 'Antarctica (the territory South of 60 deg S)', + 'ag' => 'Antigua and Barbuda', + 'ar' => 'Argentina, Argentine Republic', + 'am' => 'Armenia', + 'aw' => 'Aruba', + 'au' => 'Australia, Commonwealth of', + 'at' => 'Austria, Republic of', + 'az' => 'Azerbaijan, Republic of', + 'bs' => 'Bahamas, Commonwealth of the', + 'bh' => 'Bahrain, Kingdom of', + 'bd' => 'Bangladesh, People\'s Republic of', + 'bb' => 'Barbados', + 'by' => 'Belarus', + 'be' => 'Belgium, Kingdom of', + 'bz' => 'Belize', + 'bj' => 'Benin, People\'s Republic of', + 'bm' => 'Bermuda', + 'bt' => 'Bhutan, Kingdom of', + 'bo' => 'Bolivia, Republic of', + 'ba' => 'Bosnia and Herzegovina', + 'bw' => 'Botswana, Republic of', + 'bv' => 'Bouvet Island (Bouvetoya)', + 'br' => 'Brazil, Federative Republic of', + 'io' => 'British Indian Ocean Territory (Chagos Archipelago)', + 'vg' => 'British Virgin Islands', + 'bn' => 'Brunei Darussalam', + 'bg' => 'Bulgaria, People\'s Republic of', + 'bf' => 'Burkina Faso', + 'bi' => 'Burundi, Republic of', + 'kh' => 'Cambodia, Kingdom of', + 'cm' => 'Cameroon, United Republic of', + 'ca' => 'Canada', + 'cv' => 'Cape Verde, Republic of', + 'ky' => 'Cayman Islands', + 'cf' => 'Central African Republic', + 'td' => 'Chad, Republic of', + 'cl' => 'Chile, Republic of', + 'cn' => 'China, People\'s Republic of', + 'cx' => 'Christmas Island', + 'cc' => 'Cocos (Keeling) Islands', + 'co' => 'Colombia, Republic of', + 'km' => 'Comoros, Federal and Islamic Republic of', + 'cd' => 'Congo, Democratic Republic of', + 'cg' => 'Congo, People\'s Republic of', + 'ck' => 'Cook Islands', + 'cr' => 'Costa Rica, Republic of', + 'ci' => 'Cote D\'Ivoire, Ivory Coast, Republic of the', + 'cu' => 'Cuba, Republic of', + 'cy' => 'Cyprus, Republic of', + 'cz' => 'Czech Republic', + 'dk' => 'Denmark, Kingdom of', + 'dj' => 'Djibouti, Republic of', + 'dm' => 'Dominica, Commonwealth of', + 'do' => 'Dominican Republic', + 'tl' => 'Timor-Leste', + 'ec' => 'Ecuador, Republic of', + 'eg' => 'Egypt, Arab Republic of', + 'sv' => 'El Salvador, Republic of', + 'gq' => 'Equatorial Guinea, Republic of', + 'er' => 'Eritrea', + 'ee' => 'Estonia', + 'et' => 'Ethiopia', + 'fo' => 'Faeroe Islands', + 'fk' => 'Falkland Islands (Malvinas)', + 'fj' => 'Fiji, Republic of the Fiji Islands', + 'fi' => 'Finland, Republic of', + 'fr' => 'France, French Republic', + 'gf' => 'French Guiana', + 'pf' => 'French Polynesia', + 'tf' => 'French Southern Territories', + 'ga' => 'Gabon, Gabonese Republic', + 'gm' => 'Gambia, Republic of the', + 'ge' => 'Georgia', + 'de' => 'Germany', + 'gh' => 'Ghana, Republic of', + 'gi' => 'Gibraltar', + 'gr' => 'Greece, Hellenic Republic', + 'gl' => 'Greenland', + 'gd' => 'Grenada', + 'gp' => 'Guadaloupe', + 'gu' => 'Guam', + 'gt' => 'Guatemala, Republic of', + 'gn' => 'Guinea, Revolutionary People\'s Rep\'c of', + 'gw' => 'Guinea-Bissau, Republic of', + 'gy' => 'Guyana, Republic of', + 'ht' => 'Haiti, Republic of', + 'hm' => 'Heard and McDonald Islands', + 'va' => 'Holy See (Vatican City State)', + 'hn' => 'Honduras, Republic of', + 'hk' => 'Hong Kong, Special Administrative Region of China', + 'hr' => 'Hrvatska (Croatia)', + 'hu' => 'Hungary, Hungarian People\'s Republic', + 'is' => 'Iceland, Republic of', + 'in' => 'India, Republic of', + 'id' => 'Indonesia, Republic of', + 'ir' => 'Iran, Islamic Republic of', + 'iq' => 'Iraq, Republic of', + 'ie' => 'Ireland', + 'il' => 'Israel, State of', + 'it' => 'Italy, Italian Republic', + 'jm' => 'Jamaica', + 'jp' => 'Japan', + 'jo' => 'Jordan, Hashemite Kingdom of', + 'kz' => 'Kazakhstan, Republic of', + 'ke' => 'Kenya, Republic of', + 'ki' => 'Kiribati, Republic of', + 'kp' => 'Korea, Democratic People\'s Republic of', + 'kr' => 'Korea, Republic of', + 'kw' => 'Kuwait, State of', + 'kg' => 'Kyrgyz Republic', + 'la' => 'Lao People\'s Democratic Republic', + 'lv' => 'Latvia', + 'lb' => 'Lebanon, Lebanese Republic', + 'ls' => 'Lesotho, Kingdom of', + 'lr' => 'Liberia, Republic of', + 'ly' => 'Libyan Arab Jamahiriya', + 'li' => 'Liechtenstein, Principality of', + 'lt' => 'Lithuania', + 'lu' => 'Luxembourg, Grand Duchy of', + 'mo' => 'Macao, Special Administrative Region of China', + 'mk' => 'Macedonia, the former Yugoslav Republic of', + 'mg' => 'Madagascar, Republic of', + 'mw' => 'Malawi, Republic of', + 'my' => 'Malaysia', + 'mv' => 'Maldives, Republic of', + 'ml' => 'Mali, Republic of', + 'mt' => 'Malta, Republic of', + 'mh' => 'Marshall Islands', + 'mq' => 'Martinique', + 'mr' => 'Mauritania, Islamic Republic of', + 'mu' => 'Mauritius', + 'yt' => 'Mayotte', + 'mx' => 'Mexico, United Mexican States', + 'fm' => 'Micronesia, Federated States of', + 'md' => 'Moldova, Republic of', + 'mc' => 'Monaco, Principality of', + 'mn' => 'Mongolia, Mongolian People\'s Republic', + 'ms' => 'Montserrat', + 'ma' => 'Morocco, Kingdom of', + 'mz' => 'Mozambique, People\'s Republic of', + 'mm' => 'Myanmar', + 'na' => 'Namibia', + 'nr' => 'Nauru, Republic of', + 'np' => 'Nepal, Kingdom of', + 'an' => 'Netherlands Antilles', + 'nl' => 'Netherlands, Kingdom of the', + 'nc' => 'New Caledonia', + 'nz' => 'New Zealand', + 'ni' => 'Nicaragua, Republic of', + 'ne' => 'Niger, Republic of the', + 'ng' => 'Nigeria, Federal Republic of', + 'nu' => 'Niue, Republic of', + 'nf' => 'Norfolk Island', + 'mp' => 'Northern Mariana Islands', + 'no' => 'Norway, Kingdom of', + 'om' => 'Oman, Sultanate of', + 'pk' => 'Pakistan, Islamic Republic of', + 'pw' => 'Palau', + 'ps' => 'Palestinian Territory, Occupied', + 'pa' => 'Panama, Republic of', + 'pg' => 'Papua New Guinea', + 'py' => 'Paraguay, Republic of', + 'pe' => 'Peru, Republic of', + 'ph' => 'Philippines, Republic of the', + 'pn' => 'Pitcairn Island', + 'pl' => 'Poland, Polish People\'s Republic', + 'pt' => 'Portugal, Portuguese Republic', + 'pr' => 'Puerto Rico', + 'qa' => 'Qatar, State of', + 're' => 'Reunion', + 'ro' => 'Romania, Socialist Republic of', + 'ru' => 'Russian Federation', + 'rw' => 'Rwanda, Rwandese Republic', + 'sh' => 'St. Helena', + 'kn' => 'St. Kitts and Nevis', + 'lc' => 'St. Lucia', + 'pm' => 'St. Pierre and Miquelon', + 'vc' => 'St. Vincent and the Grenadines', + 'ws' => 'Samoa, Independent State of', + 'sm' => 'San Marino, Republic of', + 'st' => 'Sao Tome and Principe, Democratic Republic of', + 'sa' => 'Saudi Arabia, Kingdom of', + 'sn' => 'Senegal, Republic of', + 'sc' => 'Seychelles, Republic of', + 'sl' => 'Sierra Leone, Republic of', + 'sg' => 'Singapore, Republic of', + 'sk' => 'Slovakia (Slovak Republic)', + 'si' => 'Slovenia', + 'sb' => 'Solomon Islands', + 'so' => 'Somalia, Somali Republic', + 'za' => 'South Africa, Republic of', + 'gs' => 'South Georgia and the South Sandwich Islands', + 'es' => 'Spain, Spanish State', + 'lk' => 'Sri Lanka, Democratic Socialist Republic of', + 'sd' => 'Sudan, Democratic Republic of the', + 'sr' => 'Suriname, Republic of', + 'sg' => 'Svalbard & Jan Mayen Islands', + 'sz' => 'Swaziland, Kingdom of', + 'se' => 'Sweden, Kingdom of', + 'ch' => 'Switzerland, Swiss Confederation', + 'sy' => 'Syrian Arab Republic', + 'tw' => 'Taiwan, Province of China', + 'tj' => 'Tajikistan', + 'tz' => 'Tanzania, United Republic of', + 'th' => 'Thailand, Kingdom of', + 'tg' => 'Togo, Togolese Republic', + 'tk' => 'Tokelau (Tokelau Islands)', + 'to' => 'Tonga, Kingdom of', + 'tt' => 'Trinidad and Tobago, Republic of', + 'tn' => 'Tunisia, Republic of', + 'tr' => 'Turkey, Republic of', + 'tm' => 'Turkmenistan', + 'tc' => 'Turks and Caicos Islands', + 'tv' => 'Tuvalu', + 'vi' => 'US Virgin Islands', + 'ug' => 'Uganda, Republic of', + 'ua' => 'Ukraine', + 'ae' => 'United Arab Emirates', + 'gb' => 'United Kingdom of Great Britain & N. Ireland', + 'um' => 'United States Minor Outlying Islands', + 'us' => 'United States of America', + 'uy' => 'Uruguay, Eastern Republic of', + 'uz' => 'Uzbekistan', + 'vu' => 'Vanuatu', + 've' => 'Venezuela, Bolivarian Republic of', + 'vn' => 'Viet Nam, Socialist Republic of', + 'wf' => 'Wallis and Futuna Islands', + 'eh' => 'Western Sahara', + 'ye' => 'Yemen', + 'yu' => 'Yugoslavia, Socialist Federal Republic of', + 'zm' => 'Zambia, Republic of', + 'zw' => 'Zimbabwe', + 'xx' => 'Unknown country' + ); +?>
\ No newline at end of file diff --git a/html/includes/footer.php b/html/includes/footer.php new file mode 100755 index 0000000..0fd4f3f --- /dev/null +++ b/html/includes/footer.php @@ -0,0 +1,16 @@ +<?php
+echo'<br><br><br>
+<table class = "box" border="0" cellpadding="1" width="720">';
+
+// Please leave this bit in, its the least you can do with all the work we have done :)
+
+ echo'<tr>
+ <td class="smheading" align="center"><a href="http://utstats.unrealadmin.org/" target="_blank">
+ UTStats Beta 4.2.8</a> © 2005 azazel, AnthraX and toa</td>
+ </tr>
+ </table>
+</center>
+</td></tr></tbody></table>
+</body></html>';
+
+ob_end_flush();
\ No newline at end of file diff --git a/html/includes/ftp.php b/html/includes/ftp.php new file mode 100755 index 0000000..7e058a3 --- /dev/null +++ b/html/includes/ftp.php @@ -0,0 +1,411 @@ +<?php
+
+//require_once('config.php');
+
+DeBugMessage("Execute: includes/ftp.php\nUse ftp_type: $ftp_type");
+
+if ($ftp_type == 'php') {
+ require(dirname(__FILE__) . '/ftp_class_native.php');
+
+} else {
+
+ require(dirname(__FILE__) . '/ftp_class.php');
+
+}
+
+
+
+$g_ftp_error = false;
+
+
+
+function ftp_error($message) {
+
+ global $html, $g_ftp_error, $ftp;
+
+
+
+ $g_ftp_error = true;
+
+ tablerow('ERROR:', $message, true);
+
+ while(($err = $ftp->PopError()) !== false) {
+
+ $fctname = $err['fctname'];
+
+ $msg = $err['msg'];
+
+ $desc = $err['desc'];
+
+ if($desc) $tmp=' ('.$desc.')'; else $tmp='';
+
+ if (strpos($msg, 'socket set') === 0) {
+
+ $tmp .= "\nTry disabling the usage of sockets (set \$ftp_type = 'pure'; in config.php)";
+
+ }
+
+ tablerow('Error details:', $fctname.': '.$msg.$tmp, true);
+
+ }
+
+
+
+}
+
+
+
+function tablerow($left, $right, $error=false) {
+
+ global $html, $ftp_debug;
+
+ if ($ftp_debug) return;
+
+ $space = ($html) ? ' ' : ' ';
+
+ $left = (empty($left)) ? $space : (($html) ? htmlentities($left) : $left);
+
+ $right = (empty($right)) ? $space : (($html) ? nl2br(htmlentities($right)) : $right);
+
+ $style = ($error) ? 'style="background-color: red;"' : '';
+
+ if ($html) {
+
+ echo '<tr>';
+
+ echo '<td class="smheading" '. $style .' align="left" width="170">'. $left .'</td>';
+
+ echo '<td class="grey" '. $style .' align="left" width="380">'. $right .'</td>';
+
+ echo '</tr>';
+
+ } else {
+
+ if (strlen($left) < 30) $left .= str_repeat(" ", 30 - strlen($left));
+
+ echo "$left $right\n";
+
+ }
+
+ flush();
+
+}
+
+
+
+function ftpupdate()
+
+{
+
+ global $html, $ftp, $ftp_uname, $ftp_upass, $ftp_hostname, $ftp_port, $g_ftp_error, $ftp_debug,
+
+ $ftp_delete, $ftp_movedir, $ftp_dir, $ftp_passive, $import_log_start, $import_log_extension,
+
+ $import_utdc_download_enable, $import_utdc_log_start, $import_utdc_log_extension, $import_utdc_screenshot_start, $import_utdc_screenshot_extension,
+ $import_ac_download_enable, $import_ac_log_start, $import_ac_log_extension,
+ $import_ace_download_enable, $import_ace_log_start, $import_ace_log_extension, $import_ace_screenshot_start, $import_ace_screenshot_extension;
+
+
+
+ if (!$ftp_debug) {
+
+ if ($html) echo'<table class="box" border="0" cellpadding="1" cellspacing="2" style="table-layout:fixed"><tr><td class="smheading" align="center" height="25" width="550" colspan="2">';
+
+ echo "FTP Transferring Log Files...\n";
+
+ if ($html) echo '</td></tr>';
+
+ }
+
+
+
+ // Update, from here on were going to be doing multiple FTP sessions.
+
+ for ($i = 0; $i < count($ftp_hostname); $i++) {
+
+ if ($i != 0) {
+
+ if ($html and !$ftp_debug) echo '<tr><td class="" align="center" height="25" width="550" colspan="2"></td></tr>';
+
+ echo "\n";
+
+ }
+
+
+
+ tablerow('Connecting to server:', $ftp_hostname[$i] .':'. $ftp_port[$i]);
+
+ if (!$ftp->SetServer($ftp_hostname[$i], $ftp_port[$i])) {
+
+ ftp_error("Unable to set server: ". $ftp->lastmsg); $ftp->quit(true); continue;
+
+ }
+
+ if (!$ftp->connect()) {
+
+ ftp_error("Unable to connect to server: ". $ftp->lastmsg); $ftp->quit(true); continue;
+
+ }
+
+
+
+ tablerow('', "Connected, now logging in...");
+
+ if (!$ftp->login($ftp_uname[$i], $ftp_upass[$i])) {
+
+ ftp_error("Login failed!\nBad username/password?"); $ftp->quit(true); continue;
+
+ }
+
+ tablerow('', "Logged in!");
+
+
+
+ if (!$ftp->SetType(FTP_BINARY)) {
+
+ ftp_error("Could not set type: ". $ftp->lastmsg); $ftp->quit(true); continue;
+
+ }
+
+ if (!isset($ftp_passive[$i]) or $ftp_passive[$i]) {
+
+ tablerow("", "Setting passive mode");
+
+ if(!$ftp->Passive(true)) {
+
+ ftp_error("Could not set passive mode: ". $ftp->lastmsg); $ftp->quit(true); continue;
+
+ }
+
+ } else {
+
+ tablerow("", "Setting active mode");
+
+ if(!$ftp->Passive(false)) {
+
+ ftp_error("Could not set active mode: ". $ftp->lastmsg); $ftp->quit(true); continue;
+
+ }
+
+ }
+
+ if (($pwd = $ftp->pwd()) === false) {
+
+ ftp_error("Unable to retrieve current working directory"); $ftp->quit(true); continue;
+
+ }
+
+ tablerow("Current directory is:", $pwd);
+
+
+
+ $dl_start = time();
+
+ $dl_files = 0;
+
+ $dl_bytes = 0;
+
+ $error = false;
+
+ foreach($ftp_dir[$i] as $dir) {
+
+ if (!empty($dir)) {
+
+ if (!$ftp->chdir($dir)) {
+
+ ftp_error("Unable to change directory to: $dir"); $ftp->quit(true); continue;
+
+ }
+
+ tablerow('', "Changing directory to: $dir");
+
+ if (($pwd = $ftp->pwd()) === false) {
+
+ ftp_error("Unable to retrieve current working directory"); $ftp->quit(true); continue;
+
+ }
+
+ tablerow("New directory is:", $pwd);
+
+ }
+
+
+
+ if (($filelist = $ftp->nlist()) === false) {
+
+ ftp_error("Unable to retrieve file list"); continue;
+
+ }
+
+
+
+ tablerow("Directory contains:", count($filelist) ." ". ((count($filelist) == 1) ? 'file' : 'files'));
+
+ if (count($filelist) == 0) {
+
+ continue;
+
+ }
+
+ foreach ($filelist as $filename) {
+
+ if (((substr($filename, 0, strlen($import_log_start)) == $import_log_start) and (substr($filename, strlen($filename) - strlen($import_log_extension)) == $import_log_extension))
+
+ or ($import_utdc_download_enable and (substr($filename, 0, strlen($import_utdc_log_start)) == $import_utdc_log_start) and (substr($filename, strlen($filename) - strlen($import_utdc_log_extension)) == $import_utdc_log_extension))
+
+ or ($import_utdc_download_enable and (substr($filename, 0, strlen($import_utdc_screenshot_start)) == $import_utdc_screenshot_start) and (substr($filename, strlen($filename) - strlen($import_utdc_screenshot_extension)) == $import_utdc_screenshot_extension))
+
+ or ($import_ac_download_enable and (substr($filename, 0, strlen($import_ac_log_start)) == $import_ac_log_start) and (substr($filename, strlen($filename) - strlen($import_ac_log_extension)) == $import_ac_log_extension))
+
+ or ($import_ace_download_enable and (substr($filename, 0, strlen($import_ace_log_start)) == $import_ace_log_start) and (substr($filename, strlen($filename) - strlen($import_ace_log_extension)) == $import_ace_log_extension))
+
+ or ($import_ace_download_enable and (substr($filename, 0, strlen($import_ace_screenshot_start)) == $import_ace_screenshot_start) and (substr($filename, strlen($filename) - strlen($import_ace_screenshot_extension)) == $import_ace_screenshot_extension))) {
+ } else {
+ continue;
+ }
+
+ $size = $ftp->get($filename, 'logs/' . $filename);
+
+ if ($size === FALSE) {
+
+ $result = 'ERROR!';
+
+ $error = true;
+
+ if (file_exists('logs/' . $filename)) {
+ unlink('logs/' . $filename);
+ }
+
+ } else {
+
+ $result = "OK (". number_format(round(($size / 1024), 0)) ." KB)";
+
+ $dl_files++;
+
+ $dl_bytes += $size;
+
+ }
+
+ tablerow(($dl_files == 1) ? 'Downloading...' : '', "$filename -> $result");
+
+ if ((!isset($ftp_delete[$i]) or $ftp_delete[$i]) and !$error) {
+ $ftp->delete($filename);
+ }
+ else {
+ // rename the file to prevent reimporting
+ $ftp->rename($filename, "~" . $filename);
+ }
+
+ }
+
+ }
+
+ $dl_kb = number_format(round(($dl_bytes / 1024), 0));
+
+ $dl_time = time() - $dl_start;
+
+ tablerow("Downloaded:", "$dl_files ". ((count($filelist) == 1) ? 'file' : 'files') ." ($dl_kb KB) in $dl_time seconds");
+
+
+
+ if ($error) {
+
+ ftp_error('There were errors when downoading (some) files!');
+
+ }
+
+
+
+ tablerow("Disconnecting...", "done!");
+
+ $ftp->quit(true);
+
+ }
+
+ if (!$ftp_debug and $html) echo '</table><br />';
+
+ echo "\n\n";
+
+
+
+ //update timestamp
+
+
+
+ if (!$g_ftp_error) {
+
+ $file = fopen('includes/ftptimestamp.php', 'wb+', 1);
+
+ fwrite($file, time());
+
+ fclose($file);
+
+ }
+
+}
+
+
+
+
+
+$fname = 'includes/ftptimestamp.php';
+
+$timestamp = 0;
+
+
+
+if(file_exists($fname))
+
+{
+
+ $file = fopen($fname, 'rb');
+
+ $timestamp = trim(my_fgets($file));
+
+ fclose($file);
+
+}
+
+
+
+if(!$timestamp || (time() - $timestamp) > $ftp_interval*60) {
+
+ if ($timestamp) {
+
+ if ($html) echo '<p class="pages">';
+
+ echo "Last FTP update more than $ftp_interval minutes ago, starting update ($ftp_type): \n";
+
+ if ($html) echo '</p>';
+
+ }
+
+ if ($ftp_debug) {
+
+ if ($html) echo '<table class="box" border="0"><tr><td class="smheading" width="550">';
+
+ echo "FTP Debugging Output:\n";
+
+ if ($html) echo '</td></tr><tr><td width="550" align="left"><pre>';
+
+ }
+
+ $ftp = new ftp($ftp_debug, $ftp_debug);
+
+ ftpupdate();
+
+ if ($ftp_debug and $html) echo '</pre></td></tr></table><br />';
+
+} else {
+
+ if ($html) echo '<p class="pages">';
+
+ echo "Last FTP update was ". round(((time() - $timestamp) / 60), 0) ." minutes ago, no update necessary\n";
+
+ if ($html) echo '</p>';
+
+}
+
+
+
+?>
\ No newline at end of file diff --git a/html/includes/ftp_class.php b/html/includes/ftp_class.php new file mode 100755 index 0000000..5281379 --- /dev/null +++ b/html/includes/ftp_class.php @@ -0,0 +1,492 @@ +<?php
+//
+// pemftp - Class by Alexey Dotsenko <alex at paneuromedia dot com>
+// http://www.phpclasses.org/browse/package/1743.html
+// License: Free for non-commercial use
+//
+
+if(!defined('CRLF')) define('CRLF',"\r\n");
+if(!defined("FTP_AUTOASCII")) define("FTP_AUTOASCII", -1);
+if(!defined("FTP_BINARY")) define("FTP_BINARY", 1);
+if(!defined("FTP_ASCII")) define("FTP_ASCII", 0);
+if(!defined('FTP_FORCE')) define('FTP_FORCE', TRUE);
+define('FTP_OS_Unix','u');
+define('FTP_OS_Windows','w');
+define('FTP_OS_Mac','m');
+
+class ftp_base {
+ /* Public variables */
+ var $LocalEcho=FALSE;
+ var $Verbose=FALSE;
+ var $OS_local;
+ var $lastmsg;
+
+ /* Private variables */
+ var $_lastaction=NULL;
+ var $_errors;
+ var $_type;
+ var $_umask;
+ var $_timeout;
+ var $_passive;
+ var $_host;
+ var $_fullhost;
+ var $_port;
+ var $_datahost;
+ var $_dataport;
+ var $_ftp_control_sock;
+ var $_ftp_data_sock;
+ var $_ftp_temp_sock;
+ var $_login;
+ var $_password;
+ var $_connected;
+ var $_ready;
+ var $_code;
+ var $_message;
+ var $_can_restore;
+ var $_port_available;
+
+ var $_error_array=array();
+ var $AuthorizedTransferMode=array(
+ FTP_AUTOASCII,
+ FTP_ASCII,
+ FTP_BINARY
+ );
+ var $OS_FullName=array(
+ FTP_OS_Unix => 'UNIX',
+ FTP_OS_Windows => 'WINDOWS',
+ FTP_OS_Mac => 'MACOS'
+ );
+ var $NewLineCode=array(
+ FTP_OS_Unix => "\n",
+ FTP_OS_Mac => "\r",
+ FTP_OS_Windows => "\r\n"
+ );
+ var $AutoAsciiExt=array("ASP","BAT","C","CPP","CSV","H","HTM","HTML","SHTML","INI","LOG","PHP","PHP3","PL","PERL","SH","SQL","TXT");
+
+ /* Constructor */
+ function ftp_base($port_mode=FALSE) {
+ $this->_port_available=($port_mode==TRUE);
+ $this->SendMSG("Staring FTP client class with".($this->_port_available?"":"out")." PORT mode support");
+ $this->_connected=FALSE;
+ $this->_ready=FALSE;
+ $this->_can_restore=FALSE;
+ $this->_code=0;
+ $this->_message="";
+ $this->SetUmask(0022);
+ $this->SetType(FTP_AUTOASCII);
+ $this->SetTimeout(30);
+ $this->Passive(!$this->_port_available);
+ $this->_login="anonymous";
+ $this->_password="anon@ftp.com";
+ $this->OS_local=FTP_OS_Unix;
+ if(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') $this->OS_local=FTP_OS_Windows;
+ elseif(strtoupper(substr(PHP_OS, 0, 3)) === 'MAC') $this->OS_local=FTP_OS_Mac;
+ }
+
+// <!-- --------------------------------------------------------------------------------------- -->
+// <!-- Public functions -->
+// <!-- --------------------------------------------------------------------------------------- -->
+ function parselisting($list) {
+// Parses i line like: "drwxrwx--- 2 owner group 4096 Apr 23 14:57 text"
+ if(preg_match("/^([-ld])([rwxst-]+)\s+(\d+)\s+(\w+)\s+(\w+)\s+(\d+)\s+(\w{3})\s+(\d+)\s+([\:\d]+)\s+(.+)$/i", $list, $ret)) {
+ $v=array(
+ "type" => ($ret[1]=="-"?"f":$ret[1]),
+ "perms" => 0,
+ "inode" => $ret[3],
+ "owner" => $ret[4],
+ "group" => $ret[5],
+ "size" => $ret[6],
+ "date" => $ret[7]." ".$ret[8]." ".$ret[9],
+ "name" => $ret[10]
+ );
+ $v["perms"]+=00400*(int)($ret[2]{0}=="r");
+ $v["perms"]+=00200*(int)($ret[2]{1}=="w");
+ $v["perms"]+=00100*(int)in_array($ret[2]{2}, array("x","s"));
+ $v["perms"]+=00040*(int)($ret[2]{3}=="r");
+ $v["perms"]+=00020*(int)($ret[2]{4}=="w");
+ $v["perms"]+=00010*(int)in_array($ret[2]{5}, array("x","s"));
+ $v["perms"]+=00004*(int)($ret[2]{6}=="r");
+ $v["perms"]+=00002*(int)($ret[2]{7}=="w");
+ $v["perms"]+=00001*(int)in_array($ret[2]{8}, array("x","t"));
+ $v["perms"]+=04000*(int)in_array($ret[2]{2}, array("S","s"));
+ $v["perms"]+=02000*(int)in_array($ret[2]{5}, array("S","s"));
+ $v["perms"]+=01000*(int)in_array($ret[2]{8}, array("T","t"));
+ }
+ return $v;
+ }
+
+ function SendMSG($message = "", $crlf=true) {
+ $this->lastmsg = $message;
+ if ($this->Verbose) {
+ echo $message.($crlf?CRLF:"");
+ flush();
+ }
+ return TRUE;
+ }
+
+ function SetType($mode=FTP_AUTOASCII) {
+ if(!in_array($mode, $this->AuthorizedTransferMode)) {
+ $this->SendMSG("Wrong type");
+ return FALSE;
+ }
+ $this->_type=$mode;
+ $this->SendMSG("Transfer type: ".($this->_type==FTP_BINARY?"binary":($this->_type==FTP_ASCII?"ASCII":"auto ASCII") ) );
+ return TRUE;
+ }
+
+ function Passive($pasv=NULL) {
+ if(is_null($pasv)) $this->_passive=!$this->_passive;
+ else $this->_passive=$pasv;
+ if(!$this->_port_available and !$this->_passive) {
+ $this->SendMSG("Only passive connections available!");
+ $this->_passive=TRUE;
+ return FALSE;
+ }
+ $this->SendMSG("Passive mode ".($this->_passive?"on":"off"));
+ return TRUE;
+ }
+
+ function SetServer($host, $port=21, $reconnect=true) {
+ global $ftp_debug;
+ if ($ftp_debug) {
+ $this->verbose=true;
+ $this->SendMSG("Connect to:<br>\n- Server: $host<br>\n- Port: $port<br>\n");
+ $this->verbose=false;
+ }
+ $port = intval($port);
+ if(!is_long($port)) {
+ $this->verbose=true;
+ $this->SendMSG("Incorrect port syntax");
+ return FALSE;
+ } else {
+ $ip=@gethostbyname($host);
+ $dns=@gethostbyaddr($host);
+ if(!$ip) $ip=$host;
+ if(!$dns) $dns=$host;
+ if(ip2long($ip) === -1) {
+ $this->SendMSG("Wrong host name/address \"".$host."\"");
+ return FALSE;
+ }
+ $this->_host=$ip;
+ $this->_fullhost=$dns;
+ $this->_port=$port;
+ $this->_dataport=$port-1;
+ }
+ $this->SendMSG("Host \"".$this->_fullhost."(".$this->_host."):".$this->_port."\"");
+ if($reconnect){
+ if($this->_connected) {
+ $this->SendMSG("Reconnecting");
+ if(!$this->quit(FTP_FORCE)) return FALSE;
+ if(!$this->connect()) return FALSE;
+ }
+ }
+ return TRUE;
+ }
+
+ function SetUmask($umask=0022) {
+ $this->_umask=$umask;
+ umask($this->_umask);
+ $this->SendMSG("UMASK 0".decoct($this->_umask));
+ return TRUE;
+ }
+
+ function SetTimeout($timeout=30) {
+ $this->_timeout=$timeout;
+ $this->SendMSG("Timeout ".$this->_timeout);
+ if($this->_connected)
+ if(!$this->_settimeout($this->_ftp_control_sock)) return FALSE;
+ return TRUE;
+ }
+
+ function connect() {
+ $this->SendMsg('Local OS : '.$this->OS_FullName[$this->OS_local]);
+ if(!($this->_ftp_control_sock = $this->_connect($this->_host, $this->_port))) {
+ $this->SendMSG("Error : Cannot connect to remote host \"".$this->_fullhost." :".$this->_port."\"");
+ return FALSE;
+ }
+ $this->SendMSG("Connected to remote host \"".$this->_fullhost.":".$this->_port."\". Waiting for greeting.");
+ do {
+ if(!$this->_readmsg()) return FALSE;
+ if(!$this->_checkCode()) return FALSE;
+ $this->_lastaction=time();
+ } while($this->_code<200);
+ $this->_ready=true;
+ return TRUE;
+ }
+
+ function quit($force=false) {
+ if($this->_ready) {
+ if(!$this->_exec("QUIT") and !$force) return FALSE;
+ if(!$this->_checkCode() and !$force) return FALSE;
+ $this->_ready=false;
+ $this->SendMSG("Session finished");
+ }
+ $this->_quit();
+ return TRUE;
+ }
+
+ function login($user=NULL, $pass=NULL) {
+ if(!is_null($user)) $this->_login=$user;
+ else $this->_login="anonymous";
+ if(!is_null($pass)) $this->_password=$pass;
+ else $this->_password="anon@anon.com";
+ if(!$this->_exec("USER ".$this->_login, "login")) return FALSE;
+ if(!$this->_checkCode()) return FALSE;
+ if($this->_code!=230) {
+ if(!$this->_exec((($this->_code==331)?"PASS ":"ACCT ").$this->_password, "login")) return FALSE;
+ if(!$this->_checkCode()) return FALSE;
+ }
+ $this->SendMSG("Authentication succeeded");
+ $this->_can_restore=$this->restore(100);
+ $this->SendMSG("This server can".($this->_can_restore?"":"'t")." resume broken uploads/downloads");
+ return TRUE;
+ }
+
+ function pwd() {
+ if(!$this->_exec("PWD", "pwd")) return FALSE;
+ if(!$this->_checkCode()) return FALSE;
+ return ereg_replace("^[0-9]{3} \"(.+)\" .+".CRLF, "\\1", $this->_message);
+ }
+
+ function cdup() {
+ if(!$this->_exec("CDUP", "cdup")) return FALSE;
+ if(!$this->_checkCode()) return FALSE;
+ return true;
+ }
+
+ function chdir($pathname) {
+ if(!$this->_exec("CWD ".$pathname, "chdir")) return FALSE;
+ if(!$this->_checkCode()) return FALSE;
+ return TRUE;
+ }
+
+ function rmdir($pathname) {
+ if(!$this->_exec("RMD ".$pathname, "rmdir")) return FALSE;
+ if(!$this->_checkCode()) return FALSE;
+ return TRUE;
+ }
+
+ function mkdir($pathname) {
+ if(!$this->_exec("MKD ".$pathname, "mkdir")) return FALSE;
+ if(!$this->_checkCode()) return FALSE;
+ return TRUE;
+ }
+
+ function rename($from, $to) {
+ if(!$this->_exec("RNFR ".$from, "rename")) return FALSE;
+ if(!$this->_checkCode()) return FALSE;
+ if($this->_code==350) {
+ if(!$this->_exec("RNTO ".$to, "rename")) return FALSE;
+ if(!$this->_checkCode()) return FALSE;
+ } else return FALSE;
+ return TRUE;
+ }
+
+ function filesize($pathname) {
+ if(!$this->_exec("SIZE ".$pathname, "filesize")) return FALSE;
+ if(!$this->_checkCode()) return FALSE;
+ return ereg_replace("^[0-9]{3} ([0-9]+)".CRLF, "\\1", $this->_message);
+ }
+
+ function mdtm($pathname) {
+ if(!$this->_exec("MDTM ".$pathname, "mdtm")) return FALSE;
+ if(!$this->_checkCode()) return FALSE;
+ $mdtm = ereg_replace("^[0-9]{3} ([0-9]+)".CRLF, "\\1", $this->_message);
+ $date = sscanf($mdtm, "%4d%2d%2d%2d%2d%2d");
+ $timestamp = mktime($date[3], $date[4], $date[5], $date[1], $date[2], $date[0]);
+ return $timestamp;
+ }
+
+ function systype() {
+ if(!$this->_exec("SYST", "systype")) return FALSE;
+ if(!$this->_checkCode()) return FALSE;
+ $DATA = explode(" ", $this->_message);
+ return $DATA[1];
+ }
+
+ function delete($pathname) {
+ if(!$this->_exec("DELE ".$pathname, "delete")) return FALSE;
+ if(!$this->_checkCode()) return FALSE;
+ return TRUE;
+ }
+
+ function site($command, $fnction="site") {
+ if(!$this->_exec("SITE ".$command, $fnction)) return FALSE;
+ if(!$this->_checkCode()) return FALSE;
+ return TRUE;
+ }
+
+ function chmod($pathname, $mode) {
+ if(!$this->site("CHMOD ".decoct($mode)." ".$pathname, "chmod")) return FALSE;
+ return TRUE;
+ }
+
+ function restore($from) {
+ if(!$this->_exec("REST ".$from, "resore")) return FALSE;
+ if(!$this->_checkCode()) return FALSE;
+ return TRUE;
+ }
+
+ function features() {
+ if(!$this->_exec("FEAT", "features")) return FALSE;
+ if(!$this->_checkCode()) return FALSE;
+ return preg_split("/[".CRLF."]+/", ereg_replace("[0-9]{3}[ -][^".CRLF."]*".CRLF, "", $this->_message), -1, PREG_SPLIT_NO_EMPTY);
+ }
+
+ function rawlist($arg="", $pathname="") {
+ return $this->_list(($arg?" ".$arg:"").($pathname?" ".$pathname:""), "LIST", "rawlist");
+ }
+
+ function nlist($arg="", $pathname="") {
+ return $this->_list(($arg?" ".$arg:"").($pathname?" ".$pathname:""), "NLST", "nlist");
+ }
+
+ function is_exists($pathname)
+ {
+ if (!($remote_list = $this->nlist("-a", dirname($pathname)))) {
+ $this->SendMSG("Error : Cannot get remote file list");
+ return -1;
+ }
+ reset($remote_list);
+ while (list(,$value) = each($remote_list)) {
+ if ($value == basename($pathname)) {
+ $this->SendMSG("Remote file ".$pathname." exists");
+ return TRUE;
+ }
+ }
+ $this->SendMSG("Remote file ".$pathname." does not exist");
+ return FALSE;
+ }
+
+ function get($remotefile, $localfile=NULL) {
+ if(is_null($localfile)) $localfile=$remotefile;
+ if (@file_exists($localfile)) $this->SendMSG("Warning : local file will be overwritten");
+ $fp = @fopen($localfile, "w");
+ if (!$fp) {
+ $this->PushError("get","can't open local file", "Cannot create \"".$localfile."\"");
+ return FALSE;
+ }
+ $pi=pathinfo($remotefile);
+ if($this->_type==FTP_ASCII or ($this->_type==FTP_AUTOASCII and in_array(strtoupper($pi["extension"]), $this->AutoAsciiExt))) $mode=FTP_ASCII;
+ else $mode=FTP_BINARY;
+ if(!$this->_data_prepare($mode)) {
+ fclose($fp);
+ return FALSE;
+ }
+ if($this->_can_restore) $this->restore(0);
+ if(!$this->_exec("RETR ".$remotefile, "get")) {
+ $this->_data_close();
+ fclose($fp);
+ return FALSE;
+ }
+ if(!$this->_checkCode()) {
+ $this->_data_close();
+ fclose($fp);
+ return FALSE;
+ }
+ $out=$this->_data_read($mode, $fp);
+ fclose($fp);
+ $this->_data_close();
+ if(!$this->_readmsg()) return FALSE;
+ if(!$this->_checkCode()) return FALSE;
+ return $out;
+ }
+
+ function put($localfile, $remotefile=NULL) {
+ if(is_null($remotefile)) $remotefile=$localfile;
+ if (!@file_exists($localfile)) {
+ $this->PushError("put","can't open local file", "No such file or directory \"".$localfile."\"");
+ return FALSE;
+ }
+ $fp = @fopen($localfile, "r");
+ if (!$fp) {
+ $this->PushError("put","can't open local file", "Cannot read file \"".$localfile."\"");
+ return FALSE;
+ }
+ $pi=pathinfo($localfile);
+ if($this->_type==FTP_ASCII or ($this->_type==FTP_AUTOASCII and in_array(strtoupper($pi["extension"]), $this->AutoAsciiExt))) $mode=FTP_ASCII;
+ else $mode=FTP_BINARY;
+ if(!$this->_data_prepare($mode)) {
+ fclose($fp);
+ return FALSE;
+ }
+ if($this->_can_restore) $this->restore(0);
+ if(!$this->_exec("STOR ".$remotefile, "put")) {
+ $this->_data_close();
+ fclose($fp);
+ return FALSE;
+ }
+ if(!$this->_checkCode()) {
+ $this->_data_close();
+ fclose($fp);
+ return FALSE;
+ }
+ $ret=$this->_data_write($mode, $fp);
+ fclose($fp);
+ $this->_data_close();
+ if(!$this->_readmsg()) return FALSE;
+ if(!$this->_checkCode()) return FALSE;
+ return $ret;
+ }
+
+// <!-- --------------------------------------------------------------------------------------- -->
+// <!-- Private functions -->
+// <!-- --------------------------------------------------------------------------------------- -->
+ function _checkCode() {
+ return ($this->_code<400 and $this->_code>0);
+ }
+
+ function _list($arg="", $cmd="LIST", $fnction="_list") {
+ if(!$this->_data_prepare()) return FALSE;
+ if(!$this->_exec($cmd.$arg, $fnction)) {
+ $this->_data_close();
+ return FALSE;
+ }
+ if($this->_code == 450 and $cmd == "NLST") return(array());
+ if(!$this->_checkCode()) {
+ $this->_data_close();
+ return FALSE;
+ }
+ $out=$this->_data_read();
+ $this->_data_close();
+ if(!$this->_readmsg()) return FALSE;
+ if(!$this->_checkCode()) return FALSE;
+ if($out === FALSE ) return FALSE;
+ $out=preg_split("/[".CRLF."]+/", $out, -1, PREG_SPLIT_NO_EMPTY);
+ $this->SendMSG(implode($this->NewLineCode[$this->OS_local], $out));
+ return $out;
+ }
+
+// <!-- --------------------------------------------------------------------------------------- -->
+// <!-- Partie : gestion des erreurs -->
+// <!-- --------------------------------------------------------------------------------------- -->
+// G�n�re une erreur pour traitement externe � la classe
+ function PushError($fctname,$msg,$desc=false){
+ $error=array();
+ $error['time']=time();
+ $error['fctname']=$fctname;
+ $error['msg']=$msg;
+ $error['desc']=$desc;
+ if($desc) $tmp=' ('.$desc.')'; else $tmp='';
+ $this->SendMSG($fctname.': '.$msg.$tmp);
+ return(array_push($this->_error_array,$error));
+ }
+
+// R�cup�re une erreur externe
+ function PopError(){
+ if(count($this->_error_array)) return(array_pop($this->_error_array));
+ else return(false);
+ }
+}
+
+if (isset($ftp_type) and $ftp_type == 'pure') {
+ require_once "ftp_class_pure.php";
+} else {
+ $mod_sockets=TRUE;
+ if (!extension_loaded('sockets')) {
+ $prefix = (PHP_SHLIB_SUFFIX == 'dll') ? 'php_' : '';
+ if(!@dl($prefix . 'sockets.' . PHP_SHLIB_SUFFIX)) $mod_sockets=FALSE;
+ }
+ require_once "ftp_class_".($mod_sockets?"sockets":"pure").".php";
+}
+?>
\ No newline at end of file diff --git a/html/includes/ftp_class_native.php b/html/includes/ftp_class_native.php new file mode 100755 index 0000000..4f7f1df --- /dev/null +++ b/html/includes/ftp_class_native.php @@ -0,0 +1,142 @@ +<?php
+
+class ftp {
+ var $lastmsg;
+ var $host;
+ var $fullhost;
+ var $port;
+ var $fp;
+ var $transfertype;
+ var $errors = array();
+
+ function SetServer($host, $port) {
+ if (!is_long($port)) {
+ $this->lastmsg = "Incorrect port syntax";
+ return(false);
+ } else {
+ $ip=@gethostbyname($host);
+ $dns=@gethostbyaddr($host);
+ if(!$ip) $ip = $host;
+ if(!$dns) $dns = $host;
+ if(ip2long($ip) === -1) {
+ $this->lastmsg("Wrong host name/address \"".$host."\"");
+ return(false);
+ }
+ $this->host = $ip;
+ $this->fullhost = $dns;
+ $this->port = $port;
+ }
+ return(true);
+ }
+
+ function connect() {
+ $php_erormsg = '';
+ if (!check_extension('ftp') or true) {
+ $this->lastmsg = "No FTP support in this php build!";
+ return(false);
+ }
+ $this->fp = @ftp_connect($this->host, $this->port, 30);
+ if (!$this->fp) {
+ $this->lastmsg = $php_errormsg;
+ return(false);
+ }
+ return(true);
+ }
+
+ function login($user, $pass) {
+ $php_errormsg = '';
+ if (!@ftp_login($this->fp, $user, $pass)) {
+ $this->lastmsg = $php_errormsg;
+ return(false);
+ }
+ return(true);
+ }
+
+ function SetType($transfertype) {
+ $this->transfertype = $transfertype;
+ return(true);
+ }
+
+ function Passive($pasv) {
+ $php_errormsg = '';
+ if (!@ftp_pasv($this->fp, $pasv)) {
+ $this->lastmsg = $php_errormsg;
+ return(false);
+ }
+ return(true);
+ }
+
+ function pwd() {
+ $php_errormsg = '';
+ if (!($res = @ftp_pwd($this->fp))) {
+ $this->lastmsg = $php_errormsg;
+ return(false);
+ }
+ return($res);
+ }
+
+ function chdir($dir) {
+ $php_errormsg = '';
+ if (!@ftp_chdir($this->fp, $dir)) {
+ $this->lastmsg = $php_errormsg;
+ return(false);
+ }
+ return(true);
+ }
+
+ function nlist() {
+ $php_errormsg = '';
+ if (!($res = @ftp_nlist($this->fp, '.'))) {
+ $this->lastmsg = $php_errormsg;
+ return(false);
+ }
+ return($res);
+ }
+
+ function get($remotefile, $localfile) {
+ $php_errormsg = '';
+ if (!@ftp_get($this->fp, $localfile, $remotefile, $this->transfertype)) {
+ $this->lastmsg = $php_errormsg;
+ $this->PushError('get', "Unable to download $remotefile", $php_errormsg);
+ return(false);
+ }
+ return(filesize($localfile));
+ }
+
+ function delete($remotefile) {
+ $php_errormsg = '';
+ if (!@ftp_delete($this->fp, $remotefile)) {
+ $this->lastmsg = $php_errormsg;
+ return(false);
+ }
+ return(true);
+ }
+
+
+ function quit() {
+ if ($this->fp) {
+ ftp_close($this->fp);
+ $this->fp = NULL;
+ }
+ return(true);
+ }
+
+
+ function PushError($fctname, $msg, $desc=false){
+ $error=array();
+ $error['time']=time();
+ $error['fctname']=$fctname;
+ $error['msg']=$msg;
+ $error['desc']=$desc;
+ if($desc) $tmp=' ('.$desc.')'; else $tmp='';
+ return(array_push($this->errors,$error));
+ }
+
+ function PopError(){
+ if(count($this->errors)) return(array_pop($this->_error_array));
+ else return(false);
+ }
+
+
+
+}
diff --git a/html/includes/ftp_class_pure.php b/html/includes/ftp_class_pure.php new file mode 100755 index 0000000..e7806db --- /dev/null +++ b/html/includes/ftp_class_pure.php @@ -0,0 +1,192 @@ +<?php
+//
+// pemftp - Class by Alexey Dotsenko <alex at paneuromedia dot com>
+// http://www.phpclasses.org/browse/package/1743.html
+// License: Free for non-commercial use
+//
+
+
+class ftp extends ftp_base {
+ function ftp($verb=FALSE, $le=FALSE) {
+ $this->LocalEcho = $le;
+ $this->Verbose = $verb;
+ $this->ftp_base();
+ }
+
+// <!-- --------------------------------------------------------------------------------------- -->
+// <!-- Private functions -->
+// <!-- --------------------------------------------------------------------------------------- -->
+
+ function _settimeout($sock) {
+ if(!@stream_set_timeout($sock, $this->_timeout)) {
+ $this->PushError('_settimeout','socket set send timeout');
+ $this->_quit();
+ return FALSE;
+ }
+ return TRUE;
+ }
+
+ function _connect($host, $port) {
+ $this->SendMSG("NOT using PHP's socket extension");
+ $this->SendMSG("Creating socket");
+ $sock = @fsockopen($host, $port, $errno, $errstr, $this->_timeout);
+ if (!$sock) {
+ $this->PushError('_connect','socket connect failed', $errstr." (".$errno.")");
+ return FALSE;
+ }
+ $this->_connected=true;
+ return $sock;
+ }
+
+ function _readmsg($fnction="_readmsg"){
+ if(!$this->_connected) {
+ $this->PushError($fnction, 'Connect first');
+ return FALSE;
+ }
+ $result=true;
+ $this->_message="";
+ $this->_code=0;
+ $go=true;
+ do {
+ $tmp=@my_fgets($this->_ftp_control_sock, 512);
+ if($tmp===false) {
+ $go=$result=false;
+ $this->PushError($fnction,'Read failed');
+ } else {
+ $this->_message.=$tmp;
+// for($i=0; $i<strlen($this->_message); $i++)
+// if(ord($this->_message[$i])<32) echo "#".ord($this->_message[$i]); else echo $this->_message[$i];
+// echo CRLF;
+ if(preg_match("/^([0-9]{3})(-(.*".CRLF.")+\\1)? [^".CRLF."]+".CRLF."$/", $this->_message, $regs)) $go=false;
+ }
+ } while($go);
+ if($this->LocalEcho) echo "GET < ".rtrim($this->_message, CRLF).CRLF;
+ $this->_code=(int)$regs[1];
+ return $result;
+ }
+
+ function _exec($cmd, $fnction="_exec") {
+ if(!$this->_ready) {
+ $this->PushError($fnction,'Connect first');
+ return FALSE;
+ }
+ if($this->LocalEcho) echo "PUT > ",$cmd,CRLF;
+ $status=@fputs($this->_ftp_control_sock, $cmd.CRLF);
+ if($status===false) {
+ $this->PushError($fnction,'socket write failed');
+ return FALSE;
+ }
+ $this->_lastaction=time();
+ if(!$this->_readmsg($fnction)) return FALSE;
+ return TRUE;
+ }
+
+ function _data_prepare($mode=FTP_ASCII) {
+ if($mode==FTP_BINARY) {
+ if(!$this->_exec("TYPE I", "_data_prepare")) return FALSE;
+ } else {
+ if(!$this->_exec("TYPE A", "_data_prepare")) return FALSE;
+ }
+ if($this->_passive) {
+ if(!$this->_exec("PASV", "pasv")) {
+ $this->_data_close();
+ return FALSE;
+ }
+ if(!$this->_checkCode()) {
+ $this->_data_close();
+ return FALSE;
+ }
+ $ip_port = explode(",", ereg_replace("^.+ \\(?([0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]+,[0-9]+)\\)?.*".CRLF."$", "\\1", $this->_message));
+ $this->_datahost=$ip_port[0].".".$ip_port[1].".".$ip_port[2].".".$ip_port[3];
+ $this->_dataport=(((int)$ip_port[4])<<8) + ((int)$ip_port[5]);
+ $this->SendMSG("Connecting to ".$this->_datahost.":".$this->_dataport);
+ $this->_ftp_data_sock=@fsockopen($this->_datahost, $this->_dataport, $errno, $errstr, $this->_timeout);
+ if(!$this->_ftp_data_sock) {
+ $this->PushError("_data_prepare","fsockopen fails", $errstr." (".$errno.")");
+ $this->_data_close();
+ return FALSE;
+ }
+ else $this->_ftp_data_sock;
+ } else {
+ $this->SendMSG("Only passive connections available!");
+ return FALSE;
+ }
+ return TRUE;
+ }
+
+ function _data_read($mode=FTP_ASCII, $fp=NULL) {
+ $NewLine=$this->NewLineCode[$this->OS_local];
+ if(is_resource($fp)) $out=0;
+ else $out="";
+ if(!$this->_passive) {
+ $this->SendMSG("Only passive connections available!");
+ return FALSE;
+ }
+ if($mode!=FTP_BINARY) {
+ while (!feof($this->_ftp_data_sock)) {
+ $tmp=fread($this->_ftp_data_sock, 4096);
+ $line.=$tmp;
+ if(!preg_match("/".CRLF."$/", $line)) continue;
+ $line=rtrim($line,CRLF).$NewLine;
+ if(is_resource($fp)) $out+=fwrite($fp, $line, strlen($line));
+ else $out.=$line;
+ $line="";
+ }
+ } else {
+ while (!feof($this->_ftp_data_sock)) {
+ $block=fread($this->_ftp_data_sock, 4096);
+ if(is_resource($fp)) $out+=fwrite($fp, $block, strlen($block));
+ else $out.=$line;
+ }
+ }
+ return $out;
+ }
+
+ function _data_write($mode=FTP_ASCII, $fp=NULL) {
+ $NewLine=$this->NewLineCode[$this->OS_local];
+ if(is_resource($fp)) $out=0;
+ else $out="";
+ if(!$this->_passive) {
+ $this->SendMSG("Only passive connections available!");
+ return FALSE;
+ }
+ if(is_resource($fp)) {
+ while(!feof($fp)) {
+ $line=my_fgets($fp, 4096);
+ if($mode!=FTP_BINARY) $line=rtrim($line, CRLF).CRLF;
+ do {
+ if(($res=@fwrite($this->_ftp_data_sock, $line))===FALSE) {
+ $this->PushError("_data_write","Can't write to socket");
+ return FALSE;
+ }
+ $line=substr($line, $res);
+ }while($line!="");
+ }
+ } else {
+ if($mode!=FTP_BINARY) $fp=rtrim($fp, $NewLine).CRLF;
+ do {
+ if(($res=@fwrite($this->_ftp_data_sock, $fp))===FALSE) {
+ $this->PushError("_data_write","Can't write to socket");
+ return FALSE;
+ }
+ $fp=substr($fp, $res);
+ }while($fp!="");
+ }
+ return TRUE;
+ }
+
+ function _data_close() {
+ @fclose($this->_ftp_data_sock);
+ $this->SendMSG("Disconnected data from remote host");
+ return TRUE;
+ }
+
+ function _quit($force=FALSE) {
+ if($this->_connected or $force) {
+ @fclose($this->_ftp_control_sock);
+ $this->_connected=false;
+ $this->SendMSG("Socket closed");
+ }
+ }
+}
+?>
\ No newline at end of file diff --git a/html/includes/ftp_class_sockets.php b/html/includes/ftp_class_sockets.php new file mode 100755 index 0000000..8cfd27f --- /dev/null +++ b/html/includes/ftp_class_sockets.php @@ -0,0 +1,249 @@ +<?php
+//
+// pemftp - Class by Alexey Dotsenko <alex at paneuromedia dot com>
+// http://www.phpclasses.org/browse/package/1743.html
+// License: Free for non-commercial use
+//
+
+
+class ftp extends ftp_base {
+ function ftp($verb=FALSE, $le=FALSE) {
+ $this->LocalEcho = $le;
+ $this->Verbose = $verb;
+ $this->ftp_base(TRUE);
+ }
+
+// <!-- --------------------------------------------------------------------------------------- -->
+// <!-- Private functions -->
+// <!-- --------------------------------------------------------------------------------------- -->
+
+ function _settimeout($sock) {
+ if(!@socket_set_option($sock, 1, SO_RCVTIMEO, array("sec"=>$this->_timeout, "usec"=>0))) {
+ $this->PushError('_connect','socket set receive timeout',socket_strerror(socket_last_error($sock)));
+ @socket_close($sock);
+ return FALSE;
+ }
+ if(!@socket_set_option($sock, 1, SO_SNDTIMEO, array("sec"=>$this->_timeout, "usec"=>0))) {
+ $this->PushError('_connect','socket set send timeout',socket_strerror(socket_last_error($sock)));
+ @socket_close($sock);
+ return FALSE;
+ }
+ return true;
+ }
+
+ function _connect($host, $port) {
+ $this->SendMSG("Using PHP's socket extension");
+ $this->SendMSG("Creating socket");
+ $sock = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
+ if ($sock < 0) {
+ $this->PushError('_connect','socket create failed',socket_strerror(socket_last_error($sock)));
+ return FALSE;
+ }
+ if(!$this->_settimeout($sock)) return FALSE;
+ $this->SendMSG("Connecting to \"".$host.":".$port."\"");
+ if (!($res = @socket_connect($sock, $host, $port))) {
+ $this->PushError('_connect','socket connect failed',socket_strerror(socket_last_error($sock)));
+ @socket_close($sock);
+ return FALSE;
+ }
+ $this->_connected=true;
+ return $sock;
+ }
+
+ function _readmsg($fnction="_readmsg"){
+ if(!$this->_connected) {
+ $this->PushError($fnction,'Connect first');
+ return FALSE;
+ }
+ $result=true;
+ $this->_message="";
+ $this->_code=0;
+ $go=true;
+ do {
+ $tmp=@socket_read($this->_ftp_control_sock, 4096, PHP_BINARY_READ);
+ if($tmp===false) {
+ $go=$result=false;
+ $this->PushError($fnction,'Read failed', socket_strerror(socket_last_error($this->_ftp_control_sock)));
+ } elseif($tmp=="") $go=false;
+ else {
+ $this->_message.=$tmp;
+// for($i=0; $i<strlen($this->_message); $i++)
+// if(ord($this->_message[$i])<32) echo "#".ord($this->_message[$i]); else echo $this->_message[$i];
+// echo CRLF;
+ if(preg_match("/^([0-9]{3})(-(.*".CRLF.")+\\1)? [^".CRLF."]+".CRLF."$/", $this->_message, $regs)) $go=false;
+ }
+ } while($go);
+ if($this->LocalEcho) echo "GET < ".rtrim($this->_message, CRLF).CRLF;
+ $this->_code=(int)$regs[1];
+ return $result;
+ }
+
+ function _exec($cmd, $fnction="_exec") {
+ if(!$this->_ready) {
+ $this->PushError($fnction,'Connect first');
+ return FALSE;
+ }
+ if($this->LocalEcho) echo "PUT > ",$cmd,CRLF;
+ $status=@socket_write($this->_ftp_control_sock, $cmd.CRLF);
+ if($status===false) {
+ $this->PushError($fnction,'socket write failed', socket_strerror(socket_last_error($this->stream)));
+ return FALSE;
+ }
+ $this->_lastaction=time();
+ if(!$this->_readmsg($fnction)) return FALSE;
+ return TRUE;
+ }
+
+ function _data_prepare($mode=FTP_ASCII) {
+ if($mode==FTP_BINARY) {
+ if(!$this->_exec("TYPE I", "_data_prepare")) return FALSE;
+ } else {
+ if(!$this->_exec("TYPE A", "_data_prepare")) return FALSE;
+ }
+ $this->SendMSG("Creating data socket");
+ $this->_ftp_data_sock = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
+ if ($this->_ftp_data_sock < 0) {
+ $this->PushError('_data_prepare','socket create failed',socket_strerror(socket_last_error($this->_ftp_data_sock)));
+ return FALSE;
+ }
+ if(!$this->_settimeout($this->_ftp_data_sock)) {
+ $this->_data_close();
+ return FALSE;
+ }
+ if($this->_passive) {
+ if(!$this->_exec("PASV", "pasv")) {
+ $this->_data_close();
+ return FALSE;
+ }
+ if(!$this->_checkCode()) {
+ $this->_data_close();
+ return FALSE;
+ }
+ $ip_port = explode(",", ereg_replace("^.+ \\(?([0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]+,[0-9]+)\\)?.*".CRLF."$", "\\1", $this->_message));
+ $this->_datahost=$ip_port[0].".".$ip_port[1].".".$ip_port[2].".".$ip_port[3];
+ $this->_dataport=(((int)$ip_port[4])<<8) + ((int)$ip_port[5]);
+ $this->SendMSG("Connecting to ".$this->_datahost.":".$this->_dataport);
+ if(!@socket_connect($this->_ftp_data_sock, $this->_datahost, $this->_dataport)) {
+ $this->PushError("_data_prepare","socket_connect", socket_strerror(socket_last_error($this->_ftp_data_sock)));
+ $this->_data_close();
+ return FALSE;
+ }
+ else $this->_ftp_temp_sock=$this->_ftp_data_sock;
+ } else {
+ if(!@socket_getsockname($this->_ftp_control_sock, $addr, $port)) {
+ $this->PushError("_data_prepare","can't get control socket information", socket_strerror(socket_last_error($this->_ftp_control_sock)));
+ $this->_data_close();
+ return FALSE;
+ }
+ if(!@socket_bind($this->_ftp_data_sock,$addr)){
+ $this->PushError("_data_prepare","can't bind data socket", socket_strerror(socket_last_error($this->_ftp_data_sock)));
+ $this->_data_close();
+ return FALSE;
+ }
+ if(!@socket_listen($this->_ftp_data_sock)) {
+ $this->PushError("_data_prepare","can't listen data socket", socket_strerror(socket_last_error($this->_ftp_data_sock)));
+ $this->_data_close();
+ return FALSE;
+ }
+ if(!@socket_getsockname($this->_ftp_data_sock, $this->_datahost, $this->_dataport)) {
+ $this->PushError("_data_prepare","can't get data socket information", socket_strerror(socket_last_error($this->_ftp_data_sock)));
+ $this->_data_close();
+ return FALSE;
+ }
+ if(!$this->_exec('PORT '.str_replace('.',',',$this->_datahost.'.'.($this->_dataport>>8).'.'.($this->_dataport&0x00FF)), "_port")) {
+ $this->_data_close();
+ return FALSE;
+ }
+ if(!$this->_checkCode()) {
+ $this->_data_close();
+ return FALSE;
+ }
+ }
+ return TRUE;
+ }
+
+ function _data_read($mode=FTP_ASCII, $fp=NULL) {
+ $NewLine=$this->NewLineCode[$this->OS_local];
+ if(is_resource($fp)) $out=0;
+ else $out="";
+ if(!$this->_passive) {
+ $this->SendMSG("Connecting to ".$this->_datahost.":".$this->_dataport);
+ $this->_ftp_temp_sock=socket_accept($this->_ftp_data_sock);
+ if($this->_ftp_temp_sock===FALSE) {
+ $this->PushError("_data_read","socket_accept", socket_strerror(socket_last_error($this->_ftp_temp_sock)));
+ $this->_data_close();
+ return FALSE;
+ }
+ }
+ if($mode!=FTP_BINARY) {
+ while(($tmp=@socket_read($this->_ftp_temp_sock, 8192, PHP_NORMAL_READ))!==false) {
+ $line.=$tmp;
+ if(!preg_match("/".CRLF."$/", $line)) continue;
+ $line=rtrim($line,CRLF).$NewLine;
+ if(is_resource($fp)) $out+=fwrite($fp, $line, strlen($line));
+ else $out.=$line;
+ $line="";
+ }
+ } else {
+ while($block=@socket_read($this->_ftp_temp_sock, 8192, PHP_BINARY_READ)) {
+ if(is_resource($fp)) $out+=fwrite($fp, $block, strlen($block));
+ else $out.=$line;
+ }
+ }
+ return $out;
+ }
+
+ function _data_write($mode=FTP_ASCII, $fp=NULL) {
+ $NewLine=$this->NewLineCode[$this->OS_local];
+ if(is_resource($fp)) $out=0;
+ else $out="";
+ if(!$this->_passive) {
+ $this->SendMSG("Connecting to ".$this->_datahost.":".$this->_dataport);
+ $this->_ftp_temp_sock=socket_accept($this->_ftp_data_sock);
+ if($this->_ftp_temp_sock===FALSE) {
+ $this->PushError("_data_write","socket_accept", socket_strerror(socket_last_error($this->_ftp_temp_sock)));
+ $this->_data_close();
+ return FALSE;
+ }
+ }
+ if(is_resource($fp)) {
+ while(!feof($fp)) {
+ $line=my_fgets($fp, 4096);
+ if($mode!=FTP_BINARY) $line=rtrim($line, CRLF).CRLF;
+ do {
+ if(($res=@socket_write($this->_ftp_temp_sock, $line))===FALSE) {
+ $this->PushError("_data_write","socket_write", socket_strerror(socket_last_error($this->_ftp_temp_sock)));
+ return FALSE;
+ }
+ $line=substr($line, $res);
+ }while($line!="");
+ }
+ } else {
+ if($mode!=FTP_BINARY) $fp=rtrim($fp, $NewLine).CRLF;
+ do {
+ if(($res=@socket_write($this->_ftp_temp_sock, $fp))===FALSE) {
+ $this->PushError("_data_write","socket_write", socket_strerror(socket_last_error($this->_ftp_temp_sock)));
+ return FALSE;
+ }
+ $fp=substr($fp, $res);
+ }while($fp!="");
+ }
+ return TRUE;
+ }
+
+ function _data_close() {
+ @socket_close($this->_ftp_temp_sock);
+ @socket_close($this->_ftp_data_sock);
+ $this->SendMSG("Disconnected data from remote host");
+ return TRUE;
+ }
+
+ function _quit() {
+ if($this->_connected) {
+ @socket_close($this->_ftp_control_sock);
+ $this->_connected=false;
+ $this->SendMSG("Socket closed");
+ }
+ }
+}
+?>
\ No newline at end of file diff --git a/html/includes/ftptimestamp.php b/html/includes/ftptimestamp.php new file mode 100755 index 0000000..5b6994a --- /dev/null +++ b/html/includes/ftptimestamp.php @@ -0,0 +1 @@ +1112804209
\ No newline at end of file diff --git a/html/includes/functions.php b/html/includes/functions.php new file mode 100755 index 0000000..1975914 --- /dev/null +++ b/html/includes/functions.php @@ -0,0 +1,605 @@ +<?php
+// error_reporting(E_ALL & ~E_NOTICE);
+error_reporting(0);
+@ini_set('track_errors', '1');
+
+// Image Rotation Code
+$charimages[] = "char1.jpg";
+$charimages[] = "char2.jpg";
+$charimages[] = "char3.jpg";
+$charimages[] = "char4.jpg";
+$charimages[] = "char5.jpg";
+$charimages[] = "char6.jpg";
+$charimages[] = "char7.jpg";
+$charimages[] = "char8.jpg";
+$charimages[] = "char9.jpg";
+$charimages[] = "char10.jpg";
+$charimages[] = "char11.jpg";
+$charimages[] = "char12.jpg";
+$charimages[] = "char13.jpg";
+$charimages[] = "char14.jpg";
+
+srand(microtime() * 1000);
+$charimg = $charimages[rand(0, count($charimages)-1)];
+
+// Two letter codes and their corresponding country names
+require_once(dirname(__FILE__) .'/countries.php');
+
+// Addslashes if magic_quotes are off
+function my_addslashes($data) {
+ IF (!get_magic_quotes_gpc()) {
+ $data = addslashes($data);
+ }
+ return $data;
+}
+
+function my_stripslashes($data) {
+ IF (!get_magic_quotes_gpc()) {
+ $data = $data;
+ } else {
+ $data = stripslashes($data);
+ }
+ return $data;
+}
+
+function my_fgets($fp, $length = -1, $compression = 'none') {
+ static $use_fgets = NULL;
+
+ if ($use_fgets === NULL) $use_fgets = (version_compare(phpversion(), "4.3.0", ">=")) ? true : false;
+
+ if ($use_fgets and $compression == 'none') {
+ if ($length == -1) {
+ return(fgets($fp));
+ } else {
+ return(fgets($fp, $length));
+ }
+ }
+
+ $buffer = '';
+ $i = 0;
+ while(!feof($fp)) {
+ if ($length != -1 and $i >= $length) break;
+ $i++;
+ switch($compression) {
+ case 'bz2': $char = bzread($fp, 1); break;
+ case 'zlib': $char = gzread($fp, 1); break;
+ default: $char = fread($fp, 1);
+ }
+ $buffer .= $char;
+ if ($char == "\n") break;
+ }
+ if (empty($buffer) and feof($fp)) return(false);
+ return($buffer);
+}
+
+function my_fopen($filename, $mode, &$compression) {
+ if ($compression === NULL) {
+ $compression = 'none';
+ if (substr($filename, -4) == '.bz2') {
+ if (check_extension('bz2')) {
+ $compression = 'bz2';
+ } else {
+ return(false);
+ }
+ }
+ if (substr($filename, -3) == '.gz') {
+ if (check_extension('zlib')) {
+ $compression = 'zlib';
+ } else {
+ return(false);
+ }
+ }
+ }
+
+ switch($compression) {
+ case 'bz2': $fp = @bzopen($filename, $mode); break;
+ case 'zlib': $fp = @gzopen($filename, $mode); break;
+ default: $fp = @fopen($filename, $mode); break;
+ }
+ return($fp);
+}
+
+
+function my_fclose($fp, $compression) {
+ switch($compression) {
+ case 'bz2': return(@bzclose($fp));
+ case 'zlib': return(@gzclose($fp));
+ default: return(@fclose($fp));
+ }
+
+}
+
+
+// Small query
+function small_query($query) {
+ $sql_small = "$query";
+ $q_small = mysql_query($sql_small) or die(mysql_error());
+ $r_small = mysql_fetch_array($q_small);
+ return $r_small;
+}
+
+// Small query count
+function small_count($query) {
+ $sql_small = "$query";
+ $q_small = mysql_query($sql_small) or die(mysql_error());
+ $r_small = mysql_num_rows($q_small);
+ return $r_small;
+}
+
+// uid generator
+function str_rand($length = 8, $seeds = 'abcdefghijklmnopqrstuvwxyz0123456789')
+{
+ $str = '';
+ $seeds_count = strlen($seeds);
+
+ // Seed
+ list($usec, $sec) = explode(' ', microtime());
+ $seed = (float) $sec + ((float) $usec * 100000);
+ mt_srand($seed);
+
+ // Generate
+ for ($i = 0; $length > $i; $i++) {
+ $str .= $seeds{mt_rand(0, $seeds_count - 1)};
+ }
+
+ return $str;
+}
+
+function zero_out($data) {
+ if (!is_array($data)) return($data);
+ foreach($data as $key => $value) {
+ if ($value == '0') $data[$key] = '';
+ }
+ return($data);
+}
+
+function get_dp($number) {
+ $dp = number_format($number, 2, '.', '');
+ return ($dp);
+}
+
+function sec2min($number) {
+ $dp = $number/60;
+
+ $dp = number_format($dp, 2, '.', '');
+ return ($dp);
+}
+
+function sec2hour($number) {
+ $dp = $number/3600;
+
+ $dp = number_format($dp, 2, '.', '');
+ return ($dp);
+}
+
+function un_ut($name) {
+ $gname = str_replace("Botpack.", "", "$name");
+ $gname = str_replace("Class ", "", "$gname");
+ $gname = str_replace("CTFGame", "Capture The Flag", "$gname");
+ $gname = str_replace(".unr", "", "$gname");
+ return ($gname);
+}
+
+function mtimestamp($date) {
+ $hour = substr($date, 8, 2);
+ $minute = substr($date, 10, 2);
+ $second = 00;
+ $day = substr($date, 6, 2);
+ $month = substr($date, 4, 2);
+ $year = substr($date, 0, 4);
+
+ return(mktime($hour,$minute,$second,$month,$day,$year));
+}
+
+function mdate($date) {
+
+ $ourdate = date('D, M j Y \a\t g:i a', mtimestamp($date));
+ return ($ourdate);
+}
+
+function mdate2($date) {
+ $hour = substr("$date", 8, 2);
+ $minute = substr("$date", 10, 2);
+ $second = "00";
+ $day = substr("$date", 6, 2);
+ $month = substr("$date", 4, 2);
+ $year = substr("$date", 0, 4);
+
+ $ourdate = mktime($hour,$minute,$second,$month,$day,$year);
+
+ $ourdate = date('Y-m-d g:i a', $ourdate);
+ return ($ourdate);
+}
+
+function utdate($gametime) {
+ $year = substr("$gametime", 0, 4);
+ $month = substr("$gametime", 5, 2);
+ $day = substr("$gametime", 8, 2);
+ $hour = substr("$gametime", 11, 2);
+ $minute = substr("$gametime", 14, 2);
+ $second = substr("$gametime", 17, 2);
+
+ $gametime = $year . $month . $day . $hour . $minute . $second;
+ return ($gametime);
+}
+
+function btcaptime($time) {
+ if (empty($time)) {
+ return;
+ }
+ if ($time < 0) {
+ return "-:--";
+ }
+ $minutes = intval($time / 60);
+ $seconds = intval($time % 60);
+ $hundreds = substr($time, -2, 2);
+ if (substr($hundreds, 0, 1) == '.') {
+ $hundreds = substr($hundreds, 1, 1) . 0;
+ }
+ if ((substr($hundreds, 1, 1) == '.') or (!preg_match("/\./", $time))) {
+ $hundreds = "00";
+ }
+ if ($seconds < 10) {
+ $seconds = "0" . $seconds;
+ }
+ return $minutes . ":" . $seconds . ":" . $hundreds;
+}
+
+// UT Server Query Functions
+function GetItemInfo ($itemname, $itemchunks)
+{
+
+ $retval = "N/A";
+ for ($i = 0; $i < count($itemchunks); $i++) {
+ //Found this item
+
+ if (strcasecmp($itemchunks[$i], $itemname) == 0) {
+ $retval = $itemchunks[$i+1];
+
+ }
+ }
+
+ //Return value
+ return $retval;
+}
+
+function GetMinutes($seconds)
+{
+ $timemins = intval($seconds / 60);
+ $timesecs = ($seconds % 60);
+
+ $Reqlength = 2; //Amount of digits we need
+ if ($Reqlength-strlen($timemins) > 0) $timemins = str_repeat("0",($Reqlength-strlen($timemins))) . $timemins;
+ if ($Reqlength-strlen($timesecs) > 0) $timesecs = str_repeat("0",($Reqlength-strlen($timesecs))) . $timesecs;
+ return $timemins . ":" . $timesecs;
+}
+
+
+function FlagImage($country, $mini = true) {
+ global $a_countries;
+ $width = ($mini) ? 15 : 18;
+ $height = ($mini) ? 10 : 12;
+ if (empty($country)) return('');
+ if (!file_exists("images/flags/$country.png")) return(''); //18*12
+ $countryname = (isset($a_countries[$country])) ? $a_countries[$country] : '';
+ return('<img src="images/flags/'. $country .'.png" width="'.$width.'" height="'.$height.'" style="border:0;" alt="'. $country .'" title="'. $countryname .'">');
+}
+
+
+function RankMovement($diff) {
+ $diff = round($diff, 2);
+ if ($diff == 0) {
+ $chimg = 'same';
+ $chtext = "ranking not affected";
+ }
+ if ($diff > 0) {
+ $chimg = 'up';
+ $chtext = "gained ". get_dp($diff) ." ranking points";
+ }
+ if ($diff < 0) {
+ $chimg = 'down';
+ $chtext = "lost ". get_dp($diff * -1) ." ranking points";
+ }
+ $moveimg = '';
+ if (file_exists("images/ranks/$chimg.png")) {
+ $infos = getimagesize("images/ranks/$chimg.png");
+ $width = $infos[0];
+ $height = $infos[1];
+ $moveimg = '<img src="images/ranks/'. $chimg .'.png" width="'.$width.'" height="'.$height.'" style="border:0;" alt="" title="'. $chtext .'">';
+ }
+ return($moveimg);
+}
+
+
+function ordinal($number) {
+
+ // when fed a number, adds the English ordinal suffix. Works for any
+ // number, even negatives
+
+ if ($number % 100 > 10 && $number %100 < 14):
+ $suffix = "th";
+ else:
+ switch($number % 10) {
+
+ case 0:
+ $suffix = "th";
+ break;
+
+ case 1:
+ $suffix = "st";
+ break;
+
+ case 2:
+ $suffix = "nd";
+ break;
+
+ case 3:
+ $suffix = "rd";
+ break;
+
+ default:
+ $suffix = "th";
+ break;
+ }
+
+ endif;
+
+ return $suffix;
+}
+
+
+function RankImageOrText($pid, $name, $rank, $gid, $gamename, $mini = true, $format = NULL, $rankchange = NULL) {
+
+ $points = 0;
+ if (empty($rank)) {
+ $r_rank = small_query("SELECT rank FROM uts_rank WHERE pid = '$pid' AND gid= '$gid';");
+ if (!$r_rank) return('');
+ $points = get_dp($r_rank['rank']);
+ $r_no = small_query("SELECT (COUNT(*) + 1) AS no FROM uts_rank WHERE gid = '$gid' and rank > ${points}9");
+ $rank = $r_no['no'];
+ }
+
+ $ranktext = $rank.ordinal($rank);
+ if (file_exists("images/ranks/$rank.png")) {
+ $width = ($mini) ? 14 : 16;
+ $height = ($mini) ? 10 : 13;
+ $img = '<img src="images/ranks/'. $rank .'.png" width="'.$width.'" height="'.$height.'" style="border:0;" alt="'. $rank .'" title="'. $ranktext .' in '. $gamename .'">';
+ } else {
+ $img = '';
+ }
+ $moveimg = '';
+ if ($rankchange !== NULL) {
+ $moveimg = ' '. RankMovement($rankchange);
+ }
+
+
+ if (empty($format)) {
+ if ($img) {
+ return($img.$moveimg);
+ } else {
+ return('<span class="rangtext">('.$ranktext.$moveimg.')</span>');
+ }
+ }
+ $imageortext = ($img) ? $img : $ranktext;
+ $search = array('%RT%', '%RN%', '%RP%', '%RI%', '%GN%', '%PN%', '%IT%');
+ $replace = array($ranktext, $rank, $points, $img, $gamename, $name, $imageortext);
+ return(str_replace($search, $replace, $format));
+}
+
+
+function FormatPlayerName($country, $pid, $name, $gid = NULL, $gamename = NULL, $mini = true, $rankchange = NULL) {
+ static $cache = array();
+
+ if (isset($cache[$pid])) return($cache[$pid]);
+
+ $ranktext = false;
+ if (!empty($gamename) and $pid !== NULL) {
+ $ranktext = RankImageOrText($pid, $name, 0, $gid, $gamename, $mini, NULL, $rankchange);
+ }
+ $ret = '';
+ if (!empty($country)) $ret .= FlagImage($country, $mini) ." ";
+ $ret .= htmlentities($name);
+ if ($ranktext) $ret .= " " . $ranktext;
+ $cache[$pid] = $ret;
+ return($ret);
+}
+
+function QuoteHintText($text) {
+ $search = array('\\', '\'', '(', ')');
+ $replace = array('\\\\', '\\\'', '\\(', '\\)');
+ return(str_replace($search, $replace, $text));
+}
+
+
+function OverlibPrintHint($name, $text = NULL, $caption = NULL) {
+ include(dirname(__FILE__) .'/hints.php');
+ if (!isset($hint[$name]) and empty($text)) return('');
+ if ($text === NULL) $text = $hint[$name]['text'];
+ if ($caption === NULL and isset($hint[$name]['caption'])) $caption = $hint[$name]['caption'];
+ $rv = 'onmouseover="return overlib(\''. QuoteHintText($text) .'\'';
+ if ($caption !== NULL) $rv .= ', CAPTION, \''. QuoteHintText($caption) .'\'';
+ $rv .= ');" ';
+ $rv .= 'onmouseout="return nd();"';
+ return($rv);
+}
+
+function debug_output($desc, $data) {
+ echo '<div align="left"><pre>';
+ echo $desc .": ";
+
+ $len = strlen($data);
+ for ($i = 0; $i < $len; $i++) {
+ echo substr($data, $i, 1) .' ';
+ }
+ echo "\n";
+ echo str_repeat(' ', (strlen($desc) + 2));
+ for ($i = 0; $i < $len; $i++) {
+ echo ord(substr($data, $i, 1)) .' ';
+ }
+ echo "</pre></div>";
+}
+
+function check_extension($name) {
+ if (extension_loaded($name)) return(true);
+ if( !(bool)ini_get("enable_dl") or (bool)ini_get( "safe_mode" )) return(false);
+ $prefix = (PHP_SHLIB_SUFFIX == 'dll') ? 'php_' : '';
+ return(@dl($prefix . $name . PHP_SHLIB_SUFFIX));
+}
+
+
+function compress_file($method, $in, $out, $stripx00) {
+ if ((!file_exists($out) and !is_writeable(dirname($out))) or (file_exists($out) and !is_writable($out))) return(false);
+ $blocksize = 8192;
+
+ switch($method) {
+ case 'bz2': $suffix = '.bz2'; break;
+ case 'zlib': $suffix = '.gz'; break;
+ case 'none': $suffix = ''; break;
+ default: return(false);
+ }
+
+ if (substr($out, strlen($out) - strlen($suffix)) != $suffix) $out .= $suffix;
+
+ $fp_in = fopen($in, 'rb');
+ if (!$fp_in) return(false);
+ switch($method) {
+ case 'bz2': $fp_out = @bzopen($out, 'wb'); break;
+ case 'zlib': $fp_out = @gzopen($out, 'wb6'); break;
+ case 'none': $fp_out = @fopen($out, 'wb'); break;
+ }
+ if (!$fp_out) return(false);
+
+ while (!feof($fp_in)) {
+ $buffer = @fread($fp_in, $blocksize);
+ if ($buffer === false) return(false);
+ if ($stripx00) $buffer = preg_replace('/[\x00]/', '', $buffer);
+ switch($method) {
+ case 'bz2': $bytes = @bzwrite($fp_out, $buffer, strlen($buffer)); break;
+ case 'zlib': $bytes = @gzwrite($fp_out, $buffer, strlen($buffer)); break;
+ case 'none': $bytes = @fwrite($fp_out, $buffer, strlen($buffer)); break;
+ }
+ if ($bytes === false) return(false);
+ }
+
+
+ @fclose($fp_in);
+ switch($method) {
+ case 'bz2': @bzclose($fp_out); break;
+ case 'zlib': @gzclose($fp_out); break;
+ case 'none': @fclose($fp_out); break;
+ }
+ return(true);
+}
+
+function backup_logfile($method, $filename, $backupfilename, $stripx00) {
+ switch($method) {
+ case 'compress':
+ if (!check_extension('bz2') or !compress_file('bz2', $filename, $backupfilename, $stripx00)) {
+ return(backup_logfile('gzip', $filename, $backupfilename, $stripx00));
+ }
+ return('Succeeded (bz2)');
+ break;
+
+ case 'gzip':
+ if (!check_extension('zlib') or !compress_file('zlib', $filename, $backupfilename, $stripx00)) {
+ return(backup_logfile('yes', $filename, $backupfilename, $stripx00));
+ }
+ return('Succeeded (gzip)');
+ break;
+
+ case 'no':
+ return('NO (disabled in config)');
+ break;
+
+ default:
+ if ($stripx00) {
+ if (compress_file('none', $filename, $backupfilename, $stripx00)) {
+ return('Succeeded (uncompressed)');
+ } else {
+ return('FAILED' . (!empty($php_errormsg) ? ': '. $php_errormsg : ''));
+ }
+ }
+ if (@copy($filename, $backupfilename)) {
+ return('Succeeded (uncompressed)');
+ } else {
+ return('FAILED' . (!empty($php_errormsg) ? ': '. $php_errormsg : ''));
+ }
+ }
+}
+
+function purge_backups($dir, $maxage) {
+ if (empty($maxage) or rand(0, 5) != 0) return(NULL);
+
+ // $maxage is days but we need seconds
+ $maxage = $maxage * 86400;
+ $deleted = 0;
+
+ $dh = opendir($dir);
+ while (false !== ($filename = readdir($dh))) {
+ if ($filename == '.htaccess' or $filename == 'index.htm') continue;
+ $cna = $dir .'/'. $filename;
+ if (@is_file($cna) and (@filemtime($cna) + $maxage) < time()) {
+ unlink($cna);
+ $deleted++;
+ }
+
+ }
+ closedir($dh);
+
+ return($deleted);
+}
+
+
+function file_size_info($filesize) {
+ $bytes = array('KB', 'KB', 'MB', 'GB', 'TB'); # values are always displayed
+ if ($filesize < 1024) $filesize = 1; # in at least kilobytes.
+ for ($i = 0; $filesize > 1024; $i++) $filesize /= 1024;
+ $file_size_info['size'] = ceil($filesize);
+ $file_size_info['type'] = $bytes[$i];
+ return $file_size_info;
+}
+
+function GetCurrentWatchlist() {
+ if (!isset($_COOKIE['uts_watchlist'])) return(array());
+ $watchlist = @explode(',', $_COOKIE['uts_watchlist']);
+ if (!$watchlist or !is_array($watchlist)) return(array());
+ foreach($watchlist as $key => $value) {
+ $watchlist[$key] = addslashes($value);
+ }
+ return($watchlist);
+}
+
+function PlayerOnWatchlist($pid) {
+ $watchlist = GetCurrentWatchlist();
+ return(in_array($pid, $watchlist));
+}
+
+function ToggleWatchStatus($pid) {
+ $watchlist = GetCurrentWatchlist();
+
+ if (in_array($pid, $watchlist)) {
+ $key = array_search($pid, $watchlist);
+ unset($watchlist[$key]);
+ $status = 0;
+ } else {
+ $watchlist[] = $pid;
+ $status = 1;
+ }
+ setcookie('uts_watchlist', implode(',',$watchlist), time()+60*60*24*30*365*5);
+ return($status);
+}
+
+function DeBugMessage($message) {
+ global $debug, $html;
+ if(!$debug) {
+ return;
+ }
+
+ if ($html) echo '<table class="box" border="0"><tr><td class="smheading" width="550">';
+ echo "Debugging Output:\n";
+ if ($html) echo '</td></tr><tr><td width="550" align="left"><pre>';
+ echo $message . "\n";
+ if ($html) echo '</pre></td></tr></table><br><br>';
+}
+
+?>
diff --git a/html/includes/functions_admin.php b/html/includes/functions_admin.php new file mode 100755 index 0000000..b4a788b --- /dev/null +++ b/html/includes/functions_admin.php @@ -0,0 +1,332 @@ +<?php
+
+/*
+$options['title'] = 'Test';
+//$options['requireconfirmation'] = false;
+
+
+$options['vars'][$i]['name'] = 'var_game';
+$options['vars'][$i]['type'] = 'game';
+$options['vars'][$i]['prompt'] = 'Choose game:';
+$options['vars'][$i]['caption'] = 'Game:';
+//$options['vars'][$i]['extraoption'] = 'extra';
+
+
+$options['vars'][$i]['name'] = 'var_srv';
+$options['vars'][$i]['type'] = 'server';
+$options['vars'][$i]['prompt'] = 'Choose server:';
+$options['vars'][$i]['caption'] = 'Server:';
+//$options['vars'][$i]['wheregid'] = 'var_game';
+
+
+$options['vars'][$i]['name'] = 'var_match';
+$options['vars'][$i]['type'] = 'match';
+$options['vars'][$i]['prompt'] = 'Choose Match:';
+$options['vars'][$i]['caption'] = 'Match:';
+//$options['vars'][$i]['whereserver'] = 'var_srv';
+//$options['vars'][$i]['wheregid'] = 'var_game';
+//$options['vars'][$i]['whereplayer'] = 'var_player';
+$options['vars'][$i]['exclude'] = 'var_match';
+
+
+$options['vars'][$i]['name'] = 'var_plr';
+$options['vars'][$i]['type'] = 'player';
+$options['vars'][$i]['prompt'] = 'Choose player';
+$options['vars'][$i]['caption'] = 'Player:';
+//$options['vars'][$i]['wherematch'] = 'var_match';
+//$options['vars'][$i]['whereserver'] = 'var_server';
+//$options['vars'][$i]['wheregid'] = 'var_game';
+
+
+$options['vars'][$i]['name'] = 'sure';
+$options['vars'][$i]['type'] = 'static';
+$options['vars'][$i]['options'] = 'No|Yes';
+$options['vars'][$i]['exitif'] = 'No';
+$options['vars'][$i]['prompt'] = 'Are you sure?';
+$options['vars'][$i]['caption'] = 'Sure:';
+
+
+$options['vars'][$i]['name'] = 'ip_from';
+$options['vars'][$i]['type'] = 'text';
+$options['vars'][$i]['prompt'] = 'Enter the IP you want to search from:';
+$options['vars'][$i]['caption'] = 'IP from:';
+$options['vars'][$i]['initialvalue'] = 'ip_from';
+
+*/
+
+
+function adminselect(&$options) {
+ $i = !empty($_REQUEST['step']) ? $_REQUEST['step'] : 0;
+ if (isset($_REQUEST['back'])) {
+ if (isset($_REQUEST['cur_var'])) unset($_REQUEST[$_REQUEST['cur_var']]);
+ $i -= 2;
+ }
+ if (isset($_REQUEST['noop'])) {
+ if (isset($_REQUEST['cur_var'])) unset($_REQUEST[$_REQUEST['cur_var']]);
+ $i -= 1;
+ }
+ if (!isset($_REQUEST['noop'])) {
+ if (isset($_REQUEST['playerfilter'])) unset($_REQUEST['playerfilter']);
+ }
+ $step = $i + 1;
+ $maxsteps = count($options['vars']);
+ if (!isset($options['requireconfirmation']) or $options['requireconfirmation']) $maxsteps++;
+ if (!isset($_REQUEST['values']) or empty($_REQUEST['values'])) {
+ $values = array();
+ } else {
+ $valtmp = explode(',', $_REQUEST['values']);
+ foreach($valtmp as $valtmp2) {
+ $valtmp3 = explode('=>', $valtmp2);
+ $values[$valtmp3[0]] = $valtmp3[1];
+ }
+ }
+ if (isset($_REQUEST['submit']) and isset($_REQUEST['cur_var'])) {
+ $values[$_REQUEST['cur_var']] = $_REQUEST[$_REQUEST['cur_var']];
+ unset($_REQUEST[$_REQUEST['cur_var']]);
+ if (isset($options['vars'][$i - 1]['exitif']) and $options['vars'][$i - 1]['exitif'] == $values[$_REQUEST['cur_var']]) $i = $maxsteps;
+ }
+ if ($i == $maxsteps) return($values);
+ echo '<table border="0" cellpadding="1" cellspacing="0" width="716">
+ <tbody>
+ <tr><td class="heading">'.htmlentities($options['title']).'</td></tr>
+ <tr><td class="smheading">Step '.$step.' of '.$maxsteps.'</td></tr>
+ </tbody></table><br>';
+ if ($step != $maxsteps and !isset($options['vars'][$i])) die("Something went wrong :(");
+
+ echo '<form action="'. $_SERVER['PHP_SELF'] .'" method="POST">';
+
+ echo '<table border="0" cellpadding="1" cellspacing="2" width="600">';
+ if ($step == $maxsteps) {
+ echo '<tr><td colspan="2" class="medheading">Please Confirm!</td></tr>';
+ }
+
+ foreach($options['vars'] as $num => $var) {
+ if ((!isset($values[$var['name']]) and $num != $i) or $num > $i) continue;
+ echo '<tr><td class="smheading" width="150">';
+
+ if ($num == $i or !isset($var['caption'])) {
+ echo htmlentities($var['prompt']);
+ } else {
+ echo htmlentities($var['caption']);
+ }
+
+ echo '</td>';
+
+ echo '<td class="grey" width="400">';
+ if ($num != $i) {
+ if (isset($var['extraoption']) and $values[$var['name']] == $var['extraoption']) {
+ echo htmlentities($values[$var['name']]);
+ } else {
+ switch($var['type']) {
+ case 'game':
+ $r_game = small_query("SELECT gamename, name FROM uts_games WHERE id = '". $values[$var['name']] ."'");
+ echo htmlentities($r_game['name']) .' ('. htmlentities($r_game['gamename']) .')';
+ break;
+ case 'server':
+ $r_server = small_query("SELECT servername, serverip FROM uts_match WHERE id = '". $values[$var['name']] ."'");
+ echo htmlentities($r_server['servername']) .' ('. $r_server['serverip'] .')';
+ break;
+ case 'player':
+ $r_player = small_query("SELECT name FROM uts_pinfo WHERE id = '". $values[$var['name']] ."'");
+ echo htmlentities($r_player['name']);
+ break;
+ case 'match':
+ $r_match = small_query("SELECT id, time, serverip, mapfile FROM uts_match WHERE id = '". $values[$var['name']] ."'");
+ echo htmlentities($r_match['id'].': '.mdate2($r_match['time']).' ('.un_ut($r_match['mapfile']).' on '.$r_match['serverip'].')');
+ break;
+ case 'static':
+ case 'text':
+ echo htmlentities($values[$var['name']]);
+ break;
+ default:
+ echo 'Show: Don\'tknow what to do with type '. $var['type'];
+ }
+ }
+ } else {
+ if (isset($var['initialvalue']) and isset($values[$var['initialvalue']])) $values[$var['name']] = $values[$var['initialvalue']];
+ echo '<input type="hidden" name="cur_var" value="'.$var['name'].'">';
+ switch($var['type']) {
+ case 'game':
+ echo '<select class="searchform" name="'. $var['name'] .'">';
+ if (isset($var['extraoption'])) {
+ if (isset($var['exclude']) and $var['extraoption'] == $values[$var['exclude']]) {
+ } else {
+ echo '<option value="'.$var['extraoption'].'">'.$var['extraoption'].'</option>';
+ }
+ }
+
+ $sql_game = "SELECT id, gamename, name FROM uts_games ORDER BY name ASC";
+ $q_game = mysql_query($sql_game) or die(mysql_error());
+ while ($r_game = mysql_fetch_array($q_game)) {
+ if (isset($var['exclude']) and $r_game['id'] == $values[$var['exclude']]) continue;
+ $selected = (isset($values[$var['name']]) and $r_game['id'] == $values[$var['name']]) ? 'selected' : '';
+ echo '<option '.$selected.' value="'.$r_game['id'].'">'. htmlentities($r_game['name'] .' ('. $r_game['gamename'] .')') .'</option>';
+ }
+ echo '</select>';
+ break;
+
+
+ case 'server':
+ echo '<select class="searchform" name="'. $var['name'] .'">';
+ if (isset($var['extraoption'])) {
+ if (isset($var['exclude']) and $var['extraoption'] == $values[$var['exclude']]) {
+ } else {
+ echo '<option value="'.$var['extraoption'].'">'.$var['extraoption'].'</option>';
+ }
+ }
+
+ $sql_server = "SELECT id, servername, serverip FROM uts_match GROUP BY servername, serverip ORDER BY servername ASC";
+ if (isset($var['wheregid'])) {
+ $sql_server = "SELECT id, servername, serverip FROM uts_match WHERE gid = '". $values[$var['wheregid']] ."' GROUP BY servername, serverip ORDER BY servername ASC";
+ }
+ $q_server = mysql_query($sql_server) or die(mysql_error());
+ while ($r_server = mysql_fetch_array($q_server)) {
+ if (isset($var['exclude']) and $r_server['id'] == $values[$var['exclude']]) continue;
+ $selected = (isset($values[$var['name']]) and $r_server['id'] == $values[$var['name']]) ? 'selected' : '';
+ echo '<option '.$selected.' value="'.$r_server['id'].'">'. htmlentities($r_server['servername'] .' ('. $r_server['serverip'] .')').'</option>';
+ }
+ echo '</select>';
+ break;
+
+ case 'player':
+ echo '<select class="searchform" name="'. $var['name'] .'">';
+ if (isset($var['extraoption'])) {
+ if (isset($var['exclude']) and $var['extraoption'] == $values[$var['exclude']]) {
+ } else {
+ echo '<option value="'.$var['extraoption'].'">'.$var['extraoption'].'</option>';
+ }
+ }
+
+ $where_extra = '';
+ if (isset($var['whereisbanned'])) {
+ $where_extra .= " AND pi.banned = '". $var['whereisbanned'] ."' ";
+ }
+ if (!empty($_REQUEST['playerfilter'])) {
+ $where_extra .= " AND pi.name LIKE '%". my_addslashes($_REQUEST['playerfilter']) ."%' ";
+ }
+
+ $sql_player = "SELECT pi.id, pi.name FROM uts_pinfo pi WHERE 1 $where_extra ORDER BY pi.name ASC";
+ if (isset($var['wherematch'])) {
+ $sql_player = "SELECT pi.id, pi.name FROM uts_player p, uts_pinfo pi WHERE p.pid = pi.id AND p.matchid = '". $values[$var['wherematch']] ."' $where_extra GROUP BY p.id ORDER BY pi.name ASC";
+ }
+ if (isset($var['whereserver'])) {
+ $r_server = small_query("SELECT servername, serverip FROM uts_match WHERE id = '". $values[$var['whereserver']] ."'");
+ $sql_player = "SELECT DISTINCT pi.id, pi.name FROM uts_match m, uts_player p, uts_pinfo pi WHERE m.serverip = '".$r_server['serverip']."' AND p.matchid = m.id AND p.pid = pi.id $where_extra GROUP BY p.id ORDER BY pi.name ASC";
+ }
+ if (isset($var['wheregid'])) {
+ $sql_player = "SELECT pi.id, pi.name FROM uts_player p, uts_pinfo pi WHERE p.pid = pi.id AND p.gid = '". $values[$var['wheregid']] ."' $where_extra GROUP BY p.id ORDER BY pi.name ASC";
+ }
+ $q_player = mysql_query($sql_player) or die(mysql_error());
+ while ($r_player = mysql_fetch_array($q_player)) {
+ if (isset($var['exclude']) and $r_player['id'] == $values[$var['exclude']]) continue;
+ $selected = (isset($values[$var['name']]) and $r_player['id'] == $values[$var['name']]) ? 'selected' : '';
+ echo '<option '.$selected.' value="'.$r_player['id'].'">'. htmlentities($r_player['name']) .'</option>';
+ }
+ echo '</select>';
+ echo ' ';
+ echo 'Filter: <input class="searchform" type="text" name="playerfilter" value="'. (empty($_REQUEST['playerfilter']) ? '' : $_REQUEST['playerfilter']) .'" size="6">';
+ echo ' <input class="searchform" type="Submit" name="noop" value="apply">';
+ break;
+
+ case 'match':
+ echo '<select class="searchform" name="'. $var['name'] .'">';
+ if (isset($var['extraoption'])) {
+ if (isset($var['exclude']) and $var['extraoption'] == $values[$var['exclude']]) {
+ } else {
+ echo '<option value="'.$var['extraoption'].'">'.$var['extraoption'].'</option>';
+ }
+ }
+
+ $sql_match = "SELECT id, time, serverip, mapfile FROM uts_match ORDER BY time DESC";
+ if (isset($var['whereserver'])) {
+ $r_server = small_query("SELECT servername, serverip FROM uts_match WHERE id = '". $values[$var['whereserver']] ."'");
+ $sql_match = "SELECT id, time, serverip, mapfile FROM uts_match WHERE serverip = '".$r_server['serverip']."' ORDER BY time DESC";
+ }
+ if (isset($var['wheregid'])) {
+ $sql_match = "SELECT id, time, serverip, mapfile FROM uts_match WHERE gid = '". $values[$var['wheregid']] ."' ORDER BY time DESC";
+ }
+ if (isset($var['whereplayer'])) {
+ $sql_match = "SELECT m.id AS id, m.time AS time, m.serverip AS serverip, m.mapfile AS mapfile FROM uts_match m, uts_player p WHERE pid = '". $values[$var['whereplayer']] ."' AND p.matchid = m.id ORDER BY time DESC";
+ }
+ $q_match = mysql_query($sql_match) or die(mysql_error());
+ while ($r_match = mysql_fetch_array($q_match)) {
+ if (isset($var['exclude']) and $r_match['id'] == $values[$var['exclude']]) continue;
+ $selected = (isset($values[$var['name']]) and $r_match['id'] == $values[$var['name']]) ? 'selected' : '';
+ echo '<option '.$selected.' value="'.$r_match['id'].'">'. htmlentities($r_match['id'].': '.mdate2($r_match['time']).' ('.un_ut($r_match['mapfile']).' on '.$r_match['serverip'].')').'</option>';
+ }
+ echo '</select>';
+ break;
+
+ case 'static':
+ echo '<select class="searchform" name="'. $var['name'] .'">';
+ if (isset($var['extraoption'])) {
+ if (isset($var['exclude']) and $var['extraoption'] == $values[$var['exclude']]) {
+ } else {
+ echo '<option value="'.$var['extraoption'].'">'.$var['extraoption'].'</option>';
+ }
+ }
+
+ $sopts = explode('|', $var['options']);
+ foreach($sopts as $sval) {
+ $selected = (isset($values[$var['name']]) and $sval == $values[$var['name']]) ? 'selected' : '';
+ echo '<option '.$selected.' value="'.$sval.'">'. htmlentities($sval) .'</option>';
+ }
+ echo '</select>';
+ break;
+
+ case 'text':
+ $pval = (isset($values[$var['name']])) ? $values[$var['name']] : '';
+ echo '<input type="text" class="searchform" name="'. $var['name'] .'" value="'. $pval .'">';
+ break;
+
+
+ default:
+ echo 'Select: Don\'tknow what to do with type '. $var['type'];
+ }
+ }
+ echo '</td></tr>';
+ }
+
+ $valstr = '';
+ foreach($values as $key => $value) {
+ if (empty($key)) continue;
+ if (!empty($valstr)) $valstr .= ',';
+ $valstr .= "$key=>$value";
+ }
+
+
+ $_REQUEST['step'] = '';
+ $_REQUEST['values'] = '';
+ foreach($_REQUEST as $key => $value) {
+ if (isset($_COOKIE[$key])) continue;
+ switch($key){
+ case 'step':
+ $value = $step; break;
+ case 'values':
+ $value = $valstr; break;
+ case 'submit':
+ case 'back':
+ case 'cur_var':
+ case 'playerfilter':
+ case 'noop':
+ continue 2;
+ }
+ echo '<input type="hidden" name="'.$key.'" value="'.$value.'">';
+ }
+
+ echo '<tr><td>';
+ if ($step != 1) echo '<input class="searchformb" type="submit" name="back" value="<< Back">';
+ echo '</td>';
+ $caption = ($step == $maxsteps) ? 'Finish' : 'Next >>';
+ echo '<td align="right"><input class="searchformb" type="submit" name="submit" value="'.$caption.'"></td></tr>';
+
+ echo '</table>';
+
+
+ echo '</form>';
+ require('includes/footer.php');
+ exit;
+}
+
+
+?>
\ No newline at end of file diff --git a/html/includes/geoip.inc b/html/includes/geoip.inc new file mode 100755 index 0000000..a095469 --- /dev/null +++ b/html/includes/geoip.inc @@ -0,0 +1,498 @@ +<?php + +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */ +/* geoip.inc + * + * Copyright (C) 2007 MaxMind LLC + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +define("GEOIP_COUNTRY_BEGIN", 16776960); +define("GEOIP_STATE_BEGIN_REV0", 16700000); +define("GEOIP_STATE_BEGIN_REV1", 16000000); +define("GEOIP_STANDARD", 0); +define("GEOIP_MEMORY_CACHE", 1); +define("GEOIP_SHARED_MEMORY", 2); +define("STRUCTURE_INFO_MAX_SIZE", 20); +define("DATABASE_INFO_MAX_SIZE", 100); +define("GEOIP_COUNTRY_EDITION", 106); +define("GEOIP_PROXY_EDITION", 8); +define("GEOIP_ASNUM_EDITION", 9); +define("GEOIP_NETSPEED_EDITION", 10); +define("GEOIP_REGION_EDITION_REV0", 112); +define("GEOIP_REGION_EDITION_REV1", 3); +define("GEOIP_CITY_EDITION_REV0", 111); +define("GEOIP_CITY_EDITION_REV1", 2); +define("GEOIP_ORG_EDITION", 110); +define("GEOIP_ISP_EDITION", 4); +define("SEGMENT_RECORD_LENGTH", 3); +define("STANDARD_RECORD_LENGTH", 3); +define("ORG_RECORD_LENGTH", 4); +define("MAX_RECORD_LENGTH", 4); +define("MAX_ORG_RECORD_LENGTH", 300); +define("GEOIP_SHM_KEY", 0x4f415401); +define("US_OFFSET", 1); +define("CANADA_OFFSET", 677); +define("WORLD_OFFSET", 1353); +define("FIPS_RANGE", 360); +define("GEOIP_UNKNOWN_SPEED", 0); +define("GEOIP_DIALUP_SPEED", 1); +define("GEOIP_CABLEDSL_SPEED", 2); +define("GEOIP_CORPORATE_SPEED", 3); + +class GeoIP { + var $flags; + var $filehandle; + var $memory_buffer; + var $databaseType; + var $databaseSegments; + var $record_length; + var $shmid; + var $GEOIP_COUNTRY_CODE_TO_NUMBER = array( +"" => 0, "AP" => 1, "EU" => 2, "AD" => 3, "AE" => 4, "AF" => 5, +"AG" => 6, "AI" => 7, "AL" => 8, "AM" => 9, "AN" => 10, "AO" => 11, +"AQ" => 12, "AR" => 13, "AS" => 14, "AT" => 15, "AU" => 16, "AW" => 17, +"AZ" => 18, "BA" => 19, "BB" => 20, "BD" => 21, "BE" => 22, "BF" => 23, +"BG" => 24, "BH" => 25, "BI" => 26, "BJ" => 27, "BM" => 28, "BN" => 29, +"BO" => 30, "BR" => 31, "BS" => 32, "BT" => 33, "BV" => 34, "BW" => 35, +"BY" => 36, "BZ" => 37, "CA" => 38, "CC" => 39, "CD" => 40, "CF" => 41, +"CG" => 42, "CH" => 43, "CI" => 44, "CK" => 45, "CL" => 46, "CM" => 47, +"CN" => 48, "CO" => 49, "CR" => 50, "CU" => 51, "CV" => 52, "CX" => 53, +"CY" => 54, "CZ" => 55, "DE" => 56, "DJ" => 57, "DK" => 58, "DM" => 59, +"DO" => 60, "DZ" => 61, "EC" => 62, "EE" => 63, "EG" => 64, "EH" => 65, +"ER" => 66, "ES" => 67, "ET" => 68, "FI" => 69, "FJ" => 70, "FK" => 71, +"FM" => 72, "FO" => 73, "FR" => 74, "FX" => 75, "GA" => 76, "GB" => 77, +"GD" => 78, "GE" => 79, "GF" => 80, "GH" => 81, "GI" => 82, "GL" => 83, +"GM" => 84, "GN" => 85, "GP" => 86, "GQ" => 87, "GR" => 88, "GS" => 89, +"GT" => 90, "GU" => 91, "GW" => 92, "GY" => 93, "HK" => 94, "HM" => 95, +"HN" => 96, "HR" => 97, "HT" => 98, "HU" => 99, "ID" => 100, "IE" => 101, +"IL" => 102, "IN" => 103, "IO" => 104, "IQ" => 105, "IR" => 106, "IS" => 107, +"IT" => 108, "JM" => 109, "JO" => 110, "JP" => 111, "KE" => 112, "KG" => 113, +"KH" => 114, "KI" => 115, "KM" => 116, "KN" => 117, "KP" => 118, "KR" => 119, +"KW" => 120, "KY" => 121, "KZ" => 122, "LA" => 123, "LB" => 124, "LC" => 125, +"LI" => 126, "LK" => 127, "LR" => 128, "LS" => 129, "LT" => 130, "LU" => 131, +"LV" => 132, "LY" => 133, "MA" => 134, "MC" => 135, "MD" => 136, "MG" => 137, +"MH" => 138, "MK" => 139, "ML" => 140, "MM" => 141, "MN" => 142, "MO" => 143, +"MP" => 144, "MQ" => 145, "MR" => 146, "MS" => 147, "MT" => 148, "MU" => 149, +"MV" => 150, "MW" => 151, "MX" => 152, "MY" => 153, "MZ" => 154, "NA" => 155, +"NC" => 156, "NE" => 157, "NF" => 158, "NG" => 159, "NI" => 160, "NL" => 161, +"NO" => 162, "NP" => 163, "NR" => 164, "NU" => 165, "NZ" => 166, "OM" => 167, +"PA" => 168, "PE" => 169, "PF" => 170, "PG" => 171, "PH" => 172, "PK" => 173, +"PL" => 174, "PM" => 175, "PN" => 176, "PR" => 177, "PS" => 178, "PT" => 179, +"PW" => 180, "PY" => 181, "QA" => 182, "RE" => 183, "RO" => 184, "RU" => 185, +"RW" => 186, "SA" => 187, "SB" => 188, "SC" => 189, "SD" => 190, "SE" => 191, +"SG" => 192, "SH" => 193, "SI" => 194, "SJ" => 195, "SK" => 196, "SL" => 197, +"SM" => 198, "SN" => 199, "SO" => 200, "SR" => 201, "ST" => 202, "SV" => 203, +"SY" => 204, "SZ" => 205, "TC" => 206, "TD" => 207, "TF" => 208, "TG" => 209, +"TH" => 210, "TJ" => 211, "TK" => 212, "TM" => 213, "TN" => 214, "TO" => 215, +"TL" => 216, "TR" => 217, "TT" => 218, "TV" => 219, "TW" => 220, "TZ" => 221, +"UA" => 222, "UG" => 223, "UM" => 224, "US" => 225, "UY" => 226, "UZ" => 227, +"VA" => 228, "VC" => 229, "VE" => 230, "VG" => 231, "VI" => 232, "VN" => 233, +"VU" => 234, "WF" => 235, "WS" => 236, "YE" => 237, "YT" => 238, "RS" => 239, +"ZA" => 240, "ZM" => 241, "ME" => 242, "ZW" => 243, "A1" => 244, "A2" => 245, +"O1" => 246, "AX" => 247, "GG" => 248, "IM" => 249, "JE" => 250 +); + var $GEOIP_COUNTRY_CODES = array( +"", "AP", "EU", "AD", "AE", "AF", "AG", "AI", "AL", "AM", "AN", "AO", "AQ", +"AR", "AS", "AT", "AU", "AW", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", +"BI", "BJ", "BM", "BN", "BO", "BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA", +"CC", "CD", "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CU", +"CV", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", +"EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "FX", "GA", "GB", +"GD", "GE", "GF", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", +"GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "ID", "IE", "IL", "IN", +"IO", "IQ", "IR", "IS", "IT", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", +"KN", "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", +"LT", "LU", "LV", "LY", "MA", "MC", "MD", "MG", "MH", "MK", "ML", "MM", "MN", +"MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", +"NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", +"PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW", "PY", +"QA", "RE", "RO", "RU", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", +"SJ", "SK", "SL", "SM", "SN", "SO", "SR", "ST", "SV", "SY", "SZ", "TC", "TD", +"TF", "TG", "TH", "TJ", "TK", "TM", "TN", "TO", "TL", "TR", "TT", "TV", "TW", +"TZ", "UA", "UG", "UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", +"VU", "WF", "WS", "YE", "YT", "RS", "ZA", "ZM", "ME", "ZW", "A1", "A2", "O1", +"AX", "GG", "IM", "JE" +); + var $GEOIP_COUNTRY_CODES3 = array( +"","AP","EU","AND","ARE","AFG","ATG","AIA","ALB","ARM","ANT","AGO","AQ","ARG", +"ASM","AUT","AUS","ABW","AZE","BIH","BRB","BGD","BEL","BFA","BGR","BHR","BDI", +"BEN","BMU","BRN","BOL","BRA","BHS","BTN","BV","BWA","BLR","BLZ","CAN","CC", +"COD","CAF","COG","CHE","CIV","COK","CHL","CMR","CHN","COL","CRI","CUB","CPV", +"CX","CYP","CZE","DEU","DJI","DNK","DMA","DOM","DZA","ECU","EST","EGY","ESH", +"ERI","ESP","ETH","FIN","FJI","FLK","FSM","FRO","FRA","FX","GAB","GBR","GRD", +"GEO","GUF","GHA","GIB","GRL","GMB","GIN","GLP","GNQ","GRC","GS","GTM","GUM", +"GNB","GUY","HKG","HM","HND","HRV","HTI","HUN","IDN","IRL","ISR","IND","IO", +"IRQ","IRN","ISL","ITA","JAM","JOR","JPN","KEN","KGZ","KHM","KIR","COM","KNA", +"PRK","KOR","KWT","CYM","KAZ","LAO","LBN","LCA","LIE","LKA","LBR","LSO","LTU", +"LUX","LVA","LBY","MAR","MCO","MDA","MDG","MHL","MKD","MLI","MMR","MNG","MAC", +"MNP","MTQ","MRT","MSR","MLT","MUS","MDV","MWI","MEX","MYS","MOZ","NAM","NCL", +"NER","NFK","NGA","NIC","NLD","NOR","NPL","NRU","NIU","NZL","OMN","PAN","PER", +"PYF","PNG","PHL","PAK","POL","SPM","PCN","PRI","PSE","PRT","PLW","PRY","QAT", +"REU","ROU","RUS","RWA","SAU","SLB","SYC","SDN","SWE","SGP","SHN","SVN","SJM", +"SVK","SLE","SMR","SEN","SOM","SUR","STP","SLV","SYR","SWZ","TCA","TCD","TF", +"TGO","THA","TJK","TKL","TLS","TKM","TUN","TON","TUR","TTO","TUV","TWN","TZA", +"UKR","UGA","UM","USA","URY","UZB","VAT","VCT","VEN","VGB","VIR","VNM","VUT", +"WLF","WSM","YEM","YT","SRB","ZAF","ZMB","MNE","ZWE","A1","A2","O1", +"ALA","GGY","IMN","JEY" + ); + var $GEOIP_COUNTRY_NAMES = array( +"", "Asia/Pacific Region", "Europe", "Andorra", "United Arab Emirates", +"Afghanistan", "Antigua and Barbuda", "Anguilla", "Albania", "Armenia", +"Netherlands Antilles", "Angola", "Antarctica", "Argentina", "American Samoa", +"Austria", "Australia", "Aruba", "Azerbaijan", "Bosnia and Herzegovina", +"Barbados", "Bangladesh", "Belgium", "Burkina Faso", "Bulgaria", "Bahrain", +"Burundi", "Benin", "Bermuda", "Brunei Darussalam", "Bolivia", "Brazil", +"Bahamas", "Bhutan", "Bouvet Island", "Botswana", "Belarus", "Belize", +"Canada", "Cocos (Keeling) Islands", "Congo, The Democratic Republic of the", +"Central African Republic", "Congo", "Switzerland", "Cote D'Ivoire", "Cook +Islands", "Chile", "Cameroon", "China", "Colombia", "Costa Rica", "Cuba", "Cape +Verde", "Christmas Island", "Cyprus", "Czech Republic", "Germany", "Djibouti", +"Denmark", "Dominica", "Dominican Republic", "Algeria", "Ecuador", "Estonia", +"Egypt", "Western Sahara", "Eritrea", "Spain", "Ethiopia", "Finland", "Fiji", +"Falkland Islands (Malvinas)", "Micronesia, Federated States of", "Faroe +Islands", "France", "France, Metropolitan", "Gabon", "United Kingdom", +"Grenada", "Georgia", "French Guiana", "Ghana", "Gibraltar", "Greenland", +"Gambia", "Guinea", "Guadeloupe", "Equatorial Guinea", "Greece", "South Georgia +and the South Sandwich Islands", "Guatemala", "Guam", "Guinea-Bissau", +"Guyana", "Hong Kong", "Heard Island and McDonald Islands", "Honduras", +"Croatia", "Haiti", "Hungary", "Indonesia", "Ireland", "Israel", "India", +"British Indian Ocean Territory", "Iraq", "Iran, Islamic Republic of", +"Iceland", "Italy", "Jamaica", "Jordan", "Japan", "Kenya", "Kyrgyzstan", +"Cambodia", "Kiribati", "Comoros", "Saint Kitts and Nevis", "Korea, Democratic +People's Republic of", "Korea, Republic of", "Kuwait", "Cayman Islands", +"Kazakstan", "Lao People's Democratic Republic", "Lebanon", "Saint Lucia", +"Liechtenstein", "Sri Lanka", "Liberia", "Lesotho", "Lithuania", "Luxembourg", +"Latvia", "Libyan Arab Jamahiriya", "Morocco", "Monaco", "Moldova, Republic +of", "Madagascar", "Marshall Islands", "Macedonia", +"Mali", "Myanmar", "Mongolia", "Macau", "Northern Mariana Islands", +"Martinique", "Mauritania", "Montserrat", "Malta", "Mauritius", "Maldives", +"Malawi", "Mexico", "Malaysia", "Mozambique", "Namibia", "New Caledonia", +"Niger", "Norfolk Island", "Nigeria", "Nicaragua", "Netherlands", "Norway", +"Nepal", "Nauru", "Niue", "New Zealand", "Oman", "Panama", "Peru", "French +Polynesia", "Papua New Guinea", "Philippines", "Pakistan", "Poland", "Saint +Pierre and Miquelon", "Pitcairn Islands", "Puerto Rico", "Palestinian Territory", +"Portugal", "Palau", "Paraguay", "Qatar", "Reunion", "Romania", +"Russian Federation", "Rwanda", "Saudi Arabia", "Solomon Islands", +"Seychelles", "Sudan", "Sweden", "Singapore", "Saint Helena", "Slovenia", +"Svalbard and Jan Mayen", "Slovakia", "Sierra Leone", "San Marino", "Senegal", +"Somalia", "Suriname", "Sao Tome and Principe", "El Salvador", "Syrian Arab +Republic", "Swaziland", "Turks and Caicos Islands", "Chad", "French Southern +Territories", "Togo", "Thailand", "Tajikistan", "Tokelau", "Turkmenistan", +"Tunisia", "Tonga", "Timor-Leste", "Turkey", "Trinidad and Tobago", "Tuvalu", +"Taiwan", "Tanzania, United Republic of", "Ukraine", +"Uganda", "United States Minor Outlying Islands", "United States", "Uruguay", +"Uzbekistan", "Holy See (Vatican City State)", "Saint Vincent and the +Grenadines", "Venezuela", "Virgin Islands, British", "Virgin Islands, U.S.", +"Vietnam", "Vanuatu", "Wallis and Futuna", "Samoa", "Yemen", "Mayotte", +"Serbia", "South Africa", "Zambia", "Montenegro", "Zimbabwe", +"Anonymous Proxy","Satellite Provider","Other", +"Aland Islands","Guernsey","Isle of Man","Jersey" +); +} +function geoip_load_shared_mem ($file) { + + $fp = fopen($file, "rb"); + if (!$fp) { + print "error opening $file: $php_errormsg\n"; + exit; + } + $s_array = fstat($fp); + $size = $s_array['size']; + if ($shmid = @shmop_open (GEOIP_SHM_KEY, "w", 0, 0)) { + shmop_delete ($shmid); + shmop_close ($shmid); + } + $shmid = shmop_open (GEOIP_SHM_KEY, "c", 0644, $size); + shmop_write ($shmid, fread($fp, $size), 0); + shmop_close ($shmid); +} + +function _setup_segments($gi){ + $gi->databaseType = GEOIP_COUNTRY_EDITION; + $gi->record_length = STANDARD_RECORD_LENGTH; + if ($gi->flags & GEOIP_SHARED_MEMORY) { + $offset = @shmop_size ($gi->shmid) - 3; + for ($i = 0; $i < STRUCTURE_INFO_MAX_SIZE; $i++) { + $delim = @shmop_read ($gi->shmid, $offset, 3); + $offset += 3; + if ($delim == (chr(255).chr(255).chr(255))) { + $gi->databaseType = ord(@shmop_read ($gi->shmid, $offset, 1)); + $offset++; + + if ($gi->databaseType == GEOIP_REGION_EDITION_REV0){ + $gi->databaseSegments = GEOIP_STATE_BEGIN_REV0; + } else if ($gi->databaseType == GEOIP_REGION_EDITION_REV1){ + $gi->databaseSegments = GEOIP_STATE_BEGIN_REV1; + } else if (($gi->databaseType == GEOIP_CITY_EDITION_REV0)|| + ($gi->databaseType == GEOIP_CITY_EDITION_REV1) + || ($gi->databaseType == GEOIP_ORG_EDITION) + || ($gi->databaseType == GEOIP_ISP_EDITION) + || ($gi->databaseType == GEOIP_ASNUM_EDITION)){ + $gi->databaseSegments = 0; + $buf = @shmop_read ($gi->shmid, $offset, SEGMENT_RECORD_LENGTH); + for ($j = 0;$j < SEGMENT_RECORD_LENGTH;$j++){ + $gi->databaseSegments += (ord($buf[$j]) << ($j * 8)); + } + if (($gi->databaseType == GEOIP_ORG_EDITION)|| + ($gi->databaseType == GEOIP_ISP_EDITION)) { + $gi->record_length = ORG_RECORD_LENGTH; + } + } + break; + } else { + $offset -= 4; + } + } + if (($gi->databaseType == GEOIP_COUNTRY_EDITION)|| + ($gi->databaseType == GEOIP_PROXY_EDITION)|| + ($gi->databaseType == GEOIP_NETSPEED_EDITION)){ + $gi->databaseSegments = GEOIP_COUNTRY_BEGIN; + } + } else { + $filepos = ftell($gi->filehandle); + fseek($gi->filehandle, -3, SEEK_END); + for ($i = 0; $i < STRUCTURE_INFO_MAX_SIZE; $i++) { + $delim = fread($gi->filehandle,3); + if ($delim == (chr(255).chr(255).chr(255))){ + $gi->databaseType = ord(fread($gi->filehandle,1)); + if ($gi->databaseType == GEOIP_REGION_EDITION_REV0){ + $gi->databaseSegments = GEOIP_STATE_BEGIN_REV0; + } + else if ($gi->databaseType == GEOIP_REGION_EDITION_REV1){ + $gi->databaseSegments = GEOIP_STATE_BEGIN_REV1; + } else if (($gi->databaseType == GEOIP_CITY_EDITION_REV0) || + ($gi->databaseType == GEOIP_CITY_EDITION_REV1) || + ($gi->databaseType == GEOIP_ORG_EDITION) || + ($gi->databaseType == GEOIP_ISP_EDITION) || + ($gi->databaseType == GEOIP_ASNUM_EDITION)){ + $gi->databaseSegments = 0; + $buf = fread($gi->filehandle,SEGMENT_RECORD_LENGTH); + for ($j = 0;$j < SEGMENT_RECORD_LENGTH;$j++){ + $gi->databaseSegments += (ord($buf[$j]) << ($j * 8)); + } + if ($gi->databaseType == GEOIP_ORG_EDITION || + $gi->databaseType == GEOIP_ISP_EDITION) { + $gi->record_length = ORG_RECORD_LENGTH; + } + } + break; + } else { + fseek($gi->filehandle, -4, SEEK_CUR); + } + } + if (($gi->databaseType == GEOIP_COUNTRY_EDITION)|| + ($gi->databaseType == GEOIP_PROXY_EDITION)|| + ($gi->databaseType == GEOIP_NETSPEED_EDITION)){ + $gi->databaseSegments = GEOIP_COUNTRY_BEGIN; + } + fseek($gi->filehandle,$filepos,SEEK_SET); + } + return $gi; +} + +function geoip_open($filename, $flags) { + $gi = new GeoIP; + $gi->flags = $flags; + if ($gi->flags & GEOIP_SHARED_MEMORY) { + $gi->shmid = @shmop_open (GEOIP_SHM_KEY, "a", 0, 0); + } else { + $gi->filehandle = fopen($filename,"rb"); + if ($gi->flags & GEOIP_MEMORY_CACHE) { + $s_array = fstat($gi->filehandle); + $gi->memory_buffer = fread($gi->filehandle, $s_array['size']); + } + } + + $gi = _setup_segments($gi); + return $gi; +} + +function geoip_close($gi) { + if ($gi->flags & GEOIP_SHARED_MEMORY) { + return true; + } + + return fclose($gi->filehandle); +} + +function geoip_country_id_by_name($gi, $name) { + $addr = gethostbyname($name); + if (!$addr || $addr == $name) { + return false; + } + return geoip_country_id_by_addr($gi, $addr); +} + +function geoip_country_code_by_name($gi, $name) { + $country_id = geoip_country_id_by_name($gi,$name); + if ($country_id !== false) { + return $gi->GEOIP_COUNTRY_CODES[$country_id]; + } + return false; +} + +function geoip_country_name_by_name($gi, $name) { + $country_id = geoip_country_id_by_name($gi,$name); + if ($country_id !== false) { + return $gi->GEOIP_COUNTRY_NAMES[$country_id]; + } + return false; +} + +function geoip_country_id_by_addr($gi, $addr) { + $ipnum = ip2long($addr); + return _geoip_seek_country($gi, $ipnum) - GEOIP_COUNTRY_BEGIN; +} + +function geoip_country_code_by_addr($gi, $addr) { + if ($gi->databaseType == GEOIP_CITY_EDITION_REV1) { + $record = geoip_record_by_addr($gi,$addr); + return $record->country_code; + } else { + $country_id = geoip_country_id_by_addr($gi,$addr); + if ($country_id !== false) { + return $gi->GEOIP_COUNTRY_CODES[$country_id]; + } + } + return false; +} + +function geoip_country_name_by_addr($gi, $addr) { + if ($gi->databaseType == GEOIP_CITY_EDITION_REV1) { + $record = geoip_record_by_addr($gi,$addr); + return $record->country_name; + } else { + $country_id = geoip_country_id_by_addr($gi,$addr); + if ($country_id !== false) { + return $gi->GEOIP_COUNTRY_NAMES[$country_id]; + } + } + return false; +} + +function _geoip_seek_country($gi, $ipnum) { + $offset = 0; + for ($depth = 31; $depth >= 0; --$depth) { + if ($gi->flags & GEOIP_MEMORY_CACHE) { + $buf = substr($gi->memory_buffer, + 2 * $gi->record_length * $offset, + 2 * $gi->record_length); + } elseif ($gi->flags & GEOIP_SHARED_MEMORY) { + $buf = @shmop_read ($gi->shmid, + 2 * $gi->record_length * $offset, + 2 * $gi->record_length ); + } else { + fseek($gi->filehandle, 2 * $gi->record_length * $offset, SEEK_SET) == 0 + or die("fseek failed"); + $buf = fread($gi->filehandle, 2 * $gi->record_length); + } + $x = array(0,0); + for ($i = 0; $i < 2; ++$i) { + for ($j = 0; $j < $gi->record_length; ++$j) { + $x[$i] += ord($buf[$gi->record_length * $i + $j]) << ($j * 8); + } + } + if ($ipnum & (1 << $depth)) { + if ($x[1] >= $gi->databaseSegments) { + return $x[1]; + } + $offset = $x[1]; + } else { + if ($x[0] >= $gi->databaseSegments) { + return $x[0]; + } + $offset = $x[0]; + } + } + trigger_error("error traversing database - perhaps it is corrupt?", E_USER_ERROR); + return false; +} + +function _get_org($gi,$ipnum){ + $seek_org = _geoip_seek_country($gi,$ipnum); + if ($seek_org == $gi->databaseSegments) { + return NULL; + } + $record_pointer = $seek_org + (2 * $gi->record_length - 1) * $gi->databaseSegments; + if ($gi->flags & GEOIP_SHARED_MEMORY) { + $org_buf = @shmop_read ($gi->shmid, $record_pointer, MAX_ORG_RECORD_LENGTH); + } else { + fseek($gi->filehandle, $record_pointer, SEEK_SET); + $org_buf = fread($gi->filehandle,MAX_ORG_RECORD_LENGTH); + } + $org_buf = substr($org_buf, 0, strpos($org_buf, 0)); + return $org_buf; +} + +function geoip_org_by_addr ($gi,$addr) { + if ($addr == NULL) { + return 0; + } + $ipnum = ip2long($addr); + return _get_org($gi, $ipnum); +} + +function _get_region($gi,$ipnum){ + if ($gi->databaseType == GEOIP_REGION_EDITION_REV0){ + $seek_region = _geoip_seek_country($gi,$ipnum) - GEOIP_STATE_BEGIN_REV0; + if ($seek_region >= 1000){ + $country_code = "US"; + $region = chr(($seek_region - 1000)/26 + 65) . chr(($seek_region - 1000)%26 + 65); + } else { + $country_code = $gi->GEOIP_COUNTRY_CODES[$seek_region]; + $region = ""; + } + return array ($country_code,$region); + } else if ($gi->databaseType == GEOIP_REGION_EDITION_REV1) { + $seek_region = _geoip_seek_country($gi,$ipnum) - GEOIP_STATE_BEGIN_REV1; + //print $seek_region; + if ($seek_region < US_OFFSET){ + $country_code = ""; + $region = ""; + } else if ($seek_region < CANADA_OFFSET) { + $country_code = "US"; + $region = chr(($seek_region - US_OFFSET)/26 + 65) . chr(($seek_region - US_OFFSET)%26 + 65); + } else if ($seek_region < WORLD_OFFSET) { + $country_code = "CA"; + $region = chr(($seek_region - CANADA_OFFSET)/26 + 65) . chr(($seek_region - CANADA_OFFSET)%26 + 65); + } else { + $country_code = $gi->GEOIP_COUNTRY_CODES[($seek_region - WORLD_OFFSET) / FIPS_RANGE]; + $region = ""; + } + return array ($country_code,$region); + } +} + +function geoip_region_by_addr ($gi,$addr) { + if ($addr == NULL) { + return 0; + } + $ipnum = ip2long($addr); + return _get_region($gi, $ipnum); +} + +function getdnsattributes ($l,$ip){ + $r = new Net_DNS_Resolver(); + $r->nameservers = array("ws1.maxmind.com"); + $p = $r->search($l."." . $ip .".s.maxmind.com","TXT","IN"); + $str = is_object($p->answer[0])?$p->answer[0]->string():''; + ereg("\"(.*)\"",$str,$regs); + $str = $regs[1]; + return $str; +} + +?> diff --git a/html/includes/header.php b/html/includes/header.php new file mode 100755 index 0000000..e84a63e --- /dev/null +++ b/html/includes/header.php @@ -0,0 +1,66 @@ +<?php
+// Start buffering
+ob_start();
+
+// Date in the past
+header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
+
+// always modified
+header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
+
+// HTTP/1.1
+header("Cache-Control: no-store, no-cache, must-revalidate");
+header("Cache-Control: post-check=0, pre-check=0", false);
+
+// HTTP/1.0
+header("Pragma: no-cache");
+
+if (isset($_COOKIE['uts_lastvisit'])) {
+ if (isset($_COOKIE['utss_lastvisit'])) {
+ $s_lastvisit = $_COOKIE['utss_lastvisit'];
+ } else {
+ setcookie('utss_lastvisit', $_COOKIE['uts_lastvisit'], 0);
+ $s_lastvisit = $_COOKIE['uts_lastvisit'];
+ }
+} else {
+ $s_lastvisit = time();
+}
+setcookie('uts_lastvisit', time(), time()+60*60*24*30*365);
+
+
+echo'
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+ <title>Unreal Tournament Stats - Powered by UTStats</title>
+ <meta http-equiv="Content-Type" content="text/html; CHARSET=iso-8859-1">
+ <link rel="icon" href="images/favicon.ico" type="image/ico">
+ <link rel="stylesheet" href="style.css">
+ <script type="text/javascript">
+ <!--
+ var ol_fgclass="dark"; var ol_bgclass="darkbox"; var ol_textfontclass="dark"; var ol_captionfontclass="hlheading";
+ -->
+ </script>
+ <script type="text/javascript" src="includes/overlib_mini.js"><!-- overLIB (c) Erik Bosrup --></script>
+</head>
+<body>
+
+<table border="0" cellpadding="0" cellspacing="0">
+<tbody>
+<tr>
+';
+
+include("includes/sidebar.php");
+
+
+echo'
+<table align="center" border="0" cellpadding="0" cellspacing="0">
+ <tbody><tr>
+ <td align="center" width="720">
+ <img src="images/statslogo.gif" title="UTStats Logo" alt="UTStats Logo" border="0">
+ </td>
+ </tr>
+</tbody></table>
+<center>
+<br>
+';
\ No newline at end of file diff --git a/html/includes/hints.php b/html/includes/hints.php new file mode 100755 index 0000000..b8da8de --- /dev/null +++ b/html/includes/hints.php @@ -0,0 +1,81 @@ +<?php +$hint['F'] = array ( "caption" => "Frags", + "text" => "A player's frag count is equal to their kills minus suicides. In team games team kills (not team suicides) are also subtracted from the player's kills." + ); + +$hint['K'] = array ( "caption" => "Kills", + "text" => "Number of times a player kills another player.<br>Note: UTStats only tracks human vs. human kills. Bot kills and other bot related events are <em>not</em> tracked." + ); + +$hint['D'] = array ( "caption" => "Deaths", + "text" => "Number of times a player gets killed by another player.<br>- This does not include environment induced deaths, like trap doors. These and self kills are counted separately, as suicides.<br>- Team based deaths are counted as team deaths." + ); + +$hint['S'] = array ( "caption" => "Suicides", + "text" => "Number of times a player dies due to action of their own cause. Suicides can be environment induced (drowning, getting crushed, falling) or weapon related (fatal splash damage from their own weapon)." + ); + +$hint['TK'] = array ( "caption" => "Team Kills", + "text" => "Number of times a player in a team based game kills someone on their own team.<br>Note: Team kills subtract from a player's personal frags and thus the team frags as a whole." + ); + +$hint['Multis'] = + array ( "caption" => "Multi Kills", + "text" => "Special event: If you manage to kill more 2 than people within a short space of time you get a Double Kill, 3 is a Multi Kill etc" + ); + +$hint['Sprees'] = + array ( "caption" => "Killing Sprees", + "text" => "Special event: If you manage to kill 5 or more opponents without dying yourself, you will be on a killing spree. If you kill more than 10 opponents, you are on a rampage, etc." + ); + +$hint['EFF'] = array ( "caption" => "Efficiency", + "text" => "A ratio that denotes the player's kill skill by comparing it with his overall performance. A perfect efficiency is equal to 1 (100%), anything less than 0.5 (50%) is below average.<br>Formula: Kills / (Kills + Deaths + Suicides [+Team Kills])" + ); + +$hint['ACC'] = array ( "caption" => "Accuracy", + "text" => "Overall accuracy when using all weapons. Most accurate in insta but also very accurate in normal weapons." + ); + +$hint['TTL'] = array ( "caption" => "Time to Live", + "text" => "The length of time a player is in a game in seconds divided by how many times he/she dies, thus giving an average time of how long he/she will live." + ); + +$hint['DK'] = array ( "caption" => "Double Kill", + "text" => "Killed <strong>2</strong> people in a short space of time without dying himself/herself" + ); + +$hint['MK'] = array ( "caption" => "Multi Kill", + "text" => "Killed <strong>3</strong> people in a short space of time without dying himself/herself" + ); + +$hint['UK'] = array ( "caption" => "Ultra Kill", + "text" => "Killed <strong>4</strong> people in a short space of time without dying himself/herself" + ); + +$hint['MOK'] = array ( "caption" => "Monster Kill", + "text" => "Killed <strong>5</strong> people in a short space of time without dying himself/herself" + ); + + +$hint['KS'] = array ( "caption" => "Killing Spree", + "text" => "Killed <strong>5</strong> people in a row without dying himself/herself" + ); + +$hint['RA'] = array ( "caption" => "Rampage", + "text" => "Killed <strong>10</strong> people in a row without dying himself/herself" + ); + +$hint['DO'] = array ( "caption" => "Dominating", + "text" => "Killed <strong>15</strong> people in a row without dying himself/herself" + ); + +$hint['US'] = array ( "caption" => "Unstoppable", + "text" => "Killed <strong>20</strong> people in a row without dying himself/herself" + ); + +$hint['GL'] = array ( "caption" => "God Like", + "text" => "Killed <strong>25</strong> people in a row without dying himself/herself" + ); + +?>
\ No newline at end of file diff --git a/html/includes/index.htm b/html/includes/index.htm new file mode 100755 index 0000000..e69de29 --- /dev/null +++ b/html/includes/index.htm diff --git a/html/includes/overlib_mini.js b/html/includes/overlib_mini.js new file mode 100755 index 0000000..704d123 --- /dev/null +++ b/html/includes/overlib_mini.js @@ -0,0 +1,322 @@ +//\/////
+//\ overLIB 4.21 - You may not remove or change this notice.
+//\ Copyright Erik Bosrup 1998-2004. All rights reserved.
+//\
+//\ Contributors are listed on the homepage.
+//\ This file might be old, always check for the latest version at:
+//\ http://www.bosrup.com/web/overlib/
+//\
+//\ Please read the license agreement (available through the link above)
+//\ before using overLIB. Direct any licensing questions to erik@bosrup.com.
+//\
+//\ Do not sell this as your own work or remove this copyright notice.
+//\ For full details on copying or changing this script please read the
+//\ license agreement at the link above. Please give credit on sites that
+//\ use overLIB and submit changes of the script so other people can use
+//\ them as well.
+//\/////
+//\ THIS IS A VERY MODIFIED VERSION. DO NOT EDIT OR PUBLISH. GET THE ORIGINAL!
+var olLoaded=0,pmStart=10000000,pmUpper=10001000,pmCount=pmStart+1,pmt='',pms=new Array(),olInfo=new Info('4.21',1),FREPLACE=0,FBEFORE=1,FAFTER=2,FALTERNATE=3,FCHAIN=4,olHideForm=0,olHautoFlag=0,olVautoFlag=0,hookPts=new Array(),postParse=new Array(),cmdLine=new Array(),runTime=new Array();
+registerCommands('donothing,inarray,caparray,sticky,background,noclose,caption,left,right,center,offsetx,offsety,fgcolor,bgcolor,textcolor,capcolor,closecolor,width,border,cellpad,status,autostatus,autostatuscap,height,closetext,snapx,snapy,fixx,fixy,relx,rely,fgbackground,bgbackground,padx,pady,fullhtml,above,below,capicon,textfont,captionfont,closefont,textsize,captionsize,closesize,timeout,function,delay,hauto,vauto,closeclick,wrap,followmouse,mouseoff,closetitle,cssoff,compatmode,cssclass,fgclass,bgclass,textfontclass,captionfontclass,closefontclass');
+if(typeof ol_fgcolor=='undefined')var ol_fgcolor="#CCCCFF";if(typeof ol_bgcolor=='undefined')var ol_bgcolor="#333399";if(typeof ol_textcolor=='undefined')var ol_textcolor="#000000";if(typeof ol_capcolor=='undefined')var ol_capcolor="#FFFFFF";if(typeof ol_closecolor=='undefined')var ol_closecolor="#9999FF";if(typeof ol_textfont=='undefined')var ol_textfont="Verdana,Arial,Helvetica";if(typeof ol_captionfont=='undefined')var ol_captionfont="Verdana,Arial,Helvetica";if(typeof ol_closefont=='undefined')var ol_closefont="Verdana,Arial,Helvetica";if(typeof ol_textsize=='undefined')var ol_textsize="1";if(typeof ol_captionsize=='undefined')var ol_captionsize="1";if(typeof ol_closesize=='undefined')var ol_closesize="1";if(typeof ol_width=='undefined')var ol_width="200";if(typeof ol_border=='undefined')var ol_border="1";if(typeof ol_cellpad=='undefined')var ol_cellpad=2;if(typeof ol_offsetx=='undefined')var ol_offsetx=10;if(typeof ol_offsety=='undefined')var ol_offsety=10;if(typeof ol_text=='undefined')var ol_text="Default Text";if(typeof ol_cap=='undefined')var ol_cap="";if(typeof ol_sticky=='undefined')var ol_sticky=0;if(typeof ol_background=='undefined')var ol_background="";if(typeof ol_close=='undefined')var ol_close="Close";if(typeof ol_hpos=='undefined')var ol_hpos=RIGHT;if(typeof ol_status=='undefined')var ol_status="";if(typeof ol_autostatus=='undefined')var ol_autostatus=0;if(typeof ol_height=='undefined')var ol_height=-1;if(typeof ol_snapx=='undefined')var ol_snapx=0;if(typeof ol_snapy=='undefined')var ol_snapy=0;if(typeof ol_fixx=='undefined')var ol_fixx=-1;if(typeof ol_fixy=='undefined')var ol_fixy=-1;if(typeof ol_relx=='undefined')var ol_relx=null;if(typeof ol_rely=='undefined')var ol_rely=null;if(typeof ol_fgbackground=='undefined')var ol_fgbackground="";if(typeof ol_bgbackground=='undefined')var ol_bgbackground="";if(typeof ol_padxl=='undefined')var ol_padxl=1;if(typeof ol_padxr=='undefined')var ol_padxr=1;if(typeof ol_padyt=='undefined')var ol_padyt=1;if(typeof ol_padyb=='undefined')var ol_padyb=1;if(typeof ol_fullhtml=='undefined')var ol_fullhtml=0;if(typeof ol_vpos=='undefined')var ol_vpos=BELOW;if(typeof ol_aboveheight=='undefined')var ol_aboveheight=0;if(typeof ol_capicon=='undefined')var ol_capicon="";if(typeof ol_frame=='undefined')var ol_frame=self;if(typeof ol_timeout=='undefined')var ol_timeout=0;if(typeof ol_function=='undefined')var ol_function=null;if(typeof ol_delay=='undefined')var ol_delay=0;if(typeof ol_hauto=='undefined')var ol_hauto=0;if(typeof ol_vauto=='undefined')var ol_vauto=0;if(typeof ol_closeclick=='undefined')var ol_closeclick=0;if(typeof ol_wrap=='undefined')var ol_wrap=0;if(typeof ol_followmouse=='undefined')var ol_followmouse=1;if(typeof ol_mouseoff=='undefined')var ol_mouseoff=0;if(typeof ol_closetitle=='undefined')var ol_closetitle='Close';if(typeof ol_compatmode=='undefined')var ol_compatmode=0;if(typeof ol_css=='undefined')var ol_css=CSSOFF;if(typeof ol_fgclass=='undefined')var ol_fgclass="";if(typeof ol_bgclass=='undefined')var ol_bgclass="";if(typeof ol_textfontclass=='undefined')var ol_textfontclass="";if(typeof ol_captionfontclass=='undefined')var ol_captionfontclass="";if(typeof ol_closefontclass=='undefined')var ol_closefontclass="";
+if(typeof ol_texts=='undefined')var ol_texts=new Array("Text 0","Text 1");if(typeof ol_caps=='undefined')var ol_caps=new Array("Caption 0","Caption 1");
+var o3_text="",o3_cap="",o3_sticky=0,o3_background="",o3_close="Close",o3_hpos=RIGHT,o3_offsetx=2,o3_offsety=2,o3_fgcolor="",o3_bgcolor="",o3_textcolor="",o3_capcolor="",o3_closecolor="",o3_width=100,o3_border=1,o3_cellpad=2,o3_status="",o3_autostatus=0,o3_height=-1,o3_snapx=0,o3_snapy=0,o3_fixx=-1,o3_fixy=-1,o3_relx=null,o3_rely=null,o3_fgbackground="",o3_bgbackground="",o3_padxl=0,o3_padxr=0,o3_padyt=0,o3_padyb=0,o3_fullhtml=0,o3_vpos=BELOW,o3_aboveheight=0,o3_capicon="",o3_textfont="Verdana,Arial,Helvetica",o3_captionfont="Verdana,Arial,Helvetica",o3_closefont="Verdana,Arial,Helvetica",o3_textsize="1",o3_captionsize="1",o3_closesize="1",o3_frame=self,o3_timeout=0,o3_timerid=0,o3_allowmove=0,o3_function=null,o3_delay=0,o3_delayid=0,o3_hauto=0,o3_vauto=0,o3_closeclick=0,o3_wrap=0,o3_followmouse=1,o3_mouseoff=0,o3_closetitle='',o3_compatmode=0,o3_css=CSSOFF,o3_fgclass="",o3_bgclass="",o3_textfontclass="",o3_captionfontclass="",o3_closefontclass="";
+var o3_x=0,o3_y=0,o3_showingsticky=0,o3_removecounter=0;
+var over=null,fnRef,hoveringSwitch=false,olHideDelay;
+var isMac=(navigator.userAgent.indexOf("Mac")!=-1),olOp=(navigator.userAgent.toLowerCase().indexOf('opera')>-1&&document.createTextNode),olNs4=(navigator.appName=='Netscape'&&parseInt(navigator.appVersion)==4),olNs6=(document.getElementById)?true:false,olKq=(olNs6&&/konqueror/i.test(navigator.userAgent)),olIe4=(document.all)?true:false,olIe5=false,olIe55=false,docRoot='document.body';
+if(olNs4){var oW=window.innerWidth;var oH=window.innerHeight;window.onresize=function(){if(oW!=window.innerWidth||oH!=window.innerHeight)location.reload();}}
+if(olIe4){var agent=navigator.userAgent;if(/MSIE/.test(agent)){var versNum=parseFloat(agent.match(/MSIE[ ](\d\.\d+)\.*/i)[1]);if(versNum>=5){olIe5=true;olIe55=(versNum>=5.5&&!olOp)?true:false;if(olNs6)olNs6=false;}}
+if(olNs6)olIe4=false;}
+if(document.compatMode&&document.compatMode=='CSS1Compat'){docRoot=((olIe4&&!olOp)?'document.documentElement':docRoot);}
+if(window.addEventListener)window.addEventListener("load",OLonLoad_handler,false);else if(window.attachEvent)window.attachEvent("onload",OLonLoad_handler);
+var capExtent;
+function overlib(){if(!olLoaded||isExclusive(overlib.arguments))return true;if(olCheckMouseCapture)olMouseCapture();if(over){over=(typeof over.id!='string')?o3_frame.document.all['overDiv']:over;cClick();}
+olHideDelay=0;o3_text=ol_text;o3_cap=ol_cap;o3_sticky=ol_sticky;o3_background=ol_background;o3_close=ol_close;o3_hpos=ol_hpos;o3_offsetx=ol_offsetx;o3_offsety=ol_offsety;o3_fgcolor=ol_fgcolor;o3_bgcolor=ol_bgcolor;o3_textcolor=ol_textcolor;o3_capcolor=ol_capcolor;o3_closecolor=ol_closecolor;o3_width=ol_width;o3_border=ol_border;o3_cellpad=ol_cellpad;o3_status=ol_status;o3_autostatus=ol_autostatus;o3_height=ol_height;o3_snapx=ol_snapx;o3_snapy=ol_snapy;o3_fixx=ol_fixx;o3_fixy=ol_fixy;o3_relx=ol_relx;o3_rely=ol_rely;o3_fgbackground=ol_fgbackground;o3_bgbackground=ol_bgbackground;o3_padxl=ol_padxl;o3_padxr=ol_padxr;o3_padyt=ol_padyt;o3_padyb=ol_padyb;o3_fullhtml=ol_fullhtml;o3_vpos=ol_vpos;o3_aboveheight=ol_aboveheight;o3_capicon=ol_capicon;o3_textfont=ol_textfont;o3_captionfont=ol_captionfont;o3_closefont=ol_closefont;o3_textsize=ol_textsize;o3_captionsize=ol_captionsize;o3_closesize=ol_closesize;o3_timeout=ol_timeout;o3_function=ol_function;o3_delay=ol_delay;o3_hauto=ol_hauto;o3_vauto=ol_vauto;o3_closeclick=ol_closeclick;o3_wrap=ol_wrap;o3_followmouse=ol_followmouse;o3_mouseoff=ol_mouseoff;o3_closetitle=ol_closetitle;o3_css=ol_css;o3_compatmode=ol_compatmode;o3_fgclass=ol_fgclass;o3_bgclass=ol_bgclass;o3_textfontclass=ol_textfontclass;o3_captionfontclass=ol_captionfontclass;o3_closefontclass=ol_closefontclass;
+setRunTimeVariables();
+fnRef='';
+o3_frame=ol_frame;
+if(!(over=createDivContainer()))return false;
+parseTokens('o3_',overlib.arguments);if(!postParseChecks())return false;
+if(o3_delay==0){return runHook("olMain",FREPLACE);}else{o3_delayid=setTimeout("runHook('olMain',FREPLACE)",o3_delay);return false;}}
+function nd(time){if(olLoaded&&!isExclusive()){hideDelay(time);
+if(o3_removecounter>=1){o3_showingsticky=0 };
+if(o3_showingsticky==0){o3_allowmove=0;if(over!=null&&o3_timerid==0)runHook("hideObject",FREPLACE,over);}else{o3_removecounter++;}}
+return true;}
+function cClick(){if(olLoaded){runHook("hideObject",FREPLACE,over);o3_showingsticky=0;}
+return false;}
+function overlib_pagedefaults(){parseTokens('ol_',overlib_pagedefaults.arguments);}
+function olMain(){var layerhtml,styleType;runHook("olMain",FBEFORE);
+if(o3_background!=""||o3_fullhtml){
+layerhtml=runHook('ol_content_background',FALTERNATE,o3_css,o3_text,o3_background,o3_fullhtml);}else{
+styleType=(pms[o3_css-1-pmStart]=="cssoff"||pms[o3_css-1-pmStart]=="cssclass");
+if(o3_fgbackground!="")o3_fgbackground="background=\""+o3_fgbackground+"\"";if(o3_bgbackground!="")o3_bgbackground=(styleType?"background=\""+o3_bgbackground+"\"":o3_bgbackground);
+if(o3_fgcolor!="")o3_fgcolor=(styleType?"bgcolor=\""+o3_fgcolor+"\"":o3_fgcolor);if(o3_bgcolor!="")o3_bgcolor=(styleType?"bgcolor=\""+o3_bgcolor+"\"":o3_bgcolor);
+if(o3_height>0)o3_height=(styleType?"height=\""+o3_height+"\"":o3_height);else o3_height="";
+if(o3_cap==""){
+layerhtml=runHook('ol_content_simple',FALTERNATE,o3_css,o3_text);}else{
+if(o3_sticky){
+layerhtml=runHook('ol_content_caption',FALTERNATE,o3_css,o3_text,o3_cap,o3_close);}else{
+layerhtml=runHook('ol_content_caption',FALTERNATE,o3_css,o3_text,o3_cap,"");}}}
+if(o3_sticky){if(o3_timerid>0){clearTimeout(o3_timerid);o3_timerid=0;}
+o3_showingsticky=1;o3_removecounter=0;}
+if(!runHook("createPopup",FREPLACE,layerhtml))return false;
+if(o3_autostatus>0){o3_status=o3_text;if(o3_autostatus>1)o3_status=o3_cap;}
+o3_allowmove=0;
+if(o3_timeout>0){if(o3_timerid>0)clearTimeout(o3_timerid);o3_timerid=setTimeout("cClick()",o3_timeout);}
+runHook("disp",FREPLACE,o3_status);runHook("olMain",FAFTER);
+return(olOp&&event&&event.type=='mouseover'&&!o3_status)?'':(o3_status!='');}
+function ol_content_simple(text){var cpIsMultiple=/,/.test(o3_cellpad);var txt='<table width="'+o3_width+'" border="0" cellpadding="'+o3_border+'" cellspacing="0" '+(o3_bgclass?'class="'+o3_bgclass+'"':o3_bgcolor+' '+o3_height)+'><tr><td><table width="100%" border="0" '+((olNs4||!cpIsMultiple)?'cellpadding="'+o3_cellpad+'" ':'')+'cellspacing="0" '+(o3_fgclass?'class="'+o3_fgclass+'"':o3_fgcolor+' '+o3_fgbackground+' '+o3_height)+'><tr><td valign="TOP"'+(o3_textfontclass?' class="'+o3_textfontclass+'">':((!olNs4&&cpIsMultiple)?' style="'+setCellPadStr(o3_cellpad)+'">':'>'))+(o3_textfontclass?'':wrapStr(0,o3_textsize,'text'))+text+(o3_textfontclass?'':wrapStr(1,o3_textsize))+'</td></tr></table></td></tr></table>';
+set_background("");return txt;}
+function ol_content_caption(text,title,close){var nameId,txt,cpIsMultiple=/,/.test(o3_cellpad);var closing,closeevent;
+closing="";closeevent="onmouseover";if(o3_closeclick==1)closeevent=(o3_closetitle?"title='"+o3_closetitle+"'":"")+" onclick";if(o3_capicon!=""){nameId=' hspace=\"5\"'+' align=\"middle\" alt=\"\"';if(typeof o3_dragimg!='undefined'&&o3_dragimg)nameId=' hspace=\"5\"'+' name=\"'+o3_dragimg+'\" id=\"'+o3_dragimg+'\" align=\"middle\" alt=\"Drag Enabled\" title=\"Drag Enabled\"';o3_capicon='<img src=\"'+o3_capicon+'\"'+nameId+' />';}
+if(close!="")
+closing='<td '+(!o3_compatmode&&o3_closefontclass?'class="'+o3_closefontclass:'align="RIGHT')+'"><a href="javascript:return '+fnRef+'cClick();"'+((o3_compatmode&&o3_closefontclass)?' class="'+o3_closefontclass+'" ':' ')+closeevent+'="return '+fnRef+'cClick();">'+(o3_closefontclass?'':wrapStr(0,o3_closesize,'close'))+close+(o3_closefontclass?'':wrapStr(1,o3_closesize,'close'))+'</a></td>';txt='<table width="'+o3_width+'" border="0" cellpadding="'+o3_border+'" cellspacing="0" '+(o3_bgclass?'class="'+o3_bgclass+'"':o3_bgcolor+' '+o3_bgbackground+' '+o3_height)+'><tr><td><table width="100%" border="0" cellpadding="2" cellspacing="0"><tr><td'+(o3_captionfontclass?' class="'+o3_captionfontclass+'">':'>')+(o3_captionfontclass?'':'<b>'+wrapStr(0,o3_captionsize,'caption'))+o3_capicon+title+(o3_captionfontclass?'':wrapStr(1,o3_captionsize)+'</b>')+'</td>'+closing+'</tr></table><table width="100%" border="0" '+((olNs4||!cpIsMultiple)?'cellpadding="'+o3_cellpad+'" ':'')+'cellspacing="0" '+(o3_fgclass?'class="'+o3_fgclass+'"':o3_fgcolor+' '+o3_fgbackground+' '+o3_height)+'><tr><td valign="TOP"'+(o3_textfontclass?' class="'+o3_textfontclass+'">' :((!olNs4&&cpIsMultiple)?' style="'+setCellPadStr(o3_cellpad)+'">':'>'))+(o3_textfontclass?'':wrapStr(0,o3_textsize,'text'))+text+(o3_textfontclass?'':wrapStr(1,o3_textsize))+'</td></tr></table></td></tr></table>';
+set_background("");return txt;}
+function ol_content_background(text,picture,hasfullhtml){if(hasfullhtml){txt=text;}else{txt='<table width="'+o3_width+'" border="0" cellpadding="0" cellspacing="0" height="'+o3_height+'"><tr><td colspan="3" height="'+o3_padyt+'"></td></tr><tr><td width="'+o3_padxl+'"></td><td valign="TOP" width="'+(o3_width-o3_padxl-o3_padxr)+(o3_textfontclass?'" class="'+o3_textfontclass:'')+'">'+(o3_textfontclass?'':wrapStr(0,o3_textsize,'text'))+text+(o3_textfontclass?'':wrapStr(1,o3_textsize))+'</td><td width="'+o3_padxr+'"></td></tr><tr><td colspan="3" height="'+o3_padyb+'"></td></tr></table>';}
+set_background(picture);return txt;}
+function set_background(pic){if(pic==""){if(olNs4){over.background.src=null;}else if(over.style){over.style.backgroundImage="none";}
+}else{if(olNs4){over.background.src=pic;}else if(over.style){over.style.width=o3_width+'px';over.style.backgroundImage="url("+pic+")";}}}
+var olShowId=-1;
+function disp(statustext){runHook("disp",FBEFORE);
+if(o3_allowmove==0){runHook("placeLayer",FREPLACE);(olNs6&&olShowId<0)?olShowId=setTimeout("runHook('showObject',FREPLACE,over)",1):runHook("showObject",FREPLACE,over);o3_allowmove=(o3_sticky||o3_followmouse==0)?0:1;}
+runHook("disp",FAFTER);
+if(statustext!="")self.status=statustext;}
+function createPopup(lyrContent){runHook("createPopup",FBEFORE);
+if(o3_wrap){var wd,ww,theObj=(olNs4?over:over.style);theObj.top=theObj.left=((olIe4&&!olOp)?0:-10000)+(!olNs4?'px':0);layerWrite(lyrContent);wd=(olNs4?over.clip.width:over.offsetWidth);if(wd>(ww=windowWidth())){lyrContent=lyrContent.replace(/\ /g,' ');o3_width=ww;o3_wrap=0;}}
+layerWrite(lyrContent);
+if(o3_wrap)o3_width=(olNs4?over.clip.width:over.offsetWidth);
+runHook("createPopup",FAFTER,lyrContent);
+return true;}
+function placeLayer(){var placeX,placeY,widthFix=0;
+if(o3_frame.innerWidth)widthFix=18;iwidth=windowWidth();
+winoffset=(olIe4)?eval('o3_frame.'+docRoot+'.scrollLeft'):o3_frame.pageXOffset;
+placeX=runHook('horizontalPlacement',FCHAIN,iwidth,winoffset,widthFix);
+if(o3_frame.innerHeight){iheight=o3_frame.innerHeight;}else if(eval('o3_frame.'+docRoot)&&eval("typeof o3_frame."+docRoot+".clientHeight=='number'")&&eval('o3_frame.'+docRoot+'.clientHeight')){iheight=eval('o3_frame.'+docRoot+'.clientHeight');}
+scrolloffset=(olIe4)?eval('o3_frame.'+docRoot+'.scrollTop'):o3_frame.pageYOffset;placeY=runHook('verticalPlacement',FCHAIN,iheight,scrolloffset);
+repositionTo(over,placeX,placeY);}
+function olMouseMove(e){var e=(e)?e:event;
+if(e.pageX){o3_x=e.pageX;o3_y=e.pageY;}else if(e.clientX){o3_x=eval('e.clientX+o3_frame.'+docRoot+'.scrollLeft');o3_y=eval('e.clientY+o3_frame.'+docRoot+'.scrollTop');}
+if(o3_allowmove==1)runHook("placeLayer",FREPLACE);
+if(hoveringSwitch&&!olNs4&&runHook("cursorOff",FREPLACE)){(olHideDelay?hideDelay(olHideDelay):cClick());hoveringSwitch=!hoveringSwitch;}}
+function no_overlib(){return ver3fix;}
+function olMouseCapture(){capExtent=document;var fN,str='',l,k,f,wMv,sS,mseHandler=olMouseMove;var re=/function[ ]*(\w*)\(/;
+wMv=(!olIe4&&window.onmousemove);if(document.onmousemove||wMv){if(wMv)capExtent=window;f=capExtent.onmousemove.toString();fN=f.match(re);if(fN==null){str=f+'(e);';}else if(fN[1]=='anonymous'||fN[1]=='olMouseMove'||(wMv&&fN[1]=='onmousemove')){if(!olOp&&wMv){l=f.indexOf('{')+1;k=f.lastIndexOf('}');sS=f.substring(l,k);if((l=sS.indexOf('('))!=-1){sS=sS.substring(0,l).replace(/^\s+/,'').replace(/\s+$/,'');if(eval("typeof "+sS+"=='undefined'"))window.onmousemove=null;else str=sS+'(e);';}}
+if(!str){olCheckMouseCapture=false;return;}
+}else{if(fN[1])str=fN[1]+'(e);';else{l=f.indexOf('{')+1;k=f.lastIndexOf('}');str=f.substring(l,k)+'\n';}}
+str+='olMouseMove(e);';mseHandler=new Function('e',str);}
+capExtent.onmousemove=mseHandler;if(olNs4)capExtent.captureEvents(Event.MOUSEMOVE);}
+function parseTokens(pf,ar){
+var v,i,mode=-1,par=(pf!='ol_'),fnMark=(par&&!ar.length?1:0);
+for(i=0;i<ar.length;i++){if(mode<0){
+if(typeof ar[i]=='number'&&ar[i]>pmStart&&ar[i]<pmUpper){fnMark=(par?1:0);i--;}else{switch(pf){case 'ol_':
+ol_text=ar[i].toString();break;default:
+o3_text=ar[i].toString();}}
+mode=0;}else{
+if(ar[i]>=pmCount||ar[i]==DONOTHING){continue;}
+if(ar[i]==INARRAY){fnMark=0;eval(pf+'text=ol_texts['+ar[++i]+'].toString()');continue;}
+if(ar[i]==CAPARRAY){eval(pf+'cap=ol_caps['+ar[++i]+'].toString()');continue;}
+if(ar[i]==STICKY){if(pf!='ol_')eval(pf+'sticky=1');continue;}
+if(ar[i]==BACKGROUND){eval(pf+'background="'+ar[++i]+'"');continue;}
+if(ar[i]==NOCLOSE){if(pf!='ol_')opt_NOCLOSE();continue;}
+if(ar[i]==CAPTION){eval(pf+"cap='"+escSglQuote(ar[++i])+"'");continue;}
+if(ar[i]==CENTER||ar[i]==LEFT||ar[i]==RIGHT){eval(pf+'hpos='+ar[i]);if(pf!='ol_')olHautoFlag=1;continue;}
+if(ar[i]==OFFSETX){eval(pf+'offsetx='+ar[++i]);continue;}
+if(ar[i]==OFFSETY){eval(pf+'offsety='+ar[++i]);continue;}
+if(ar[i]==FGCOLOR){eval(pf+'fgcolor="'+ar[++i]+'"');continue;}
+if(ar[i]==BGCOLOR){eval(pf+'bgcolor="'+ar[++i]+'"');continue;}
+if(ar[i]==TEXTCOLOR){eval(pf+'textcolor="'+ar[++i]+'"');continue;}
+if(ar[i]==CAPCOLOR){eval(pf+'capcolor="'+ar[++i]+'"');continue;}
+if(ar[i]==CLOSECOLOR){eval(pf+'closecolor="'+ar[++i]+'"');continue;}
+if(ar[i]==WIDTH){eval(pf+'width='+ar[++i]);continue;}
+if(ar[i]==BORDER){eval(pf+'border='+ar[++i]);continue;}
+if(ar[i]==CELLPAD){i=opt_MULTIPLEARGS(++i,ar,(pf+'cellpad'));continue;}
+if(ar[i]==STATUS){eval(pf+"status='"+escSglQuote(ar[++i])+"'");continue;}
+if(ar[i]==AUTOSTATUS){eval(pf+'autostatus=('+pf+'autostatus==1)?0:1');continue;}
+if(ar[i]==AUTOSTATUSCAP){eval(pf+'autostatus=('+pf+'autostatus==2)?0:2');continue;}
+if(ar[i]==HEIGHT){eval(pf+'height='+pf+'aboveheight='+ar[++i]);continue;}
+if(ar[i]==CLOSETEXT){eval(pf+"close='"+escSglQuote(ar[++i])+"'");continue;}
+if(ar[i]==SNAPX){eval(pf+'snapx='+ar[++i]);continue;}
+if(ar[i]==SNAPY){eval(pf+'snapy='+ar[++i]);continue;}
+if(ar[i]==FIXX){eval(pf+'fixx='+ar[++i]);continue;}
+if(ar[i]==FIXY){eval(pf+'fixy='+ar[++i]);continue;}
+if(ar[i]==RELX){eval(pf+'relx='+ar[++i]);continue;}
+if(ar[i]==RELY){eval(pf+'rely='+ar[++i]);continue;}
+if(ar[i]==FGBACKGROUND){eval(pf+'fgbackground="'+ar[++i]+'"');continue;}
+if(ar[i]==BGBACKGROUND){eval(pf+'bgbackground="'+ar[++i]+'"');continue;}
+if(ar[i]==PADX){eval(pf+'padxl='+ar[++i]);eval(pf+'padxr='+ar[++i]);continue;}
+if(ar[i]==PADY){eval(pf+'padyt='+ar[++i]);eval(pf+'padyb='+ar[++i]);continue;}
+if(ar[i]==FULLHTML){if(pf!='ol_')eval(pf+'fullhtml=1');continue;}
+if(ar[i]==BELOW||ar[i]==ABOVE){eval(pf+'vpos='+ar[i]);if(pf!='ol_')olVautoFlag=1;continue;}
+if(ar[i]==CAPICON){eval(pf+'capicon="'+ar[++i]+'"');continue;}
+if(ar[i]==TEXTFONT){eval(pf+"textfont='"+escSglQuote(ar[++i])+"'");continue;}
+if(ar[i]==CAPTIONFONT){eval(pf+"captionfont='"+escSglQuote(ar[++i])+"'");continue;}
+if(ar[i]==CLOSEFONT){eval(pf+"closefont='"+escSglQuote(ar[++i])+"'");continue;}
+if(ar[i]==TEXTSIZE){eval(pf+'textsize="'+ar[++i]+'"');continue;}
+if(ar[i]==CAPTIONSIZE){eval(pf+'captionsize="'+ar[++i]+'"');continue;}
+if(ar[i]==CLOSESIZE){eval(pf+'closesize="'+ar[++i]+'"');continue;}
+if(ar[i]==TIMEOUT){eval(pf+'timeout='+ar[++i]);continue;}
+if(ar[i]==FUNCTION){if(pf=='ol_'){if(typeof ar[i+1]!='number'){v=ar[++i];ol_function=(typeof v=='function'?v:null);}}else{fnMark=0;v=null;if(typeof ar[i+1]!='number')v=ar[++i]; opt_FUNCTION(v);} continue;}
+if(ar[i]==DELAY){eval(pf+'delay='+ar[++i]);continue;}
+if(ar[i]==HAUTO){eval(pf+'hauto=('+pf+'hauto==0)?1:0');continue;}
+if(ar[i]==VAUTO){eval(pf+'vauto=('+pf+'vauto==0)?1:0');continue;}
+if(ar[i]==CLOSECLICK){eval(pf+'closeclick=('+pf+'closeclick==0)?1:0');continue;}
+if(ar[i]==WRAP){eval(pf+'wrap=('+pf+'wrap==0)?1:0');continue;}
+if(ar[i]==FOLLOWMOUSE){eval(pf+'followmouse=('+pf+'followmouse==1)?0:1');continue;}
+if(ar[i]==MOUSEOFF){eval(pf+'mouseoff=('+pf+'mouseoff==0)?1:0');v=ar[i+1];if(pf!='ol_'&&eval(pf+'mouseoff')&&typeof v=='number'&&(v<pmStart||v>pmUpper))olHideDelay=ar[++i];continue;}
+if(ar[i]==CLOSETITLE){eval(pf+"closetitle='"+escSglQuote(ar[++i])+"'");continue;}
+if(ar[i]==CSSOFF||ar[i]==CSSCLASS){eval(pf+'css='+ar[i]);continue;}
+if(ar[i]==COMPATMODE){eval(pf+'compatmode=('+pf+'compatmode==0)?1:0');continue;}
+if(ar[i]==FGCLASS){eval(pf+'fgclass="'+ar[++i]+'"');continue;}
+if(ar[i]==BGCLASS){eval(pf+'bgclass="'+ar[++i]+'"');continue;}
+if(ar[i]==TEXTFONTCLASS){eval(pf+'textfontclass="'+ar[++i]+'"');continue;}
+if(ar[i]==CAPTIONFONTCLASS){eval(pf+'captionfontclass="'+ar[++i]+'"');continue;}
+if(ar[i]==CLOSEFONTCLASS){eval(pf+'closefontclass="'+ar[++i]+'"');continue;}
+i=parseCmdLine(pf,i,ar);}}
+if(fnMark&&o3_function)o3_text=o3_function();
+if((pf=='o3_')&&o3_wrap){o3_width=0;
+var tReg=/<.*\n*>/ig;if(!tReg.test(o3_text))o3_text=o3_text.replace(/[ ]+/g,' ');if(!tReg.test(o3_cap))o3_cap=o3_cap.replace(/[ ]+/g,' ');}
+if((pf=='o3_')&&o3_sticky){if(!o3_close&&(o3_frame!=ol_frame))o3_close=ol_close;if(o3_mouseoff&&(o3_frame==ol_frame))opt_NOCLOSE(' ');}}
+function layerWrite(txt){txt+="\n";if(olNs4){var lyr=o3_frame.document.layers['overDiv'].document
+lyr.write(txt)
+lyr.close()
+}else if(typeof over.innerHTML!='undefined'){if(olIe5&&isMac)over.innerHTML='';over.innerHTML=txt;}else{range=o3_frame.document.createRange();range.setStartAfter(over);domfrag=range.createContextualFragment(txt);
+while(over.hasChildNodes()){over.removeChild(over.lastChild);}
+over.appendChild(domfrag);}}
+function showObject(obj){runHook("showObject",FBEFORE);
+var theObj=(olNs4?obj:obj.style);theObj.visibility='visible';
+runHook("showObject",FAFTER);}
+function hideObject(obj){runHook("hideObject",FBEFORE);
+var theObj=(olNs4?obj:obj.style);if(olNs6&&olShowId>0){clearTimeout(olShowId);olShowId=0;}
+theObj.visibility='hidden';theObj.top=theObj.left=((olIe4&&!olOp)?0:-10000)+(!olNs4?'px':0);
+if(o3_timerid>0)clearTimeout(o3_timerid);if(o3_delayid>0)clearTimeout(o3_delayid);
+o3_timerid=0;o3_delayid=0;self.status="";
+if(obj.onmouseout||obj.onmouseover){if(olNs4)obj.releaseEvents(Event.MOUSEOUT||Event.MOUSEOVER);obj.onmouseout=obj.onmouseover=null;}
+runHook("hideObject",FAFTER);}
+function repositionTo(obj,xL,yL){var theObj=(olNs4?obj:obj.style);theObj.left=xL+(!olNs4?'px':0);theObj.top=yL+(!olNs4?'px':0);}
+function cursorOff(){var left=parseInt(over.style.left);var top=parseInt(over.style.top);var right=left+(over.offsetWidth>=parseInt(o3_width)?over.offsetWidth:parseInt(o3_width));var bottom=top+(over.offsetHeight>=o3_aboveheight?over.offsetHeight:o3_aboveheight);
+if(o3_x<left||o3_x>right||o3_y<top||o3_y>bottom)return true;
+return false;}
+function opt_FUNCTION(callme){o3_text=(callme?(typeof callme=='string'?(/.+\(.*\)/.test(callme)?eval(callme):callme):callme()):(o3_function?o3_function():'No Function'));
+return 0;}
+function opt_NOCLOSE(unused){if(!unused)o3_close="";
+if(olNs4){over.captureEvents(Event.MOUSEOUT||Event.MOUSEOVER);over.onmouseover=function(){if(o3_timerid>0){clearTimeout(o3_timerid);o3_timerid=0;} }
+over.onmouseout=function(e){if(olHideDelay)hideDelay(olHideDelay);else cClick(e);}
+}else{over.onmouseover=function(){hoveringSwitch=true;if(o3_timerid>0){clearTimeout(o3_timerid);o3_timerid=0;} }}
+return 0;}
+function opt_MULTIPLEARGS(i,args,parameter){var k=i,re,pV,str='';
+for(k=i;k<args.length;k++){if(typeof args[k]=='number'&&args[k]>pmStart)break;str+=args[k]+',';}
+if(str)str=str.substring(0,--str.length);
+k--;pV=(olNs4&&/cellpad/i.test(parameter))?str.split(',')[0]:str;eval(parameter+'="'+pV+'"');
+return k;}
+function nbspCleanup(){if(o3_wrap){o3_text=o3_text.replace(/\ /g,' ');o3_cap=o3_cap.replace(/\ /g,' ');}}
+function escSglQuote(str){return str.toString().replace(/'/g,"\\'");}
+function OLonLoad_handler(e){var re=/\w+\(.*\)[;\s]+/g,olre=/overlib\(|nd\(|cClick\(/,fn,l,i;
+if(!olLoaded)olLoaded=1;
+if(window.removeEventListener&&e.eventPhase==3)window.removeEventListener("load",OLonLoad_handler,false);else if(window.detachEvent){window.detachEvent("onload",OLonLoad_handler);var fN=document.body.getAttribute('onload');if(fN){fN=fN.toString().match(re);if(fN&&fN.length){for(i=0;i<fN.length;i++){if(/anonymous/.test(fN[i]))continue;while((l=fN[i].search(/\)[;\s]+/))!=-1){fn=fN[i].substring(0,l+1);fN[i]=fN[i].substring(l+2);if(olre.test(fn))eval(fn);}}}}}}
+function wrapStr(endWrap,fontSizeStr,whichString){var fontStr,fontColor,isClose=((whichString=='close')?1:0),hasDims=/[%\-a-z]+$/.test(fontSizeStr);fontSizeStr=(olNs4)?(!hasDims?fontSizeStr:'1'):fontSizeStr;if(endWrap)return(hasDims&&!olNs4)?(isClose?'</span>':'</div>'):'</font>';else{fontStr='o3_'+whichString+'font';fontColor='o3_'+((whichString=='caption')? 'cap':whichString)+'color';return(hasDims&&!olNs4)?(isClose?'<span style="font-family: '+quoteMultiNameFonts(eval(fontStr))+';color: '+eval(fontColor)+';font-size: '+fontSizeStr+';">':'<div style="font-family: '+quoteMultiNameFonts(eval(fontStr))+';color: '+eval(fontColor)+';font-size: '+fontSizeStr+';">'):'<font face="'+eval(fontStr)+'" color="'+eval(fontColor)+'" size="'+(parseInt(fontSizeStr)>7?'7':fontSizeStr)+'">';}}
+function quoteMultiNameFonts(theFont){var v,pM=theFont.split(',');for(var i=0;i<pM.length;i++){v=pM[i];v=v.replace(/^\s+/,'').replace(/\s+$/,'');if(/\s/.test(v)&&!/['"]/.test(v)){v="\'"+v+"\'";pM[i]=v;}}
+return pM.join();}
+function isExclusive(args){return false;}
+function setCellPadStr(parameter){var Str='',j=0,ary=new Array(),top,bottom,left,right;
+Str+='padding: ';ary=parameter.replace(/\s+/g,'').split(',');
+switch(ary.length){case 2:
+top=bottom=ary[j];left=right=ary[++j];break;case 3:
+top=ary[j];left=right=ary[++j];bottom=ary[++j];break;case 4:
+top=ary[j];right=ary[++j];bottom=ary[++j];left=ary[++j];break;}
+Str+=((ary.length==1)?ary[0]+'px;':top+'px '+right+'px '+bottom+'px '+left+'px;');
+return Str;}
+function hideDelay(time){if(time&&!o3_delay){if(o3_timerid>0)clearTimeout(o3_timerid);
+o3_timerid=setTimeout("cClick()",(o3_timeout=time));}}
+function horizontalPlacement(browserWidth,horizontalScrollAmount,widthFix){var placeX,iwidth=browserWidth,winoffset=horizontalScrollAmount;var parsedWidth=parseInt(o3_width);
+if(o3_fixx>-1||o3_relx!=null){
+placeX=(o3_relx!=null?( o3_relx<0?winoffset+o3_relx+iwidth-parsedWidth-widthFix:winoffset+o3_relx):o3_fixx);}else{
+if(o3_hauto==1){if((o3_x-winoffset)>(iwidth/2)){o3_hpos=LEFT;}else{o3_hpos=RIGHT;}}
+if(o3_hpos==CENTER){placeX=o3_x+o3_offsetx-(parsedWidth/2);
+if(placeX<winoffset)placeX=winoffset;}
+if(o3_hpos==RIGHT){placeX=o3_x+o3_offsetx;
+if((placeX+parsedWidth)>(winoffset+iwidth-widthFix)){placeX=iwidth+winoffset-parsedWidth-widthFix;if(placeX<0)placeX=0;}}
+if(o3_hpos==LEFT){placeX=o3_x-o3_offsetx-parsedWidth;if(placeX<winoffset)placeX=winoffset;}
+if(o3_snapx>1){var snapping=placeX % o3_snapx;
+if(o3_hpos==LEFT){placeX=placeX-(o3_snapx+snapping);}else{
+placeX=placeX+(o3_snapx-snapping);}
+if(placeX<winoffset)placeX=winoffset;}}
+return placeX;}
+function verticalPlacement(browserHeight,verticalScrollAmount){var placeY,iheight=browserHeight,scrolloffset=verticalScrollAmount;var parsedHeight=(o3_aboveheight?parseInt(o3_aboveheight):(olNs4?over.clip.height:over.offsetHeight));
+if(o3_fixy>-1||o3_rely!=null){
+placeY=(o3_rely!=null?(o3_rely<0?scrolloffset+o3_rely+iheight-parsedHeight:scrolloffset+o3_rely):o3_fixy);}else{
+if(o3_vauto==1){if((o3_y-scrolloffset)>(iheight/2)&&o3_vpos==BELOW&&(o3_y+parsedHeight+o3_offsety-(scrolloffset+iheight)>0)){o3_vpos=ABOVE;}else if(o3_vpos==ABOVE&&(o3_y-(parsedHeight+o3_offsety)-scrolloffset<0)){o3_vpos=BELOW;}}
+if(o3_vpos==ABOVE){if(o3_aboveheight==0)o3_aboveheight=parsedHeight;
+placeY=o3_y-(o3_aboveheight+o3_offsety);if(placeY<scrolloffset)placeY=scrolloffset;}else{
+placeY=o3_y+o3_offsety;}
+if(o3_snapy>1){var snapping=placeY % o3_snapy;
+if(o3_aboveheight>0&&o3_vpos==ABOVE){placeY=placeY-(o3_snapy+snapping);}else{placeY=placeY+(o3_snapy-snapping);}
+if(placeY<scrolloffset)placeY=scrolloffset;}}
+return placeY;}
+function checkPositionFlags(){if(olHautoFlag)olHautoFlag=o3_hauto=0;if(olVautoFlag)olVautoFlag=o3_vauto=0;return true;}
+function windowWidth(){var w;if(o3_frame.innerWidth)w=o3_frame.innerWidth;else if(eval('o3_frame.'+docRoot)&&eval("typeof o3_frame."+docRoot+".clientWidth=='number'")&&eval('o3_frame.'+docRoot+'.clientWidth'))
+w=eval('o3_frame.'+docRoot+'.clientWidth');return w;}
+function createDivContainer(id,frm,zValue){id=(id||'overDiv'),frm=(frm||o3_frame),zValue=(zValue||1000);var objRef,divContainer=layerReference(id);
+if(divContainer==null){if(olNs4){divContainer=frm.document.layers[id]=new Layer(window.innerWidth,frm);objRef=divContainer;}else{var body=(olIe4?frm.document.all.tags('BODY')[0]:frm.document.getElementsByTagName("BODY")[0]);if(olIe4&&!document.getElementById){body.insertAdjacentHTML("beforeEnd",'<div id="'+id+'"></div>');divContainer=layerReference(id);}else{divContainer=frm.document.createElement("DIV");divContainer.id=id;body.appendChild(divContainer);}
+objRef=divContainer.style;}
+objRef.position='absolute';objRef.visibility='hidden';objRef.zIndex=zValue;if(olIe4&&!olOp)objRef.left=objRef.top='0px';else objRef.left=objRef.top=-10000+(!olNs4?'px':0);}
+return divContainer;}
+function layerReference(id){return(olNs4?o3_frame.document.layers[id]:(document.all?o3_frame.document.all[id]:o3_frame.document.getElementById(id)));}
+function isFunction(fnRef){var rtn=true;
+if(typeof fnRef=='object'){for(var i=0;i<fnRef.length;i++){if(typeof fnRef[i]=='function')continue;rtn=false;break;}
+}else if(typeof fnRef!='function'){rtn=false;}
+return rtn;}
+function argToString(array,strtInd,argName){var jS=strtInd,aS='',ar=array;argName=(argName?argName:'ar');
+if(ar.length>jS){for(var k=jS;k<ar.length;k++)aS+=argName+'['+k+'], ';aS=aS.substring(0,aS.length-2);}
+return aS;}
+function reOrder(hookPt,fnRef,order){var newPt=new Array(),match,i,j;
+if(!order||typeof order=='undefined'||typeof order=='number')return hookPt;
+if(typeof order=='function'){if(typeof fnRef=='object'){newPt=newPt.concat(fnRef);}else{newPt[newPt.length++]=fnRef;}
+for(i=0;i<hookPt.length;i++){match=false;if(typeof fnRef=='function'&&hookPt[i]==fnRef){continue;}else{for(j=0;j<fnRef.length;j++)if(hookPt[i]==fnRef[j]){match=true;break;}}
+if(!match)newPt[newPt.length++]=hookPt[i];}
+newPt[newPt.length++]=order;
+}else if(typeof order=='object'){if(typeof fnRef=='object'){newPt=newPt.concat(fnRef);}else{newPt[newPt.length++]=fnRef;}
+for(j=0;j<hookPt.length;j++){match=false;if(typeof fnRef=='function'&&hookPt[j]==fnRef){continue;}else{for(i=0;i<fnRef.length;i++)if(hookPt[j]==fnRef[i]){match=true;break;}}
+if(!match)newPt[newPt.length++]=hookPt[j];}
+for(i=0;i<newPt.length;i++)hookPt[i]=newPt[i];newPt.length=0;
+for(j=0;j<hookPt.length;j++){match=false;for(i=0;i<order.length;i++){if(hookPt[j]==order[i]){match=true;break;}}
+if(!match)newPt[newPt.length++]=hookPt[j];}
+newPt=newPt.concat(order);}
+hookPt=newPt;
+return hookPt;}
+function setRunTimeVariables(){if(typeof runTime!='undefined'&&runTime.length){for(var k=0;k<runTime.length;k++){runTime[k]();}}}
+function parseCmdLine(pf,i,args){if(typeof cmdLine!='undefined'&&cmdLine.length){for(var k=0;k<cmdLine.length;k++){var j=cmdLine[k](pf,i,args);if(j >-1){i=j;break;}}}
+return i;}
+function postParseChecks(pf,args){if(typeof postParse!='undefined'&&postParse.length){for(var k=0;k<postParse.length;k++){if(postParse[k](pf,args))continue;return false;}}
+return true;}
+function registerCommands(cmdStr){if(typeof cmdStr!='string')return;
+var pM=cmdStr.split(',');pms=pms.concat(pM);
+for(var i=0;i< pM.length;i++){eval(pM[i].toUpperCase()+'='+pmCount++);}}
+function registerNoParameterCommands(cmdStr){if(!cmdStr&&typeof cmdStr!='string')return;pmt=(!pmt)?cmdStr:pmt+','+cmdStr;}
+function registerHook(fnHookTo,fnRef,hookType,optPm){var hookPt,last=typeof optPm;
+if(fnHookTo=='plgIn'||fnHookTo=='postParse')return;if(typeof hookPts[fnHookTo]=='undefined')hookPts[fnHookTo]=new FunctionReference();
+hookPt=hookPts[fnHookTo];
+if(hookType!=null){if(hookType==FREPLACE){hookPt.ovload=fnRef;if(fnHookTo.indexOf('ol_content_')>-1)hookPt.alt[pms[CSSOFF-1-pmStart]]=fnRef;
+}else if(hookType==FBEFORE||hookType==FAFTER){var hookPt=(hookType==1?hookPt.before:hookPt.after);
+if(typeof fnRef=='object'){hookPt=hookPt.concat(fnRef);}else{hookPt[hookPt.length++]=fnRef;}
+if(optPm)hookPt=reOrder(hookPt,fnRef,optPm);
+}else if(hookType==FALTERNATE){if(last=='number')hookPt.alt[pms[optPm-1-pmStart]]=fnRef;}else if(hookType==FCHAIN){hookPt=hookPt.chain;if(typeof fnRef=='object')hookPt=hookPt.concat(fnRef);else hookPt[hookPt.length++]=fnRef;}
+return;}}
+function registerRunTimeFunction(fn){if(isFunction(fn)){if(typeof fn=='object'){runTime=runTime.concat(fn);}else{runTime[runTime.length++]=fn;}}}
+function registerCmdLineFunction(fn){if(isFunction(fn)){if(typeof fn=='object'){cmdLine=cmdLine.concat(fn);}else{cmdLine[cmdLine.length++]=fn;}}}
+function registerPostParseFunction(fn){if(isFunction(fn)){if(typeof fn=='object'){postParse=postParse.concat(fn);}else{postParse[postParse.length++]=fn;}}}
+function runHook(fnHookTo,hookType){var l=hookPts[fnHookTo],k,rtnVal=null,optPm,arS,ar=runHook.arguments;
+if(hookType==FREPLACE){arS=argToString(ar,2);
+if(typeof l=='undefined'||!(l=l.ovload))rtnVal=eval(fnHookTo+'('+arS+')');else rtnVal=eval('l('+arS+')');
+}else if(hookType==FBEFORE||hookType==FAFTER){if(typeof l!='undefined'){l=(hookType==1?l.before:l.after);
+if(l.length){arS=argToString(ar,2);for(var k=0;k<l.length;k++)eval('l[k]('+arS+')');}}
+}else if(hookType==FALTERNATE){optPm=ar[2];arS=argToString(ar,3);
+if(typeof l=='undefined'||(l=l.alt[pms[optPm-1-pmStart]])=='undefined'){rtnVal=eval(fnHookTo+'('+arS+')');}else{rtnVal=eval('l('+arS+')');}
+}else if(hookType==FCHAIN){arS=argToString(ar,2);l=l.chain;
+for(k=l.length;k>0;k--)if((rtnVal=eval('l[k-1]('+arS+')'))!=void(0))break;}
+return rtnVal;}
+function FunctionReference(){this.ovload=null;this.before=new Array();this.after=new Array();this.alt=new Array();this.chain=new Array();}
+function Info(version,prerelease){this.version=version;this.prerelease=prerelease;
+this.simpleversion=Math.round(this.version*100);this.major=parseInt(this.simpleversion/100);this.minor=parseInt(this.simpleversion/10)-this.major * 10;this.revision=parseInt(this.simpleversion)-this.major * 100-this.minor * 10;this.meets=meets;}
+function meets(reqdVersion){return(!reqdVersion)?false:this.simpleversion>=Math.round(100*parseFloat(reqdVersion));}
+registerHook("ol_content_simple",ol_content_simple,FALTERNATE,CSSOFF);registerHook("ol_content_caption",ol_content_caption,FALTERNATE,CSSOFF);registerHook("ol_content_background",ol_content_background,FALTERNATE,CSSOFF);registerHook("ol_content_simple",ol_content_simple,FALTERNATE,CSSCLASS);registerHook("ol_content_caption",ol_content_caption,FALTERNATE,CSSCLASS);registerHook("ol_content_background",ol_content_background,FALTERNATE,CSSCLASS);registerPostParseFunction(checkPositionFlags);registerHook("hideObject",nbspCleanup,FAFTER);registerHook("horizontalPlacement",horizontalPlacement,FCHAIN);registerHook("verticalPlacement",verticalPlacement,FCHAIN);if(olNs4||(olIe5&&isMac)||olKq)olLoaded=1;registerNoParameterCommands('sticky,autostatus,autostatuscap,fullhtml,hauto,vauto,closeclick,wrap,followmouse,mouseoff,compatmode');
+var olCheckMouseCapture=true;if((olNs4||olNs6||olIe4)){olMouseCapture();}else{overlib=no_overlib;nd=no_overlib;ver3fix=true;}
diff --git a/html/includes/sidebar.php b/html/includes/sidebar.php new file mode 100755 index 0000000..e62e292 --- /dev/null +++ b/html/includes/sidebar.php @@ -0,0 +1,27 @@ +<?php
+echo'
+<td Valign="top" width="120" class="sidebar">
+ <a href="http://www.unrealtournament.com/"><img src="images/utlogo.gif" title="UT Logo" alt="UT Logo" border="0"></a>
+ <br>
+ <p><a class="sidebar" href="./?p=">Home</a></p>
+ <p><a class="sidebar" href="./?p=recent">Recent Matches</a></p>
+ <p><a class="sidebar" href="./?p=rank">Rankings</a></p>
+ <p><a class="sidebar" href="./?p=servers">Servers</a></p>
+ <p><a class="sidebar" href="./?p=players">Players</a></p>
+ <p><a class="sidebar" href="./?p=maps">Maps</a></p>
+ <p><a class="sidebar" href="./?p=totals">Totals</a></p>
+ <p><a class="sidebar" href="./?p=watchlist">Watchlist</a></p>
+ <p><a class="sidebar" href="./import.php?'.str_rand().'='.str_rand().'">Import</a></p>
+ <p><a class="sidebar" href="./admin.php">Admin</a></p>
+ <p><a class="sidebar" href="./?p=credits">Credits</a></p>
+ <p><a class="sidebar" href="./?p=help">Help</a></p>
+ <p><a class="sidebar" href="http://www.unrealadmin.org/forums/forumdisplay.php?f=173" target="_blank">UTStats Forums</a></p>
+ <br>
+ <img src="images/characters/'.$charimg.'" title="UT Character" alt="UT Character" border="0">
+ <br>
+</td>
+<td>
+<img src="images/blankbar.gif" alt="Spacing" border="0" width="17" height="1"></td>
+<td align="center" valign="top">
+';
+?>
\ No newline at end of file diff --git a/html/includes/teamstats.php b/html/includes/teamstats.php new file mode 100755 index 0000000..66e53ab --- /dev/null +++ b/html/includes/teamstats.php @@ -0,0 +1,177 @@ +<?php
+function teamstats($mid, $title, $extra = NULL, $extratitle = NULL, $order = 'gamescore DESC') {
+ global $gamename, $gid;
+ $r_info = small_query("SELECT teamgame, t0score, t1score, t2score, t3score FROM uts_match WHERE id = '$mid'");
+ if (!$r_info) die("Match not found");
+ $teams = ($r_info['teamgame'] == 'True') ? true : false;
+ $teamscore[-1] = 0;
+ $teamscore[0] = $r_info['t0score'];
+ $teamscore[1] = $r_info['t1score'];
+ $teamscore[2] = $r_info['t2score'];
+ $teamscore[3] = $r_info['t3score'];
+
+
+ $cols = 10;
+ if ($teams) $cols++;
+ if ($extra) $cols++;
+
+ $oldteam = -1;
+
+
+ echo'
+ <table class = "box" border="0" cellpadding="0" cellspacing="2" width="600">
+ <tbody><tr>
+ <td class="heading" colspan="'.$cols.'" align="center">'.htmlentities($title).'</td>
+ </tr>';
+
+
+ $sql_players = "SELECT pi.name, pi.banned, p.pid, p.team, p.country, p.gametime, p.gamescore, p.frags, p.deaths, p.suicides, p.teamkills, p.eff, p.accuracy, p.ttl, p.rank".(($extra) ? ', p.'.$extra.' AS '.$extra : '')."
+ FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $mid
+ ORDER BY".(($teams) ? ' team ASC,' : '')." $order";
+ $q_players = mysql_query($sql_players) or die(mysql_error());
+ $header = true;
+ teamstats_init_totals($totals, $num);
+ while ($r_players = zero_out(mysql_fetch_array($q_players))) {
+ $r_players['dom_cp'] = $r_players['gamescore'] - $r_players['frags'];
+
+ $r_players['team'] = intval($r_players['team']);
+ if ($teams and $oldteam != $r_players['team']) {
+ if ($r_players['team'] != 0) teamstats_team_totals($totals, $num, $teams, $extra, $teamscore[$oldteam]);
+ $oldteam = $r_players['team'];
+ teamstats_init_totals($totals, $num, $extra);
+
+ switch(intval($r_players['team'])) {
+ case 0: $teamname = 'Red'; break;
+ case 1: $teamname = 'Blue'; break;
+ case 2: $teamname = 'Green'; break;
+ case 3: $teamname = 'Gold'; break;
+ }
+ echo'<tr><td class="hlheading" colspan="'.$cols.'" align="center">Team: '.$teamname.'</td></tr>';
+ $header = true;
+ }
+ if ($header) {
+ $header = false;
+ echo '
+ <tr>
+ <td class="smheading" align="center">Player</td>
+ <td class="smheading" align="center" width="50">Time</td>
+ <td class="smheading" align="center" width="50">Score</td>';
+ if ($extra) echo' <td class="smheading" align="center" width="50">'.htmlentities($extratitle).'</td>';
+ echo'
+ <td class="smheading" align="center" width="40" '.OverlibPrintHint('F').'>F</td>
+ <td class="smheading" align="center" width="40" '.OverlibPrintHint('K').'>K</td>
+ <td class="smheading" align="center" width="40" '.OverlibPrintHint('D').'>D</td>
+ <td class="smheading" align="center" width="40" '.OverlibPrintHint('S').'>S</td>';
+ if ($teams) echo '<td class="smheading" align="center" width="40" '.OverlibPrintHint('TK').'>TK</td>';
+ echo '
+ <td class="smheading" align="center" width="55" '.OverlibPrintHint('EFF').'>Eff.</td>
+ <td class="smheading" align="center" width="55" '.OverlibPrintHint('ACC').'>Acc.</td>
+ <td class="smheading" align="center" width="50" '.OverlibPrintHint('TTL').'>Avg TTL</td>
+ </tr>';
+ }
+
+ $eff = get_dp($r_players['eff']);
+ $acc = get_dp($r_players['accuracy']);
+ $ttl = GetMinutes($r_players['ttl']);
+ $kills = $r_players['frags'] + $r_players['suicides'];
+ $pname = $r_players['name'];
+
+ $totals['gamescore'] += $r_players['gamescore'];
+ if ($extra) $totals[$extra] += $r_players[$extra];
+ $totals['frags'] += $r_players['frags'];
+ $totals['kills'] += $kills;
+ $totals['deaths'] += $r_players['deaths'];
+ $totals['suicides'] += $r_players['suicides'];
+ $totals['teamkills'] += $r_players['teamkills'];
+ $totals['eff'] += $r_players['eff'];
+ $totals['acc'] += $r_players['accuracy'];
+ $totals['ttl'] += $r_players['ttl'];
+ $num++;
+
+ if ($r_players['banned'] == 'Y') {
+ $eff = '-';
+ $acc = '-';
+ $ttl = '-';
+ $kills = '-';
+ $r_players['gamescore'] = '-';
+ $r_players[$extra] = '-';
+ $r_players['frags'] = '-';
+ $r_players['deaths'] = '-';
+ $r_players['suicides'] = '-';
+ $r_players['teamkills'] = '-';
+ }
+
+
+ $class = ($num % 2) ? 'grey' : 'grey2';
+ echo '<tr>';
+ if ($r_players['banned'] != 'Y') {
+ echo '<td nowrap class="darkhuman" align="left"><a class="darkhuman" href="./?p=matchp&mid='.$mid.'&pid='.$r_players['pid'].'">'.FormatPlayerName($r_players['country'], $r_players['pid'], $r_players['name'], $gid, $gamename, true, $r_players['rank']).'</a></td>';
+ } else {
+ echo '<td nowrap class="darkhuman" align="left"><span style="text-decoration: line-through;">'.FormatPlayerName($r_players['country'], $r_players['pid'], $r_players['name'], $gid, $gamename, true, $r_players['rank']).'</span></td>';
+ }
+ echo '<td class="'.$class.'" align="center">'.GetMinutes($r_players[gametime]).'</td>';
+ echo '<td class="'.$class.'" align="center">'.$r_players[gamescore].'</td>';
+
+ if ($extra) echo '<td class="'.$class.'" align="center">'.$r_players[$extra].'</td>';
+
+ echo '<td class="'.$class.'" align="center">'.$r_players[frags].'</td>';
+ echo '<td class="'.$class.'" align="center">'.$kills.'</td>';
+ echo '<td class="'.$class.'" align="center">'.$r_players[deaths].'</td>';
+ echo '<td class="'.$class.'" align="center">'.$r_players[suicides].'</td>';
+
+ if ($teams) echo '<td class="'.$class.'" align="center">'.$r_players[teamkills].'</td>';
+
+ echo '<td class="'.$class.'" align="center">'.$eff.'</td>';
+ echo '<td class="'.$class.'" align="center">'.$acc.'</td>';
+ echo '<td class="'.$class.'" align="center">'.$ttl.'</td>';
+ echo '</tr>';
+ }
+ teamstats_team_totals($totals, $num, $teams, $extra, $teamscore[$oldteam]);
+ echo '</tbody></table><br>';
+
+}
+
+function teamstats_init_totals(&$totals, &$num, $extra = null) {
+ $totals['gamescore'] = 0;
+ if ($extra) $totals[$extra] = 0;
+ $totals['frags'] = 0;
+ $totals['kills'] = 0;
+ $totals['deaths'] = 0;
+ $totals['suicides'] = 0;
+ $totals['teamkills'] = 0;
+ $totals['eff'] = 0;
+ $totals['acc'] = 0;
+ $totals['ttl'] = 0;
+ $num = 0;
+}
+
+function teamstats_team_totals(&$totals, $num, $teams, $extra, $teamscore) {
+ if ($num == 0) $num = 1;
+ $eff = get_dp($totals['eff'] / $num);
+ $acc = get_dp($totals['acc'] / $num);
+ $ttl = GetMinutes($totals['ttl'] / $num);
+
+
+ echo '<tr>';
+ echo '<td nowrap class="dark" align="center">Totals</td>';
+ echo '<td class="darkgrey" align="center"></td>';
+ if ($teams) {
+ echo '<td class="darkgrey" align="center"><strong>'.$teamscore.'</strong> ('.$totals[gamescore].')</td>';
+ } else {
+ echo '<td class="darkgrey" align="center">'.$totals[gamescore].'</td>';
+ }
+ if ($extra) echo '<td class="darkgrey" align="center">'.$totals[$extra].'</td>';
+
+ echo '<td class="darkgrey" align="center">'.$totals[frags].'</td>';
+ echo '<td class="darkgrey" align="center">'.$totals[kills].'</td>';
+ echo '<td class="darkgrey" align="center">'.$totals[deaths].'</td>';
+ echo '<td class="darkgrey" align="center">'.$totals[suicides].'</td>';
+
+ if ($teams) echo '<td class="darkgrey" align="center">'.$totals[teamkills].'</td>';
+
+ echo '<td class="darkgrey" align="center">'.$eff.'</td>';
+ echo '<td class="darkgrey" align="center">'.$acc.'</td>';
+ echo '<td class="darkgrey" align="center">'.$ttl.'</td>';
+ echo '</tr>';
+}
+?>
diff --git a/html/includes/weaponstats.php b/html/includes/weaponstats.php new file mode 100755 index 0000000..872fa5a --- /dev/null +++ b/html/includes/weaponstats.php @@ -0,0 +1,216 @@ +<?php
+function weaponstats($_mid, $_pid, $title = 'Weapons Summary') {
+ global $gamename, $gid;
+
+ $sql_weapons = "SELECT w.matchid,
+ w.pid AS playerid,
+ w.weapon,
+ w.kills,
+ w.shots,
+ w.hits,
+ w.damage,
+ w.acc,
+ pi.name AS playername,
+ pi.country AS country,
+ pi.banned AS banned,
+ wn.id AS weaponid,
+ wn.name AS weaponname,
+ wn.image AS weaponimg,
+ wn.sequence AS sequence
+ FROM uts_weapons AS wn,
+ uts_weaponstats AS w
+ LEFT JOIN uts_pinfo AS pi
+ ON w.pid = pi.id
+ WHERE w.matchid = '$_mid'
+ AND w.pid = '$_pid'
+ AND (wn.id = w.weapon)
+ AND wn.hide <> 'Y'";
+
+
+ if ($_pid == 0 and $_mid != 0) {
+ $sql_weapons = "SELECT w.matchid,
+ w.pid AS playerid,
+ w.weapon,
+ SUM(w.kills) AS kills,
+ SUM(w.shots) AS shots,
+ SUM(w.hits) AS hits,
+ SUM(w.damage) AS damage,
+ AVG(w.acc) AS acc,
+ pi.name AS playername,
+ pi.country AS country,
+ pi.banned AS banned,
+ wn.id AS weaponid,
+ wn.name AS weaponname,
+ wn.image AS weaponimg,
+ wn.sequence AS sequence,
+ wn.hide AS hideweapon
+FROM uts_weapons AS wn,
+uts_weaponstats AS w
+ LEFT JOIN uts_pinfo AS pi
+ ON w.pid = pi.id
+ WHERE w.matchid = '$_mid'
+ AND (wn.id = w.weapon)
+ AND wn.hide <> 'Y'
+ GROUP BY w.pid,
+ w.weapon";
+ }
+
+ $q_weapons = mysql_query($sql_weapons) or die(mysql_error());
+ while ($r_weapons = zero_out(mysql_fetch_array($q_weapons))) {
+ $weaponid = intval($r_weapons['weaponid']);
+ $playerid = intval($r_weapons['playerid']);
+ // Don't include banned players
+ if ($r_weapons['banned'] != 'Y') $psort[$playerid] = strtolower($r_weapons['playername']);
+
+ if ($r_weapons['damage'] > 1000000) $r_weapons['damage'] = round($r_weapons['damage'] / 1000, 0) .'K';
+// if ($r_weapons['damage'] > 1000) $r_weapons['damage'] = round($r_weapons['damage'] / 1000, 0) .'K';
+
+ $wd[$playerid]['playername'] = $r_weapons['playername'];
+ $wd[$playerid]['country'] = $r_weapons['country'];
+ $wd[$playerid]['banned'] = $r_weapons['banned'];
+ $wd[$playerid][$weaponid]['kills'] = $r_weapons['kills'];
+ $wd[$playerid][$weaponid]['shots'] = $r_weapons['shots'];
+ $wd[$playerid][$weaponid]['hits'] = $r_weapons['hits'];
+ $wd[$playerid][$weaponid]['damage'] = $r_weapons['damage'];
+ $wd[$playerid][$weaponid]['acc'] = ((!empty($r_weapons['acc'])) ? get_dp($r_weapons['acc']) : '');
+
+ if (!isset($wsort[$weaponid]) and $r_weapons['hideweapon'] != 'Y') {
+ $wsort[$weaponid] = intval($r_weapons['sequence']);
+ $weapons[$weaponid]['name'] = $r_weapons['weaponname'];
+ $weapons[$weaponid]['image'] = $r_weapons['weaponimg'];
+ $weapons[$weaponid]['sequence'] = $r_weapons['sequence'];
+ }
+ }
+ if (!isset($psort)) return;
+
+ asort($psort);
+ asort($wsort);
+
+ $playercol = 1;
+ if (count($wsort) < 3) {
+ $one = true;
+ $colspan = 5;
+ if (count($psort) == 1) {
+ $playercol = 0;
+ }
+ } else {
+ $one = false;
+ $colspan = 1;
+ }
+
+ echo'
+ <table class = "box" border="0" cellpadding="0" cellspacing="2">
+ <tbody>
+ <tr>
+ <td class="heading" colspan="'. ((count($wsort) * $colspan) + $playercol) .'" align="center">'.htmlentities($title).'</td>
+ </tr>';
+
+
+ if ($one) {
+ ws_header($wsort, $weapons, $colspan, $one, $playercol);
+ echo '<tr>';
+ foreach($wsort as $wid => $bar) {
+ for ($i = 1; $i <= $colspan; $i++) {
+ switch($i) {
+ case 1: $extra = 'Kills'; break;
+ case 2: $extra = 'Shots'; break;
+ case 3: $extra = 'Hits'; break;
+ case 4: $extra = 'Acc'; break;
+ case 5: $extra = 'Dmg'; break;
+ }
+ $extra = '<span style="font-size: 100%">'. $extra .'</span>';
+ echo '
+ <td class="smheading" align="center" width="35">'.$extra.'</td>';
+ }
+ }
+ echo '</tr>';
+
+ $i = 0;
+ foreach($psort as $pid => $foo) {
+ $i++;
+ echo '<tr>';
+ if ($playercol) {
+ echo '
+ <td nowrap class="darkhuman" align="left"><a class="darkhuman" href="./?p=matchp&mid='.$_mid.'&pid='.urlencode($pid).'">'.FormatPlayerName($wd[$pid]['country'], $pid, $wd[$pid]['playername'], $gid, $gamename).'</a></td>';
+ }
+ foreach($wsort as $wid => $bar) {
+ ws_cell($wd, $pid, $wid, 'kills', $i);
+ ws_cell($wd, $pid, $wid, 'shots', $i);
+ ws_cell($wd, $pid, $wid, 'hits', $i);
+ ws_cell($wd, $pid, $wid, 'acc', $i);
+ ws_cell($wd, $pid, $wid, 'damage', $i);
+ }
+ echo '</tr>';
+ }
+ }
+
+ if (!$one) {
+ ws_block($wd, $weapons, $wsort, $psort, $colspan, $playercol, $one, $_mid, $gamename, 'Kills', 'kills');
+ ws_block($wd, $weapons, $wsort, $psort, $colspan, $playercol, $one, $_mid, $gamename, 'Shots', 'shots');
+ ws_block($wd, $weapons, $wsort, $psort, $colspan, $playercol, $one, $_mid, $gamename, 'Hits', 'hits');
+ ws_block($wd, $weapons, $wsort, $psort, $colspan, $playercol, $one, $_mid, $gamename, 'Damage', 'damage');
+ ws_block($wd, $weapons, $wsort, $psort, $colspan, $playercol, $one, $_mid, $gamename, 'Accuracy', 'acc');
+ }
+
+
+ echo '</tbody></table>';
+}
+
+function ws_header(&$wsort, &$weapons, $colspan, $one, $playercol) {
+ echo '<tr>';
+ if ($playercol and $playercol != -1) echo '<td class="smheading" align="center" width="150" '.(($one) ? 'rowspan="2"' : '') .'>Player</td>';
+ if ($playercol == -1) echo '<td class="smheading" align="center" width="150"> </td>';
+ foreach($wsort as $wid => $bar) {
+ if (!empty($weapons[$wid]['image'])) {
+ $content = '<img border="0" src="images/weapons/'.$weapons[$wid]['image'].'" alt="'.$weapons[$wid]['name'].'" title="'.$weapons[$wid]['name'].'">';
+ } else {
+ $content = '<span style="font-size: 60%;">'.$weapons[$wid]['name'].'</span>';
+ }
+ echo '<td class="smheading" align="center" '. (($one) ? 'colspan="'.$colspan.'"' : 'width="35"') .'>'.$content.'</td>';
+
+ }
+ echo '</tr>';
+}
+
+
+function ws_cell(&$wd, $pid, $wid, $field, $i) {
+ $content = '';
+ if (isset($wd[$pid][$wid][$field])) $content = $wd[$pid][$wid][$field];
+ $class = ($i % 2) ? 'grey' : 'grey2';
+ echo '
+ <td class="'.$class.'" align="center">'.$content.'</td>';
+}
+
+
+
+
+function ws_block(&$wd, &$weapons, &$wsort, &$psort, &$colspan, $playercol, $one,$_mid, $gamename, $caption, $field) {
+ global $gamename, $gid;
+ if (count($psort) != 1) {
+ echo '
+ <tr>
+ <td height="5" colspan="'. ((count($wsort) * $colspan) + $playercol) .'" align="center"></td>
+ </tr>
+ <tr>
+ <td class="smheading" height="20" colspan="'. ((count($wsort) * $colspan) + $playercol) .'" align="center">'.$caption.'</td>
+ </tr>';
+ ws_header($wsort, $weapons, $colspan, $one, $playercol);
+ }
+ if (count($psort) == 1) {
+ $playercol = -1;
+ if ($field == 'kills') ws_header($wsort, $weapons, $colspan, $one, $playercol);
+ }
+
+ $i = 0;
+ foreach($psort as $pid => $foo) {
+ $i++;
+ echo '<tr>';
+ if ($playercol and $playercol != -1) echo '<td nowrap class="darkhuman" align="left"><a class="darkhuman" href="./?p=matchp&mid='.$_mid.'&pid='.urlencode($pid).'">'.FormatPlayerName($wd[$pid]['country'], $pid, $wd[$pid]['playername'], $gid, $gamename).'</a></td>';
+ if ($playercol == -1) echo '<td nowrap class="dark" align="center">'.$caption.'</td>';
+ foreach($wsort as $wid => $bar) {
+ ws_cell($wd, $pid, $wid, $field, $i);
+ }
+ echo '</tr>';
+ }
+}
+?>
\ No newline at end of file diff --git a/html/index.php b/html/index.php new file mode 100755 index 0000000..4b12de6 --- /dev/null +++ b/html/index.php @@ -0,0 +1,156 @@ +<?php
+include ("includes/config.php");
+include ("includes/functions.php");
+if (!isset($_GET['noheader'])) include ("includes/header.php");
+
+switch ($_GET["p"])
+
+{
+ case "": page(); break; // Our opening page
+
+ case "recent": recent(); break; // list of recent games, 30 in date order
+ case "match": match(); break; // Single Match stats
+ case "matchp": matchp(); break; // Player stats for single match
+ case "report": report(); break; // Report generator
+
+ case "rank": rank(); break; // Rankings
+ case "ext_rank": ext_rank(); break; // Extended rankings
+
+ case "servers": servers(); break; // Server listings
+ case "sinfo": sinfo(); break; // Server info
+ case "squery": squery(); break; // Server query page
+
+ case "players": players(); break; // Players list
+ case "psearch": psearch(); break; // Player search
+ case "pinfo": pinfo(); break; // Player info
+ case "pexplrank": pexplrank(); break; // Explain ranking
+
+ case "maps": maps(); break; // Maps list
+ case "minfo": minfo(); break; // Map info
+
+ case "totals": totals(); break; // Totals summary
+
+ case "watchlist": watchlist(); break; // The viewer's watchlist
+
+ case "credits": credits(); break; // Credits
+ case "help": help(); break; // Help Page
+ default : page(); break; // Our opening page
+}
+
+function page()
+{
+ include("pages/home.php");
+}
+
+function admin()
+{
+ include("admin.php");
+}
+
+function recent()
+{
+ include("pages/recent.php");
+}
+
+function match()
+{
+ include("pages/match.php");
+}
+
+function matchp()
+{
+ include("pages/match_player.php");
+}
+
+function report()
+{
+ include("pages/report.php");
+}
+
+function rank()
+{
+ include("pages/rank.php");
+}
+
+function ext_rank()
+{
+ include("pages/rank_extended.php");
+}
+
+function servers()
+{
+ include("pages/servers.php");
+}
+
+function sinfo()
+{
+ include("pages/servers_info.php");
+}
+
+function squery()
+{
+ include("pages/servers_query.php");
+}
+
+function players()
+{
+ include("pages/players.php");
+}
+
+function psearch()
+{
+ include("pages/players_search.php");
+}
+
+function pinfo()
+{
+ include("pages/players_info.php");
+}
+
+function pexplrank()
+{
+ include("pages/players_explain_ranking.php");
+}
+
+function pmatchs()
+{
+ include("pages/players_matchs.php");
+}
+
+function pmaps()
+{
+ include("pages/players_maps.php");
+}
+
+function maps()
+{
+ include("pages/maps.php");
+}
+
+function minfo()
+{
+ include("pages/maps_info.php");
+}
+
+function totals()
+{
+ include("pages/totals.php");
+}
+
+function watchlist()
+{
+ include("pages/watchlist.php");
+}
+
+function credits()
+{
+ include("pages/credits.php");
+}
+
+function help()
+{
+ include("pages/help.php");
+}
+
+include("includes/footer.php");
+?>
\ No newline at end of file diff --git a/html/logs/ac/index.htm b/html/logs/ac/index.htm new file mode 100755 index 0000000..c217ab3 --- /dev/null +++ b/html/logs/ac/index.htm @@ -0,0 +1,8 @@ +<html> + <head> + <title></title> + <meta content=""> + <style></style> + </head> + <body></body> +</html>
\ No newline at end of file diff --git a/html/logs/ace/index.htm b/html/logs/ace/index.htm new file mode 100755 index 0000000..c217ab3 --- /dev/null +++ b/html/logs/ace/index.htm @@ -0,0 +1,8 @@ +<html> + <head> + <title></title> + <meta content=""> + <style></style> + </head> + <body></body> +</html>
\ No newline at end of file diff --git a/html/logs/backup/.htaccess b/html/logs/backup/.htaccess new file mode 100755 index 0000000..fdda703 --- /dev/null +++ b/html/logs/backup/.htaccess @@ -0,0 +1,2 @@ +Order deny,allow +Deny from all diff --git a/html/logs/backup/index.htm b/html/logs/backup/index.htm new file mode 100755 index 0000000..e69de29 --- /dev/null +++ b/html/logs/backup/index.htm diff --git a/html/logs/index.htm b/html/logs/index.htm new file mode 100755 index 0000000..e69de29 --- /dev/null +++ b/html/logs/index.htm diff --git a/html/logs/utdc/.htaccess b/html/logs/utdc/.htaccess new file mode 100755 index 0000000..fdda703 --- /dev/null +++ b/html/logs/utdc/.htaccess @@ -0,0 +1,2 @@ +Order deny,allow +Deny from all diff --git a/html/logs/utdc/index.htm b/html/logs/utdc/index.htm new file mode 100755 index 0000000..e69de29 --- /dev/null +++ b/html/logs/utdc/index.htm diff --git a/html/pages/admin/acelog.php b/html/pages/admin/acelog.php new file mode 100755 index 0000000..365174a --- /dev/null +++ b/html/pages/admin/acelog.php @@ -0,0 +1,318 @@ +<?php
+if (empty($import_adminkey) or isset($_REQUEST['import_adminkey']) or $import_adminkey != $adminkey) die('Access denied');
+
+$filename = (!empty($_REQUEST['filename'])) ? my_stripslashes($_REQUEST['filename']) : '';
+$filename = str_replace(array('..', '/', '\\', '<', ':'), array(), $filename);
+
+function InvertSort($curr_field, $order, $sort) {
+ if ($curr_field != $order) return(($curr_field == "time") ? "DESC" : "ASC");
+ if ($sort == 'ASC') return('DESC');
+ return('ASC');
+}
+
+function SortPic($curr_field, $order, $sort) {
+ if ($curr_field != $order) return;
+ $fname = 'images/s_'. strtolower($sort) .'.png';
+ if (!file_exists($fname)) return;
+ return(' <img src="'. $fname .'" border="0" width="11" height="9" alt="" title="('.strtolower($sort).'ending)">');
+}
+
+// Get filter, order and set sorting
+if (isset($_GET[order])) {
+ $order = my_addslashes($_GET[order]);
+ setcookie('uts_ace_order', $_GET['order'], time()+60*60*24*30*365);
+}
+else if (isset($_COOKIE['uts_ace_order'])){
+ $order = $_REQUEST['uts_ace_order'];
+}
+else {
+ $order = "time";
+}
+
+if (isset($_GET[sort])) {
+ $sort = my_addslashes($_GET[sort]);
+ setcookie('uts_ace_sort', $_GET['sort'], time()+60*60*24*30*365);
+}
+else if (isset($_COOKIE['uts_ace_sort'])){
+ $sort = $_REQUEST['uts_ace_sort'];
+}
+else {
+ $sort = ($order == "time") ? "DESC" : "ASC";
+}
+
+if (isset($_GET[timeout])) {
+ $timeout = my_addslashes($_GET[timeout]);
+ setcookie('uts_ace_timeout', $_GET['timeout'], time()+60*60*24*30*365);
+}
+else if (isset($_COOKIE['uts_ace_timeout'])){
+ $timeout = $_REQUEST['uts_ace_timeout'];
+}
+else {
+ $timeout = 0;
+}
+
+if (isset($_GET[show])) {
+ $show = my_addslashes($_GET[show]);
+ setcookie('uts_ace_show', $_GET['show'], time()+60*60*24*30*365);
+}
+else if (isset($_COOKIE['uts_ace_show'])){
+ $show = $_REQUEST['uts_ace_show'];
+}
+else {
+ $show = "week";
+}
+
+if (!empty($filename)) {
+ if (!file_exists('logs/ace/'. $filename) or !is_file('logs/ace/'. $filename)) die('File not found');
+ if (isset($_REQUEST['del'])) {
+ unlink('logs/ace/'. $filename);
+ $filename = '';
+ }
+}
+
+if (empty($filename)) {
+ echo '
+
+ <script language = "javascript">
+
+ function timefilter() {
+ var filter = document.filter.show.value;
+ window.open("admin.php?key='.$adminkey.'&action='.$action.'&show="+filter, "_parent");
+ }
+
+ function toggletimeouts() {
+ if (document.filter.timeouts.checked == true) {
+ window.open("admin.php?key='.$adminkey.'&action='.$action.'&timeout=1", "_parent");
+ }
+ else {
+ window.open("admin.php?key='.$adminkey.'&action='.$action.'&timeout=0", "_parent");
+ }
+ }
+ </script>
+ <form name = "filter">
+ <table class = "box" border="0" cellpadding="1" cellspacing="2" width="720">
+ <tr>
+ <td class="heading" align="center" width="100%" colspan="5">Available ACE Logs:</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center" width="100%" colspan = "5">Filter:
+ <select onchange = "javascript:timefilter()" name = "show">
+ <option value = "all"'.($show == "all" ? ' selected=selected' : '').'>All</option>
+ <option value = "day"'.($show == "day" ? ' selected=selected' : '').'>Last day</option>
+ <option value = "week"'.($show == "week" ? ' selected=selected' : '').'>Last week</option>
+ <option value = "month"'.($show == "month" ? ' selected=selected' : '').'>Last month</option>
+ </select>
+ <input name = "timeouts" type = "checkbox" value = 1 onchange = "javascript:toggletimeouts()"'.($timeout == 1 ? ' checked="yes"' : '').'> Show timeouts</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center"><a class="smheading" href="admin.php?key='.$adminkey.'&action='.$action.'&order=time&sort='.InvertSort('time', $order, $sort).'">Time</a>'.SortPic('time', $order, $sort).'</td>
+ <td class="smheading" align="center"><a class="smheading" href="admin.php?key='.$adminkey.'&action='.$action.'&order=name&sort='.InvertSort('name', $order, $sort).'">Player Name</a>'.SortPic('name', $order, $sort).'</td>
+ <td class="smheading" align="center"><a class="smheading" href="admin.php?key='.$adminkey.'&action='.$action.'&order=reason&sort='.InvertSort('reason', $order, $sort).'">Kick Reason</a>'.SortPic('reason', $order, $sort).'</td>
+ <td class="smheading" align="center" colspan = 2></td>
+ </tr>';
+ $logdir = opendir('logs/ace');
+ $logs = array();
+ $sortlogs = array();
+ $i = 0;
+ while (false !== ($filename = readdir($logdir))) {
+ if (!is_file('logs/ace/'. $filename)) continue;
+ if ($filename == '.htaccess' or $filename == 'index.htm') continue;
+
+ preg_match('/\d{4}\.\d{2}.\d{2}.\d{2}.\d{2}.\d{2}/', $filename, &$date);
+ $adate = preg_split('/\./', $date[0]);
+ // filter on days
+ if ($show != "all") {
+ // calculate days
+ $logAgeInDays = abs(strtotime(date("Y/m/d")) - strtotime("$adate[0]/$adate[1]/$adate[2]"))/68400-1;
+ if (($show == "day" and $logAgeInDays > 1)
+ or ($show == "week" and $logAgeInDays > 7)
+ or ($show == "month" and $logAgeInDays > 31)) {
+ continue;
+ }
+ }
+
+ $i++;
+ $TimeStamp = "unknown";
+ $PlayerName = "unknown";
+ $KickReason = "unknown";
+ if (substr($filename, strlen($filename) - strlen($import_ace_screenshot_extension)) == $import_ace_screenshot_extension
+ and substr($filename, 0, strlen($import_ace_screenshot_start)) == $import_ace_screenshot_start) {
+ // Screenshot
+ $TimeStamp = "$adate[2]-$adate[1]-$adate[0] / $adate[3]:$adate[4]:$adate[5]";
+ $PlayerName = "Unknown";
+ $KickReason = "Screenshot";
+ }
+ else {
+ // logfile
+
+ $fp = my_fopen('logs/ace/'.$filename, 'rb', $compression = NULL);
+ if (!$fp) die("Error opening file");
+
+ while (($line = my_fgets($fp, 5000, $compression)) !== FALSE) {
+ $info = preg_split('/\s/', $line, 3);
+ $info[2] = preg_replace('/[\r\n]+/', '', $info[2]);
+ if ($info[1] == "TimeStamp....:") {
+ $TimeStamp = $info[2];
+ }
+ else if ($info[1] == "PlayerName...:") {
+ $PlayerName = $info[2];
+ }
+ else if ($info[1] == "KickReason...:") {
+ $KickReason = $info[2];
+ }
+ else if ($info[1] == "RequestedBy..:") {
+ $KickReason = "Requested Screenshot";
+ }
+ else if ($info[1] == "WARNING:") {
+ $ainfo = preg_split('/\s/', $info[2]);
+ if ($ainfo[5] == "UDP") {
+ $TimeStamp = "$adate[2]-$adate[1]-$adate[0] / $adate[3]:$adate[4]:$adate[5]";
+ $PlayerName = $ainfo[1];
+ $KickReason = "Proxy/Tunnel";
+ }
+ }
+ else if ($info[2] == ": Kicked - [REASON] Timeout during check spawn") {
+ $TimeStamp = "$adate[2]-$adate[1]-$adate[0] / $adate[3]:$adate[4]:$adate[5]";
+ $PlayerName = preg_replace('/[\[\]]/', '', $info[1]);
+ $KickReason = "Timeout during check spawn";
+ }
+ }
+ my_fclose($fp, $compression);
+ }
+
+ // don't show timeout logs?
+ if (($timeout == 0)
+ and (($KickReason == "Timeout during check spawn")
+ or ($KickReason == "Timeout during checks")
+ or ($KickReason == "Timeout during initial check"))) {
+ continue;
+ }
+
+ $logs[$i] = array($filename, $TimeStamp, $PlayerName, $KickReason);
+ $extra = 0;
+ if (substr($filename, -4) == '.bz2') $extra = 4;
+ if (substr($filename, -3) == '.gz') $extra = 3;
+
+ if ($order == "time") {
+ $sortlogs[$i] = $date[0];
+ }
+ else if ($order == "name") {
+ $sortlogs[$i] = strtolower($PlayerName);
+ }
+ else if ($order == "reason") {
+ $sortlogs[$i] = strtolower($KickReason);
+ }
+ }
+ closedir($logdir);
+ if (count($logs) == 0) {
+ echo '<tr><td class="grey" colspan="5">No logs available!</td></tr>';
+ } else {
+ if ($sort == "ASC") {
+ asort($sortlogs);
+ }
+ else {
+ arsort($sortlogs);
+ }
+ $i = 0;
+ foreach($sortlogs as $id => $date) {
+ $log = $logs[$id][0];
+ if (empty($log)) {
+ continue;
+ }
+ $TimeStamp = $logs[$id][1];
+ $PlayerName = $logs[$id][2];
+ $KickReason = $logs[$id][3];
+ $Screenshot = $logs[$id][4];
+ $extra = 0;
+ if (substr($log, -4) == '.bz2') $extra = 4;
+ if (substr($log, -3) == '.gz') $extra = 3;
+
+ $i++;
+ $class = ($i%2) ? 'grey' : 'grey2';
+ echo '<tr><td class="'.$class.'">';
+ $tmp = substr($log, strlen($log) - (23 + $extra), 19);
+ $tmp = str_replace('.', '', $tmp);
+ // $ts = mtimestamp($tmp);
+ echo ' <a class="'.$class.'" href="admin.php?key='.$adminkey.'&action='.$action.'&filename='.urlencode($log).'">'.$TimeStamp.'</a>';
+ echo '</td><td class="'.$class.'">';
+ echo '<a class="'.$class.'" href="admin.php?key='.$adminkey.'&action='.$action.'&filename='.urlencode($log).'">'.$PlayerName.'</a>';
+ echo '</td><td class="'.$class.'">';
+ echo '<a class="'.$class.'" href="admin.php?key='.$adminkey.'&action='.$action.'&filename='.urlencode($log).'">'.$KickReason.'</a>';
+ echo '</td><td class="'.$class.'" align="right">';
+ $d_size = file_size_info(filesize('logs/ace/'. $log));
+ echo $d_size['size'] .' '. $d_size['type'];
+ echo '</td><td class="'.$class.'" align="center">';
+ echo '<a href="admin.php?key='.$adminkey.'&action='.$action.'&filename='.urlencode($log).'&del=1"><img src="images/del.png" border="0" width="16" height="16" title="Delete" alt="Delete" /></a>';
+ echo '</td></tr>';
+ }
+ }
+ echo '</form>';
+}
+
+
+if (!empty($filename)) {
+ if (!file_exists('logs/ace/'. $filename) or !is_file('logs/ace/'. $filename)) die('File not found (2)');
+ echo'<br><table class = "box" border="0" cellpadding="1" cellspacing="2" width="720">
+ <tr>
+ <td class="smheading" align="center" width="95%" colspan="4">'.$filename.'</td>
+ <td class="smheading" align="center" width="5%" align="right">';
+ echo '<a href="admin.php?key='.$adminkey.'&action='.$action.'&filename='.urlencode($filename).'&del=1"><img src="images/del.png" border="0" width="16" height="16" title="Delete" alt="Delete" /></a>';
+ echo '</td>
+ </tr>';
+ if (substr($filename, strlen($filename) - strlen($import_ace_screenshot_extension)) == $import_ace_screenshot_extension
+ and substr($filename, 0, strlen($import_ace_screenshot_start)) == $import_ace_screenshot_start) {
+ // screenshot
+ echo '<tr><td class="grey" colspan="5"><span style="font-family: monospace;">';
+ echo '<a href = "logs/ace/'.preg_replace('/\+/', '%20', urlencode($filename)).'" target = "_blank"><img src = "logs/ace/'.preg_replace('/\+/', '%20', urlencode($filename)).'" width = 100% border = 0></a>';
+ echo '</span></td></tr>';
+ }
+ else {
+ $fp = my_fopen('logs/ace/'.$filename, 'rb', $compression = NULL);
+ if (!$fp) die("Error opening file");
+
+ $i = 0;
+ echo '<tr><td class="grey" colspan="5"><span style="font-family: monospace;">';
+
+ while (($line = my_fgets($fp, 5000, $compression)) !== FALSE) {
+ /*
+ $i++;
+ $class = ($i%2) ? 'grey' : 'grey2';
+ echo '<tr><td class="'.$class.'" colspan="4">';
+ echo '<span style="font-family: monospace;">';
+ echo htmlentities($line);
+ echo '</span>';
+ echo '</td></tr>';
+ */
+ echo wordwrap(htmlentities($line), 80, '<br />', 1) ."<br />";
+ $info = preg_split('/\s/', $line, 3);
+ $info[2] = preg_replace('/[\r\n]/', '', $info[2]);
+ if ($info[1] == "FileName.....:") {
+ $Screenshot = basename($info[2]);
+ }
+
+ }
+ echo '</span></td></tr>';
+ my_fclose($fp, $compression);
+
+ // look for a matching ace screenshot
+ if (isset($Screenshot) and file_exists('logs/ace/' . $Screenshot)) {
+ echo '<tr>
+ <td class="smheading" align="center" width="95%" colspan="4">'.$Screenshot.'</td>
+ <td class="smheading" align="center" width="5%" align="right">';
+ echo '<a href="admin.php?key='.$adminkey.'&action='.$action.'&filename='.preg_replace('/\+/', '%20', urlencode($Screenshot)).'&del=1"><img src="images/del.png" border="0" width="16" height="16" title="Delete" alt="Delete" /></a>';
+ echo '</td>
+ </tr>';
+
+ echo '<tr><td class="grey" colspan="5"><span style="font-family: monospace;">';
+ echo '<a href = "logs/ace/'.preg_replace('/\+/', '%20', urlencode($Screenshot)).'" target = "_blank"><img src = "logs/ace/'.preg_replace('/\+/', '%20', urlencode($Screenshot)).'" width = 100% border = 0></a>';
+ echo '</span></td></tr>';
+ }
+ }
+}
+
+echo '</tr>';
+if (!empty($filename)) echo'<tr><td class="smheading" align="center" colspan="5"><a class="grey" href="./admin.php?key='.$_REQUEST[key].'&action='.$action.'">Go Back To Logfile Overview</a></td></tr>';
+echo'<tr><td class="smheading" align="center" colspan="5"><a class="grey" href="./admin.php?key='.$_REQUEST[key].'">Go Back To Admin Page</a></td></tr>';
+echo '</table>';
+
+?>
diff --git a/html/pages/admin/aclog.php b/html/pages/admin/aclog.php new file mode 100755 index 0000000..ada35c8 --- /dev/null +++ b/html/pages/admin/aclog.php @@ -0,0 +1,108 @@ +<?php
+if (empty($import_adminkey) or isset($_REQUEST['import_adminkey']) or $import_adminkey != $adminkey) die('bla');
+
+$filename = (!empty($_REQUEST['filename'])) ? my_stripslashes($_REQUEST['filename']) : '';
+$filename = str_replace(array('..', '/', '\\', '<', ':'), array(), $filename);
+
+
+if (!empty($filename)) {
+ if (!file_exists('logs/ac/'. $filename) or !is_file('logs/ac/'. $filename)) die('bla');
+ if (isset($_REQUEST['del'])) {
+ unlink('logs/ac/'. $filename);
+ $filename = '';
+ }
+}
+
+
+
+
+if (empty($filename)) {
+ echo'<br><table border="0" cellpadding="1" cellspacing="2" width="600">
+ <tr>
+ <td class="smheading" align="center" width="100%" colspan="4">Available AnthChecker Logs:</td>
+ </tr>';
+ $logdir = opendir('logs/ac');
+ $logs = array();
+ $sort = array();
+ $i = 0;
+ while (false !== ($filename = readdir($logdir))) {
+ if (!is_file('logs/ac/'. $filename)) continue;
+ if ($filename == '.htaccess' or $filename == 'index.htm') continue;
+ $i++;
+ $logs[$i] = $filename;
+ $extra = 0;
+ if (substr($filename, -4) == '.bz2') $extra = 4;
+ if (substr($filename, -3) == '.gz') $extra = 3;
+
+ $sort[$i] = substr($filename, strlen($filename) - (23 + $extra), 19);
+ }
+ closedir($logdir);
+ if (count($logs) == 0) {
+ echo '<tr><td class="grey" colspan="4">No logs available!</td></tr>';
+ } else {
+ arsort($sort);
+ $i = 0;
+ foreach($sort as $id => $date) {
+ $log = $logs[$id];
+ $extra = 0;
+ if (substr($log, -4) == '.bz2') $extra = 4;
+ if (substr($log, -3) == '.gz') $extra = 3;
+
+ $i++;
+ $class = ($i%2) ? 'grey' : 'grey2';
+ echo '<tr><td class="'.$class.'">';
+ $tmp = substr($log, strlen($log) - (23 + $extra), 19);
+ $tmp = str_replace('.', '', $tmp);
+ $ts = mtimestamp($tmp);
+ echo ' <a class="'.$class.'" href="admin.php?key='.$adminkey.'&action='.$action.'&filename='.urlencode($log).'">'.date('Y-m-d H:i', $ts).'</a>';
+ echo '</td><td class="'.$class.'">';
+ echo '<a class="'.$class.'" href="admin.php?key='.$adminkey.'&action='.$action.'&filename='.urlencode($log).'">'.substr($log, 6, strlen($log) - 30 - $extra).'</a>';
+ echo '</td><td class="'.$class.'" align="right">';
+ $d_size = file_size_info(filesize('logs/ac/'. $log));
+ echo $d_size['size'] .' '. $d_size['type'];
+ echo '</td><td class="'.$class.'" align="center">';
+ echo '<a href="admin.php?key='.$adminkey.'&action='.$action.'&filename='.urlencode($log).'&del=1"><img src="images/del.png" border="0" width="16" height="16" title="Delete" alt="Delete" /></a>';
+ echo '</td></tr>';
+ }
+ }
+}
+
+
+if (!empty($filename)) {
+ if (!file_exists('logs/ac/'. $filename) or !is_file('logs/ac/'. $filename)) die('bla');
+ echo'<br><table border="0" cellpadding="1" cellspacing="2" width="600">
+ <tr>
+ <td class="smheading" align="center" width="95%" colspan="3">'.$filename.'</td>
+ <td class="smheading" align="center" width="5%" align="right">';
+ echo '<a href="admin.php?key='.$adminkey.'&action='.$action.'&filename='.urlencode($filename).'&del=1"><img src="images/del.png" border="0" width="16" height="16" title="Delete" alt="Delete" /></a>';
+ echo '</td>
+ </tr>';
+
+ $fp = my_fopen('logs/ac/'.$filename, 'rb', $compression = NULL);
+ if (!$fp) die("Error opening file");
+
+ $i = 0;
+ echo '<tr><td class="grey" colspan="4"><span style="font-family: monospace;">';
+
+ while (($line = my_fgets($fp, 5000, $compression)) !== FALSE) {
+ /*
+ $i++;
+ $class = ($i%2) ? 'grey' : 'grey2';
+ echo '<tr><td class="'.$class.'" colspan="4">';
+ echo '<span style="font-family: monospace;">';
+ echo htmlentities($line);
+ echo '</span>';
+ echo '</td></tr>';
+ */
+ echo wordwrap(htmlentities($line), 80, '<br />', 1) ."<br />";
+ }
+ echo '</span></td></tr>';
+ my_fclose($fp, $compression);
+}
+
+echo '</tr>';
+if (!empty($filename)) echo'<tr><td class="smheading" align="center" colspan="4"><a class="grey" href="./admin.php?key='.$_REQUEST[key].'&action='.$action.'">Go Back To Logfile Overview</a></td></tr>';
+echo'<tr><td class="smheading" align="center" colspan="4"><a class="grey" href="./admin.php?key='.$_REQUEST[key].'">Go Back To Admin Page</a></td></tr>';
+echo '</table>';
+
+?>
diff --git a/html/pages/admin/check.php b/html/pages/admin/check.php new file mode 100755 index 0000000..a03bf91 --- /dev/null +++ b/html/pages/admin/check.php @@ -0,0 +1,408 @@ +<?php +if (empty($import_adminkey) or isset($_REQUEST['import_adminkey']) or $import_adminkey != $adminkey) die('bla'); + +echo ' + <center> + <table class = "box" border="0" cellpadding="1" cellspacing="2" width="720"> + <tbody><tr> + <td class="heading" align="center" colspan="2">Server configuration check</td> + </tr></tbody></table><br>'; + +// Check access rights +echo ' + <table class="box" border="0" cellpadding="1" cellspacing="2"> + <tr> + <td class="smheading" align="center" height="25" width="550" colspan="2">Checking access rights</td> + </tr>'; + +// directories +foreach (array("logs", "logs/ac", "logs/backup", "logs/utdc", "logs/ace") as $dir) +{ + echo ' + <tr> + <td class="smheading" align="left" width="350">', $dir, '</td>'; + if (!file_exists($dir)) { + if (mkdir($dir, 0777)) { + echo ' + <td class="warn" align="left" width="200">Created</td></tr>'; + } + else { + echo ' + <td class="warn" align="left" width="200">Not found!</td></tr>'; + } + } + else if (!is_dir($dir)) { + echo ' + <td class="warn" align="left" width="200">Not a directory!</td></tr>'; + } + else if (!is_writable($dir)) { + if (@chmod($dir, 0777)) { + echo ' + <td class="grey" align="left" width="200">SET</td></tr>'; + } + else { + echo ' + <td class="warn" align="left" width="200">Incorrect access rights: ' , substr(sprintf('%o', fileperms($dir)), -4) , '</td></tr>'; + } + } + else { + echo ' + <td class="grey" align="left" width="200">OK</td></tr>'; + } +} + +// files: +foreach (array("includes/ftptimestamp.php") as $file) +{ + echo ' + <tr> + <td class="smheading" align="left" width="350">', $file, '</td>'; + if (!file_exists($file)) { + echo ' + <td class="warn" align="left" width="200">Not found!</td></tr>'; + } + else if (!is_file($file)) { + echo ' + <td class="warn" align="left" width="200">Not a file!</td></tr>'; + } + else if (!is_writable($file)) { + if (@chmod($file, 0777)) { + echo ' + <td class="grey" align="left" width="200">SET</td></tr>'; + } + else { + echo ' + <td class="warn" align="left" width="200">Incorrect access rights: ' , substr(sprintf('%o', fileperms($file)), -4) , '</td></tr>'; + } + } + else { + echo ' + <td class="grey" align="left" width="200">OK</td></tr>'; + } +} + +echo ' + </tbody></table> +<div class="opnote">* Might not work correctly on Windows systems *</div><br>'; + + +// connect to the database and check structure +echo ' + <table class="box" border="0" cellpadding="1" cellspacing="2"> + <tr> + <td class="smheading" align="center" height="25" width="550" colspan="2">Checking mysql tables</td> + </tr>'; + +// database creation array +// to add a database simply add $create_table['dbname'] = "database creation sql" +$create_table['uts_events'] = " +CREATE TABLE `uts_events` ( + `id` mediumint(10) NOT NULL auto_increment, + `matchid` mediumint(10) NOT NULL default '0', + `playerid` tinyint(3) NOT NULL default '0', + `col0` varchar(20) NOT NULL default '', + `col1` varchar(120) NOT NULL default '', + `col2` varchar(120) NOT NULL default '', + `col3` varchar(120) NOT NULL default '', + `col4` varchar(120) NOT NULL default '', + PRIMARY KEY (`id`) +); +"; + +$create_table['uts_games'] = " +CREATE TABLE `uts_games` ( + `id` tinyint(3) unsigned NOT NULL auto_increment, + `gamename` varchar(100) NOT NULL default '', + `name` varchar(100) NOT NULL default '', + PRIMARY KEY (`id`) +) ENGINE=MyISAM AUTO_INCREMENT=9 ; +"; + +$create_table['uts_gamestype'] = " +CREATE TABLE `uts_gamestype` ( + `id` smallint(5) unsigned NOT NULL auto_increment, + `serverip` varchar(21) NOT NULL default '', + `gamename` varchar(100) NOT NULL default '', + `mutator` varchar(100) NOT NULL default '', + `gid` tinyint(3) unsigned NOT NULL default '0', + PRIMARY KEY (`id`) +) ENGINE=MyISAM; +"; + +$create_table['uts_ignoreips'] = " +CREATE TABLE IF NOT EXISTS `uts_ignoreips` ( + `ip` bigint(15) NOT NULL default '0', + PRIMARY KEY (`ip`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +"; + +$create_table['uts_killsmatrix'] = " +CREATE TABLE `uts_killsmatrix` ( + `matchid` mediumint(8) unsigned NOT NULL default '0', + `killer` tinyint(4) NOT NULL default '0', + `victim` tinyint(4) NOT NULL default '0', + `kills` tinyint(3) unsigned NOT NULL default '0', + KEY `matchid` (`matchid`) +) ENGINE=MyISAM; +"; + +$create_table['uts_match'] = " +CREATE TABLE `uts_match` ( + `id` mediumint(10) NOT NULL auto_increment, + `time` varchar(14) default NULL, + `servername` varchar(100) NOT NULL default '', + `serverip` varchar(21) NOT NULL default '0', + `gamename` varchar(100) NOT NULL default '0', + `gid` tinyint(3) unsigned NOT NULL default '0', + `gametime` float NOT NULL default '0', + `mutators` longtext NOT NULL, + `insta` tinyint(1) NOT NULL default '0', + `tournament` varchar(5) NOT NULL default '', + `teamgame` varchar(5) NOT NULL default '', + `mapname` varchar(100) NOT NULL default '', + `mapfile` varchar(100) NOT NULL default '', + `serverinfo` mediumtext NOT NULL, + `gameinfo` mediumtext NOT NULL, + `firstblood` int(10) unsigned NOT NULL default '0', + `frags` mediumint(5) NOT NULL default '0', + `deaths` mediumint(5) NOT NULL default '0', + `kills` mediumint(5) NOT NULL default '0', + `suicides` mediumint(5) NOT NULL default '0', + `teamkills` mediumint(5) NOT NULL default '0', + `assaultid` varchar(10) NOT NULL default '', + `ass_att` tinyint(1) NOT NULL default '0', + `ass_win` tinyint(4) NOT NULL default '0', + `t0` tinyint(1) NOT NULL default '0', + `t1` tinyint(1) NOT NULL default '0', + `t2` tinyint(1) NOT NULL default '0', + `t3` tinyint(1) NOT NULL default '0', + `t0score` mediumint(5) NOT NULL default '0', + `t1score` mediumint(5) NOT NULL default '0', + `t2score` mediumint(5) NOT NULL default '0', + `t3score` mediumint(5) NOT NULL default '0', + PRIMARY KEY (`id`), + KEY `serverip` (`serverip`) +) ENGINE=MyISAM AUTO_INCREMENT=83 ; +"; + +$create_table['uts_pinfo'] = " +CREATE TABLE `uts_pinfo` ( + `id` int(10) unsigned NOT NULL auto_increment, + `name` varchar(50) NOT NULL default '', + `country` char(2) NOT NULL default '', + `banned` enum('Y','N') NOT NULL default 'N', + PRIMARY KEY (`id`), + KEY `name` (`name`(22)) +) ENGINE=MyISAM AUTO_INCREMENT=136 ; +"; + +$create_table['uts_player'] = " +CREATE TABLE `uts_player` ( + `id` mediumint(10) NOT NULL auto_increment, + `matchid` mediumint(10) NOT NULL default '0', + `insta` tinyint(1) NOT NULL default '0', + `playerid` tinyint(3) NOT NULL default '0', + `pid` int(10) unsigned NOT NULL default '0', + `team` tinyint(2) unsigned NOT NULL default '0', + `isabot` tinyint(1) NOT NULL default '0', + `country` char(2) NOT NULL default '', + `ip` int(10) unsigned NOT NULL default '0', + `gid` tinyint(3) unsigned NOT NULL default '0', + `gametime` float NOT NULL default '0', + `gamescore` smallint(5) NOT NULL default '0', + `lowping` smallint(5) unsigned NOT NULL default '0', + `highping` smallint(5) unsigned NOT NULL default '0', + `avgping` smallint(5) unsigned NOT NULL default '0', + `frags` smallint(5) NOT NULL default '0', + `deaths` smallint(5) unsigned NOT NULL default '0', + `kills` smallint(5) unsigned NOT NULL default '0', + `suicides` smallint(5) unsigned NOT NULL default '0', + `teamkills` smallint(5) unsigned NOT NULL default '0', + `eff` float NOT NULL default '0', + `accuracy` float NOT NULL default '0', + `ttl` float NOT NULL default '0', + `flag_taken` smallint(5) unsigned NOT NULL default '0', + `flag_dropped` smallint(5) unsigned NOT NULL default '0', + `flag_return` smallint(5) unsigned NOT NULL default '0', + `flag_capture` tinyint(3) unsigned NOT NULL default '0', + `flag_cover` smallint(5) unsigned NOT NULL default '0', + `flag_seal` smallint(5) unsigned NOT NULL default '0', + `flag_assist` smallint(5) unsigned NOT NULL default '0', + `flag_kill` mediumint(5) unsigned NOT NULL default '0', + `flag_pickedup` smallint(5) unsigned NOT NULL default '0', + `dom_cp` smallint(5) unsigned NOT NULL default '0', + `ass_obj` smallint(5) unsigned NOT NULL default '0', + `spree_double` smallint(5) unsigned NOT NULL default '0', + `spree_triple` smallint(5) unsigned NOT NULL default '0', + `spree_multi` smallint(5) unsigned NOT NULL default '0', + `spree_mega` tinyint(3) unsigned NOT NULL default '0', + `spree_ultra` tinyint(3) unsigned NOT NULL default '0', + `spree_monster` tinyint(3) unsigned NOT NULL default '0', + `spree_kill` smallint(5) unsigned NOT NULL default '0', + `spree_rampage` smallint(5) unsigned NOT NULL default '0', + `spree_dom` tinyint(3) unsigned NOT NULL default '0', + `spree_uns` tinyint(3) unsigned NOT NULL default '0', + `spree_god` smallint(5) unsigned NOT NULL default '0', + `pu_pads` tinyint(3) unsigned NOT NULL default '0', + `pu_armour` tinyint(3) unsigned NOT NULL default '0', + `pu_keg` tinyint(3) unsigned NOT NULL default '0', + `pu_invis` tinyint(3) unsigned NOT NULL default '0', + `pu_belt` tinyint(3) unsigned NOT NULL default '0', + `pu_amp` tinyint(3) unsigned NOT NULL default '0', + `rank` float NOT NULL default '0', + PRIMARY KEY (`id`), + KEY `matchid` (`matchid`,`team`), + KEY `pid` (`pid`), + KEY `gid` (`gid`) +) ENGINE=MyISAM AUTO_INCREMENT=615 ; +"; + +$create_table['uts_rank'] = " +CREATE TABLE `uts_rank` ( + `id` mediumint(10) NOT NULL auto_increment, + `time` float unsigned NOT NULL default '0', + `pid` int(10) unsigned NOT NULL default '0', + `gid` tinyint(3) unsigned NOT NULL default '0', + `rank` float NOT NULL default '0', + `prevrank` float NOT NULL default '0', + `matches` mediumint(5) NOT NULL default '0', + PRIMARY KEY (`id`), + KEY `name` (`pid`,`gid`), + KEY `rank` (`rank`), + KEY `gamename` (`gid`,`rank`) +) ENGINE=MyISAM AUTO_INCREMENT=173 ; +"; + +$create_table['uts_weapons'] = " +CREATE TABLE `uts_weapons` ( + `id` tinyint(3) unsigned NOT NULL auto_increment, + `name` varchar(100) NOT NULL default '', + `image` varchar(50) NOT NULL default '', + `sequence` tinyint(3) unsigned NOT NULL default '200', + `hide` enum('N','Y') NOT NULL default 'N', + PRIMARY KEY (`id`), + KEY `name` (`name`(20)) +) ENGINE=MyISAM AUTO_INCREMENT=20 ; +"; + +$create_table['uts_weaponstats'] = " +CREATE TABLE `uts_weaponstats` ( + `matchid` mediumint(8) unsigned NOT NULL default '0', + `pid` int(10) unsigned NOT NULL default '0', + `weapon` tinyint(3) unsigned NOT NULL default '0', + `kills` mediumint(8) unsigned NOT NULL default '0', + `shots` int(10) unsigned NOT NULL default '0', + `hits` int(10) unsigned NOT NULL default '0', + `damage` int(10) unsigned NOT NULL default '0', + `acc` float unsigned NOT NULL default '0', + KEY `full` (`matchid`,`pid`) +) ENGINE=MyISAM; +"; + +foreach ($create_table as $table => $query) { + echo ' + <tr> + <td class="smheading" align="left" width="350">', $table, '</td>'; + if (small_count("SHOW TABLES LIKE '$table'") == 1) { + // database exists, check columns + echo ' + <td class="grey" align="left" width="200">OK</td></tr>'; + } + else { + if (mysql_query($query)) { + echo ' + <td class="grey" align="left" width="200">Created</td></tr>'; + } + else { + echo ' + <td class="warn" align="left" width="200">Not found!</td></tr>'; + } + } +} +echo ' + </tbody></table><br>'; + +// Check the weapons +$create_weapon['Translocator'] = "INSERT INTO `uts_weapons` VALUES (1, 'Translocator', 'trans.jpg', 1, 'N');"; +$create_weapon['Impact Hammer'] = "INSERT INTO `uts_weapons` VALUES (2, 'Impact Hammer', 'impact.jpg', 2, 'N');"; +$create_weapon['Enforcer'] = "INSERT INTO `uts_weapons` VALUES (3, 'Enforcer', 'enforcer.jpg', 3, 'N');"; +$create_weapon['Double Enforcer'] = "INSERT INTO `uts_weapons` VALUES (4, 'Double Enforcer', 'enforcer2.jpg', 4, 'N');"; +$create_weapon['GES Bio Rifle'] = "INSERT INTO `uts_weapons` VALUES (5, 'GES Bio Rifle', 'bio.jpg', 5, 'N');"; +$create_weapon['Ripper'] = "INSERT INTO `uts_weapons` VALUES (6, 'Ripper', 'ripper.jpg', 6, 'N');"; +$create_weapon['Shock Rifle'] = "INSERT INTO `uts_weapons` VALUES (7, 'Shock Rifle', 'shock.jpg', 7, 'N');"; +$create_weapon['Enhanced Shock Rifle'] = "INSERT INTO `uts_weapons` VALUES (8, 'Enhanced Shock Rifle', 'ishock.jpg', 8, 'N');"; +$create_weapon['Pulse Gun'] = "INSERT INTO `uts_weapons` VALUES (9, 'Pulse Gun', 'pulse.jpg', 9, 'N');"; +$create_weapon['Minigun'] = "INSERT INTO `uts_weapons` VALUES (10, 'Minigun', 'minigun.jpg', 10, 'N');"; +$create_weapon['Flak Cannon'] = "INSERT INTO `uts_weapons` VALUES (11, 'Flak Cannon', 'flak.jpg', 11, 'N');"; +$create_weapon['Rocket Launcher'] = "INSERT INTO `uts_weapons` VALUES (12, 'Rocket Launcher', 'rockets.jpg', 12, 'N');"; +$create_weapon['Sniper Rifle'] = "INSERT INTO `uts_weapons` VALUES (13, 'Sniper Rifle', 'sniper.jpg', 13, 'N');"; +$create_weapon['Redeemer'] = "INSERT INTO `uts_weapons` VALUES (14, 'Redeemer', 'deemer.jpg', 14, 'N');"; +$create_weapon['None'] = "INSERT INTO `uts_weapons` VALUES (15, 'None', 'blank.jpg', 15, 'N');"; +$create_weapon['Chainsaw'] = "INSERT INTO `uts_weapons` VALUES (16, 'Chainsaw', 'chainsaw.jpg', 16, 'N');"; + +echo ' + <table class="box" border="0" cellpadding="1" cellspacing="2"> + <tr> + <td class="smheading" align="center" height="25" width="550" colspan="2">Checking supported weapons</td> + </tr>'; +if (small_count("SHOW TABLES LIKE 'uts_weapons'") != 1) { + // database exists, check columns + echo ' + <td class="warn" align="left" width="550" colspan = "2">Table uts_weapons does not exist!</td></tr>'; +} +else { + foreach ($create_weapon as $weapon => $query) { + echo ' + <tr> + <td class="smheading" align="left" width="350">', $weapon, '</td>'; + if (small_count("SELECT id FROM uts_weapons WHERE name = '$weapon' LIMIT 0,1") == 1) { + // database exists, check columns + echo ' + <td class="grey" align="left" width="200">OK</td></tr>'; + } + else { + if (mysql_query($query)) { + echo ' + <td class="grey" align="left" width="200">Added</td></tr>'; + } + else { + echo ' + <td class="warn" align="left" width="200">Not found!</td></tr>'; + } + } + } +} +echo ' + </tbody></table><br>'; + +echo ' + <table class="box" border="0" cellpadding="1" cellspacing="2"> + <tr> + <td class="smheading" align="center" height="25" width="550" colspan="2">Checking data</td> + </tr>'; + + echo ' + <tr> + <td class="smheading" align="left" width="350">Fix BT cap times</td>'; + + $q = mysql_query("UPDATE uts_events SET col3 = ROUND(CEILING((col3-1)*100/1.1) / 100, 2), col1 = 'btcap' WHERE col1 = 'cap'"); + $affected = mysql_affected_rows(); + + if ($affected == -1) { + echo ' + <td class="error" align="left" width="200">Failed</td></tr> + <table>'; + } + else { + echo ' + <td class="grey" align="left" width="200">Updated ' . $affected . ' rows.</td></tr> + <table><br>'; + } + +echo ' + <table class = "box" border="0" cellpadding="1" cellspacing="2" width="720"> + <tbody>'; +echo '<tr><td class="smheading" align="center" colspan="4"><a class="grey" href="./admin.php?key='.$_REQUEST[key].'">Go Back To Admin Page</a></td></tr>'; +echo '</tbody></table>'; + +?>
\ No newline at end of file diff --git a/html/pages/admin/dmatch.php b/html/pages/admin/dmatch.php new file mode 100755 index 0000000..9fed97d --- /dev/null +++ b/html/pages/admin/dmatch.php @@ -0,0 +1,105 @@ +<?php
+if (empty($import_adminkey) or isset($_REQUEST['import_adminkey']) or $import_adminkey != $adminkey) die('bla');
+
+$options['title'] = 'Delete match';
+$i = 0;
+$options['vars'][$i]['name'] = 'server';
+$options['vars'][$i]['type'] = 'server';
+$options['vars'][$i]['prompt'] = 'Choose the server where the match took place:';
+$options['vars'][$i]['caption'] = 'Server:';
+$i++;
+$options['vars'][$i]['name'] = 'mid';
+$options['vars'][$i]['type'] = 'match';
+$options['vars'][$i]['whereserver'] = 'server';
+$options['vars'][$i]['prompt'] = 'Choose the match to delete:';
+$options['vars'][$i]['caption'] = 'Match to delete:';
+$i++;
+
+$results = adminselect($options);
+
+
+$matchid = $results['mid'];
+
+echo'<br><table border="0" cellpadding="1" cellspacing="2" width="600">
+<tr>
+ <td class="smheading" align="center" colspan="2">Deleting Match ID '.$matchid.'</td>
+</tr>
+<tr>
+ <td class="smheading" align="left" width="200">Adjusting Rankings</td>';
+$sql_radjust = "SELECT pid, gid, rank FROM uts_player WHERE matchid = $matchid";
+$q_radjust = mysql_query($sql_radjust) or die(mysql_error());
+$pids = array();
+while ($r_radjust = mysql_fetch_array($q_radjust)) {
+
+ $pid = $r_radjust[pid];
+ $pids[] = $pid;
+ $gid = $r_radjust[gid];
+ $rank = $r_radjust[rank];
+
+ $sql_crank = small_query("SELECT id, rank, matches FROM uts_rank WHERE pid = $pid AND gid = $gid");
+ if (!$sql_crank) continue;
+
+ $rid = $sql_crank[id];
+ $newrank = $sql_crank[rank]-$rank;
+ $oldrank = $sql_crank[rank];
+ $matchcount = $sql_crank[matches]-1;
+
+ mysql_query("UPDATE uts_rank SET rank = $newrank, prevrank = $oldrank, matches = $matchcount WHERE id = $rid") or die(mysql_error());
+ mysql_query("DELETE FROM uts_rank WHERE matches = 0") or die(mysql_error());
+}
+ echo'<td class="grey" align="left" width="400">Done</td>
+</tr>
+<tr>
+ <td class="smheading" align="left" width="200">Removing Match Record:</td>';
+mysql_query("DELETE FROM uts_match WHERE id = $matchid") or die(mysql_error());
+ echo'<td class="grey" align="left" width="400">Done</td>
+</tr>
+<tr>
+ <td class="smheading" align="left" width="200">Removing Player Records:</td>';
+mysql_query("DELETE FROM uts_player WHERE matchid = $matchid") or die(mysql_error());
+ echo'<td class="grey" align="left" width="400">Done</td>
+</tr>
+<tr>
+ <td class="smheading" align="left" width="200">Removing Kill Matrix Entries:</td>';
+mysql_query("DELETE FROM uts_killsmatrix WHERE matchid = $matchid") or die(mysql_error());
+ echo'<td class="grey" align="left" width="400">Done</td>
+</tr>
+<tr>
+ <td class="smheading" align="left" width="200">Removing Weapon Stats:</td>';
+mysql_query("DELETE FROM uts_weaponstats WHERE matchid = $matchid") or die(mysql_error());
+ echo'<td class="grey" align="left" width="400">Done</td>
+</tr>
+<tr>
+ <td class="smheading" align="left" width="200">Amending Player Weapon Stats:</td>';
+foreach($pids as $pid) {
+ mysql_query("DELETE FROM uts_weaponstats WHERE matchid IN ('$matchid','0') AND pid = '$pid'") or die(mysql_error());
+
+ $q_weaponstats = mysql_query("SELECT weapon, SUM(kills) AS kills, SUM(shots) AS shots, SUM(hits) as hits, SUM(damage) as damage, AVG(acc) AS acc FROM uts_weaponstats WHERE pid = '$pid' GROUP BY weapon") or die(mysql_error());
+ while ($r_weaponstats = mysql_fetch_array($q_weaponstats)) {
+ mysql_query("INSERT INTO uts_weaponstats SET matchid='0', pid='$pid', weapon='${r_weaponstats['weapon']}', kills='${r_weaponstats['kills']}', shots='${r_weaponstats['shots']}', hits='${r_weaponstats['hits']}', damage='${r_weaponstats['damage']}', acc='${r_weaponstats['acc']}'") or die(mysql_error());
+ }
+}
+ echo'<td class="grey" align="left" width="400">Done</td>
+</tr>
+<tr>
+ <td class="smheading" align="left" width="200">Amending Global Weapon Stats:</td>';
+ mysql_query("DELETE FROM uts_weaponstats WHERE matchid='0' AND pid='0'") or die(mysql_error());
+
+ $q_weaponstats = mysql_query("SELECT weapon, SUM(kills) AS kills, SUM(shots) AS shots, SUM(hits) as hits, SUM(damage) as damage, AVG(acc) AS acc FROM uts_weaponstats WHERE matchid = '0' GROUP BY weapon") or die(mysql_error());
+ while ($r_weaponstats = mysql_fetch_array($q_weaponstats)) {
+ mysql_query("INSERT INTO uts_weaponstats SET matchid='0', pid='0', weapon='${r_weaponstats['weapon']}', kills='${r_weaponstats['kills']}', shots='${r_weaponstats['shots']}', hits='${r_weaponstats['hits']}', damage='${r_weaponstats['damage']}', acc='${r_weaponstats['acc']}'") or die(mysql_error());
+ }
+
+ echo'<td class="grey" align="left" width="400">Done</td>
+</tr>
+<tr>
+ <td class="smheading" align="left" width="200">Removing events:</td>';
+mysql_query("DELETE FROM uts_events WHERE matchid = $matchid") or die(mysql_error());
+ echo'<td class="grey" align="left" width="400">Done</td>
+</tr>
+<tr>
+ <td class="smheading" align="center" colspan="2">Match Deleted - <a href="./admin.php?key='.$_REQUEST[key].'">Go Back To Admin Page</a></td>
+</tr></table>';
+
+
+?>
diff --git a/html/pages/admin/dplayer.php b/html/pages/admin/dplayer.php new file mode 100755 index 0000000..0239e5d --- /dev/null +++ b/html/pages/admin/dplayer.php @@ -0,0 +1,76 @@ +<?php
+if (empty($import_adminkey) or isset($_REQUEST['import_adminkey']) or $import_adminkey != $adminkey) die('bla');
+
+$options['title'] = 'Delete Player';
+$i = 0;
+$options['vars'][$i]['name'] = 'pid';
+$options['vars'][$i]['type'] = 'player';
+$options['vars'][$i]['prompt'] = 'Choose the player you want to delete:';
+$options['vars'][$i]['caption'] = 'Player to delete:';
+$i++;
+
+$results = adminselect($options);
+
+
+$pid = $results['pid'];
+$playerid = $pid;
+
+echo'<table border="0" cellpadding="1" cellspacing="2" width="600">
+<tr>
+ <td class="smheading" align="center" colspan="2">Deleting Player</td>
+</tr>
+<tr>
+ <td class="smheading" align="left">Removing Kill Matrix Entries:</td>';
+ $q_match = mysql_query("SELECT matchid, playerid FROM uts_player WHERE pid = '$pid'") or die(mysql_error());
+ while ($r_match = mysql_fetch_array($q_match)) {
+ mysql_query("DELETE FROM uts_killsmatrix WHERE matchid = '${r_match['matchid']}' AND (killer = '${r_match['playerid']}' OR victim = '${r_match['playerid']}')") or die(mysql_error());
+ }
+ echo'<td class="grey" align="left">Done</td>
+</tr>
+
+<tr>
+ <td class="smheading" align="left" width="300">Removing Player Info:</td>';
+$r_pinfo = small_query("SELECT banned FROM uts_pinfo WHERE id = $playerid");
+if ($r_pinfo['banned'] != 'Y') {
+ mysql_query("DELETE FROM uts_pinfo WHERE id = $playerid") or die(mysql_error());
+ echo'<td class="grey" align="left" width="300">Done</td>';
+} else {
+ echo'<td class="grey" align="left" width="300">No (player banned)</td>';
+}
+echo '
+</tr>
+<tr>
+ <td class="smheading" align="left">Removing Player Match Events:</td>';
+mysql_query("DELETE e.* FROM uts_player as p, uts_events as e WHERE p.pid = $playerid AND p.playerid = e.playerid AND p.matchid = e.matchid") or die(mysql_error());
+ echo'<td class="grey" align="left">Done</td>
+</tr>
+<tr>
+ <td class="smheading" align="left">Removing Player Match Records:</td>';
+mysql_query("DELETE FROM uts_player WHERE pid = $playerid") or die(mysql_error());
+ echo'<td class="grey" align="left">Done</td>
+</tr>
+<tr>
+ <td class="smheading" align="left">Removing Player Rank:</td>';
+mysql_query("DELETE FROM uts_rank WHERE pid = $playerid") or die(mysql_error());
+ echo'<td class="grey" align="left">Done</td>
+</tr>
+<tr>
+ <td class="smheading" align="left">Removing Player Weapon Stats:</td>';
+mysql_query("DELETE FROM uts_weaponstats WHERE pid = $playerid") or die(mysql_error());
+ echo'<td class="grey" align="left">Done</td>
+</tr>
+<tr>
+ <td class="smheading" align="left" width="200">Amending Global Weapon Stats:</td>';
+ mysql_query("DELETE FROM uts_weaponstats WHERE matchid='0' AND pid='0'") or die(mysql_error());
+
+ $q_weaponstats = mysql_query("SELECT weapon, SUM(kills) AS kills, SUM(shots) AS shots, SUM(hits) as hits, SUM(damage) as damage, AVG(acc) AS acc FROM uts_weaponstats WHERE matchid = '0' GROUP BY weapon") or die(mysql_error());
+ while ($r_weaponstats = mysql_fetch_array($q_weaponstats)) {
+ mysql_query("INSERT INTO uts_weaponstats SET matchid='0', pid='0', weapon='${r_weaponstats['weapon']}', kills='${r_weaponstats['kills']}', shots='${r_weaponstats['shots']}', hits='${r_weaponstats['hits']}', damage='${r_weaponstats['damage']}', acc='${r_weaponstats['acc']}'") or die(mysql_error());
+ }
+
+ echo'<td class="grey" align="left" width="400">Done</td>
+</tr>
+<tr>
+ <td class="smheading" align="center" colspan="2">Player Deleted - <a href="./admin.php?key='.$_REQUEST[key].'">Go Back To Admin Page</a></td>
+</tr></table>';
+?>
diff --git a/html/pages/admin/dpmatch.php b/html/pages/admin/dpmatch.php new file mode 100755 index 0000000..b021054 --- /dev/null +++ b/html/pages/admin/dpmatch.php @@ -0,0 +1,106 @@ +<?php
+if (empty($import_adminkey) or isset($_REQUEST['import_adminkey']) or $import_adminkey != $adminkey) die('bla');
+
+$options['title'] = 'Delete Player from Match';
+$i = 0;
+$options['vars'][$i]['name'] = 'pid';
+$options['vars'][$i]['type'] = 'player';
+$options['vars'][$i]['prompt'] = 'Choose the player you want to delete from a match:';
+$options['vars'][$i]['caption'] = 'Player to delete:';
+$i++;
+$options['vars'][$i]['name'] = 'mid';
+$options['vars'][$i]['type'] = 'match';
+$options['vars'][$i]['whereplayer'] = 'pid';
+$options['vars'][$i]['prompt'] = 'Choose the match you want to delete the player from:';
+$options['vars'][$i]['caption'] = 'Match:';
+$i++;
+
+$results = adminselect($options);
+
+
+$matchid = $results['mid'];
+$pid = $results['pid'];
+
+echo'<br><table border="0" cellpadding="1" cellspacing="2" width="600">
+<tr>
+ <td class="smheading" align="center" colspan="2">Delete Player From Match ID '.$matchid.'</td>
+</tr>';
+
+echo'<tr>
+ <td class="smheading" align="left" width="200">Amending Players Rank:</td>';
+
+$q_radjust = small_query("SELECT pid, gid, rank FROM uts_player WHERE id = $pid");
+if (!$q_radjust) {
+ $sql_crank = false;
+} else {
+ $rank_pid = $q_radjust[pid];
+ $rank_gid = $q_radjust[gid];
+ $rank = $q_radjust[rank];
+
+ $sql_crank = small_query("SELECT id, rank, matches FROM uts_rank WHERE pid = $rank_pid AND gid = '$rank_gid'");
+}
+if (!$sql_crank) {
+ echo'<td class="grey" align="left" width="400">Player not in rankings</td>';
+} else {
+ $rid = $sql_crank[id];
+ $newrank = $sql_crank[rank]-$rank;
+ $oldrank = $sql_crank[rank];
+ $matchcount = $sql_crank[matches]-1;
+
+ mysql_query("UPDATE uts_rank SET rank = $newrank, prevrank = $oldrank, matches = $matchcount WHERE id = $rid") or die(mysql_error());
+ mysql_query("DELETE FROM uts_rank WHERE matches = 0") or die(mysql_error());
+
+ echo'<td class="grey" align="left" width="400">Done</td>';
+}
+echo'</tr>
+<tr>
+ <td class="smheading" align="left">Removing Kill Matrix Entries:</td>';
+ $q_match = mysql_query("SELECT matchid, playerid FROM uts_player WHERE pid = '$pid' and matchid = '$matchid'") or die(mysql_error());
+ while ($r_match = mysql_fetch_array($q_match)) {
+ mysql_query("DELETE FROM uts_killsmatrix WHERE matchid = '${r_match['matchid']}' AND (killer = '${r_match['playerid']}' OR victim = '${r_match['playerid']}')") or die(mysql_error());
+ }
+ echo'<td class="grey" align="left">Done</td>
+</tr>
+
+
+<tr>
+ <td class="smheading" align="left" width="200">Removing Player Weapon Stats:</td>';
+mysql_query("DELETE FROM uts_weaponstats WHERE matchid = $matchid AND pid = $pid") or die(mysql_error());
+ echo'<td class="grey" align="left" width="400">Done</td>
+</tr>
+<tr>
+ <td class="smheading" align="left" width="200">Removing Player Events:</td>';
+mysql_query("DELETE e.* FROM uts_events as e, uts_player as p WHERE p.pid = '$pid' AND e.matchid = $matchid AND p.playerid = e.playerid AND p.matchid = e.matchid") or die(mysql_error());
+ echo'<td class="grey" align="left" width="400">Done</td>
+</tr>
+<tr>
+ <td class="smheading" align="left" width="200">Removing Player From Match:</td>';
+mysql_query("DELETE FROM uts_player WHERE matchid IN ('$matchid','0') AND pid = '$pid'") or die(mysql_error());
+ echo'<td class="grey" align="left" width="400">Done</td>
+</tr>
+<tr>
+ <td class="smheading" align="left" width="200">Amending Player Weapon Stats:</td>';
+mysql_query("DELETE FROM uts_weaponstats WHERE matchid IN ('$matchid','0') AND pid = '$pid'") or die(mysql_error());
+
+$q_weaponstats = mysql_query("SELECT SUM(kills) AS kills, SUM(shots) AS shots, SUM(hits) as hits, SUM(damage) as damage, AVG(acc) AS acc FROM uts_weaponstats WHERE pid = '$pid' GROUP BY weapon") or die(mysql_error());
+while ($r_weaponstats = mysql_fetch_array($q_weaponstats)) {
+ mysql_query("INSERT INTO uts_weaponstats SET matchid='0', pid='$pid', kills='${r_weaponstats['kills']}', shots='${r_weaponstats['shots']}', hits='${r_weaponstats['hits']}', damage='${r_weaponstats['damage']}', acc='${r_weaponstats['acc']}'") or die(mysql_error());
+}
+ echo'<td class="grey" align="left" width="400">Done</td>
+</tr>
+<tr>
+ <td class="smheading" align="left" width="200">Amending Global Weapon Stats:</td>';
+ mysql_query("DELETE FROM uts_weaponstats WHERE matchid='0' AND pid='0'") or die(mysql_error());
+
+ $q_weaponstats = mysql_query("SELECT weapon, SUM(kills) AS kills, SUM(shots) AS shots, SUM(hits) as hits, SUM(damage) as damage, AVG(acc) AS acc FROM uts_weaponstats WHERE matchid = '0' GROUP BY weapon") or die(mysql_error());
+ while ($r_weaponstats = mysql_fetch_array($q_weaponstats)) {
+ mysql_query("INSERT INTO uts_weaponstats SET matchid='0', pid='0', weapon='${r_weaponstats['weapon']}', kills='${r_weaponstats['kills']}', shots='${r_weaponstats['shots']}', hits='${r_weaponstats['hits']}', damage='${r_weaponstats['damage']}', acc='${r_weaponstats['acc']}'") or die(mysql_error());
+ }
+
+ echo'<td class="grey" align="left" width="400">Done</td>
+</tr>
+<tr>
+ <td class="smheading" align="center" colspan="2">Match Deleted - <a href="./admin.php?key='.$_REQUEST[key].'">Go Back To Admin Page</a></td>
+</tr></table>';
+
+?>
diff --git a/html/pages/admin/editgames.php b/html/pages/admin/editgames.php new file mode 100755 index 0000000..3f7a542 --- /dev/null +++ b/html/pages/admin/editgames.php @@ -0,0 +1,74 @@ +<?php
+if (empty($import_adminkey) or isset($_REQUEST['import_adminkey']) or $import_adminkey != $adminkey) die('bla');
+
+if (isset($_REQUEST['submit'])) {
+ foreach($_REQUEST['name'] as $id => $bla) {
+ if ($id == 0) {
+ if (empty($_REQUEST['name'][$id])) continue;
+ mysql_query(" INSERT INTO uts_games
+ SET name = '". my_addslashes($_REQUEST['name'][$id]) ."',
+ gamename = '(user defined)';") or die(mysql_error());
+ } else {
+ mysql_query(" UPDATE uts_games
+ SET name = '". my_addslashes($_REQUEST['name'][$id]) ."'
+ WHERE id = '$id';") or die(mysql_error());
+ }
+ }
+}
+
+echo'<br><table border="0" cellpadding="1" cellspacing="2" width="600">
+<tr>
+ <td class="medheading" align="center" colspan="2">Edit games</td>
+</tr>
+<tr>
+ <td class="smheading">GameName</td>
+ <td class="smheading">DisplayName</td>
+</tr>
+<form action="'.$_SERVER['PHP_SELF'].'" method="POST">
+<input type="hidden" name="key" value="'.$adminkey.'">
+<input type="hidden" name="action" value="'.$action.'">
+';
+
+
+$sql_games = "SELECT id, gamename, name FROM uts_games ORDER BY gamename ASC;";
+$q_games = mysql_query($sql_games) or die(mysql_error());
+$i = 0;
+while ($r_games = mysql_fetch_array($q_games)) {
+ $i++;
+ $class = ($i%2) ? 'grey' : 'grey2';
+ echo '<tr>';
+ echo '<td class="'.$class.'">'.htmlentities($r_games['gamename']).'</td>';
+ echo '<td class="'.$class.'"><input class="searchform" type="text" name="name['.$r_games['id'].']" value="'.$r_games['name'].'"></td>';
+ echo '</tr>';
+}
+echo'
+<tr>
+ <td colspan="2"> </td>
+</tr>
+<tr>
+ <td class="smheading" colspan="2" align="center">Add new</td>
+</tr>
+<tr>
+ <td class="grey">(n/a)</td>
+ <td class="grey"><input class="searchform" type="text" name="name[0]" value=""></td></td>
+</tr>
+<tr>
+ <td colspan="2"> </td>
+</tr>
+<tr>
+ <td class="smheading" colspan="2" align="center">Submit</td>
+</tr>
+';
+
+
+echo '<tr>';
+echo '<td class="darkgrey" colspan="4" align="center"><input class="searchformb" type="Submit" name="submit" value="Save"></td>';
+echo '</tr>';
+
+echo'</form>
+ <tr>
+ <td class="smheading" align="center" colspan="4"><a class="grey" href="./admin.php?key='.$_REQUEST[key].'">Go Back To Admin Page</a></td>
+</tr>
+</table>';
+
+?>
diff --git a/html/pages/admin/editgamestype.php b/html/pages/admin/editgamestype.php new file mode 100755 index 0000000..d9e4ff1 --- /dev/null +++ b/html/pages/admin/editgamestype.php @@ -0,0 +1,228 @@ +<?php
+if (empty($import_adminkey) or isset($_REQUEST['import_adminkey']) or $import_adminkey != $adminkey) die('bla');
+
+$sql_server = "SELECT id, servername, serverip FROM uts_match GROUP BY servername, serverip ORDER BY servername ASC";
+$q_server = mysql_query($sql_server) or die(mysql_error());
+$servernames = array('0' => '');
+$serverips = array('0' => '*');
+while ($r_server = mysql_fetch_array($q_server)) {
+ $servernames[$r_server['id']] = $r_server['servername'];
+ $serverips[$r_server['id']] = $r_server['serverip'];
+}
+
+$sql_games = "SELECT id, gamename, name FROM uts_games ORDER BY gamename ASC";
+$q_games = mysql_query($sql_games) or die(mysql_error());
+$gamedisplaynames = array('0' => '');
+$gamenames = array('0' => '*');
+while ($r_games = mysql_fetch_array($q_games)) {
+ $gamenames[$r_games['id']] = $r_games['gamename'];
+ $gamedisplaynames[$r_games['id']] = $r_games['name'];
+}
+
+
+if (isset($_REQUEST['submit'])) {
+ mysql_query(" INSERT INTO uts_gamestype
+ SET serverip = '". my_addslashes($_REQUEST['serverip']) ."',
+ gamename = '". my_addslashes($_REQUEST['gamename']) ."',
+ mutator = '". my_addslashes($_REQUEST['mutator']) ."',
+ gid = '". my_addslashes($_REQUEST['gid']) ."'
+ ") or die(mysql_error());
+
+ if (isset($_REQUEST['update'])) {
+ echo'<br><table border="0" cellpadding="1" cellspacing="2" width="600">
+ <tr>
+ <td class="smheading" align="center" colspan="2">Updating...</td>
+ </tr>
+
+
+
+ <tr>
+ <td class="smheading" align="left" width="200">Updating Player Records</td>';
+ $where = 'WHERE 1';
+ if ($_REQUEST['serverip'] != '*') {
+ $where .= " AND m.serverip = '". my_addslashes($_REQUEST['serverip']) ."'";
+ }
+ if ($_REQUEST['gamename'] != '*') {
+ $gids = array_keys($gamenames, my_stripslashes($_REQUEST['gamename']));
+ $where .= " AND m.gid IN (".implode(',', $gids).")";
+ }
+ if ($_REQUEST['mutator'] != '*') {
+ $where .= " AND m.mutators LIKE '%".my_addslashes($_REQUEST['mutator'])."%'";
+ }
+
+ mysql_query("UPDATE uts_player p, uts_match m SET p.gid = '". my_addslashes($_REQUEST['gid']) ."' $where AND m.id = p.matchid;") or die(mysql_error());
+ echo'<td class="grey" align="left" width="400">Done (updated '.mysql_affected_rows().' records)</td>
+ </tr>
+
+
+
+
+ <tr>
+ <td class="smheading" align="left" width="200">Updating Matches</td>';
+ mysql_query("UPDATE uts_match m SET m.gid = '". my_addslashes($_REQUEST['gid']) ."' $where;") or die(mysql_error());
+ echo'<td class="grey" align="left" width="400">Done (updated '.mysql_affected_rows().' matches)</td>
+ </tr>
+
+
+
+
+
+ <tr>
+ <td class="smheading" align="left" width="200">Re-Calcuating Rankings</td>';
+
+ if ($_REQUEST['gamename'] != '*') {
+ $gids[] = $_REQUEST['gid'];
+ $where = "WHERE gid IN (".implode(',', $gids).")";
+ } else {
+ $where = 'WHERE 1';
+ }
+ mysql_query("DELETE FROM uts_rank $where;") or die(mysql_error());
+
+ $sql_nrank = "SELECT SUM(p.gametime) AS time, p.pid, p.gid, SUM(p.rank) AS rank, COUNT(p.matchid) AS matches FROM uts_player p, uts_pinfo pi $where AND pi.id = p.pid AND pi.banned <> 'Y' GROUP BY p.gid, p.pid";
+ $q_nrank = mysql_query($sql_nrank) or die(mysql_error());
+ $num_ranks = 0;
+ while ($r_nrank = mysql_fetch_array($q_nrank)) {
+ mysql_query("INSERT INTO uts_rank SET time = '${r_nrank['time']}', pid = ${r_nrank['pid']}, gid = ${r_nrank['gid']}, rank = '${r_nrank['rank']}', prevrank = '${r_nrank['rank']}', matches = ${r_nrank['matches']}") or die(mysql_error());
+ $num_ranks++;
+ }
+ echo'<td class="grey" align="left" width="400">Done (recalculated '.$num_ranks.' rankings)</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center" colspan="2">Update finished..</td>
+ </tr>
+ </table>';
+ }
+}
+
+if (isset($_REQUEST['del'])) {
+ mysql_query(" DELETE FROM uts_gamestype
+ WHERE id = '". my_addslashes($_REQUEST['del']) ."'
+ ") or die(mysql_error());
+}
+
+
+
+echo'<br><table border="0" cellpadding="1" cellspacing="2" width="600">
+<tr>
+ <td class="medheading" align="center" colspan="8">Current Mappings</td>
+</tr>
+<tr>
+ <td class="smheading" width="130"> Server IP</td>
+ <td class="smheading" width="20"></td>
+ <td class="smheading" width="130"> Game Name</td>
+ <td class="smheading" width="20"></td>
+ <td class="smheading" width="130"> Mutatorlist contains</td>
+ <td class="smheading" width="20"></td>
+ <td class="smheading" width="130"> Game</td>
+ <td class="smheading" width="20"></td>
+</tr>';
+
+
+
+
+
+
+$sql_gamestype = "SELECT id, serverip, gamename, mutator, gid FROM uts_gamestype ORDER BY id ASC;";
+$q_gamestype = mysql_query($sql_gamestype) or die(mysql_error());
+$i = 0;
+while ($r_gamestype = mysql_fetch_array($q_gamestype)) {
+ $i++;
+ $class = ($i%2) ? 'grey' : 'grey2';
+ echo '<tr>';
+ echo '<td class="'.$class.'"> '.htmlentities($r_gamestype['serverip']).'</td>';
+ echo '<td class="smheading" align="center">+</td>';
+ echo '<td class="'.$class.'"> '.htmlentities($r_gamestype['gamename']).'</td>';
+ echo '<td class="smheading" align="center">+</td>';
+ echo '<td class="'.$class.'"> '.htmlentities($r_gamestype['mutator']).'</td>';
+ echo '<td class="smheading" align="center">=</td>';
+ echo '<td class="'.$class.'"> '.htmlentities($gamedisplaynames[$r_gamestype['gid']]).'</td>';
+ echo '<td class="'.$class.'" align="center">';
+ echo '<a href="'.$_SERVER['PHP_SELF'].'?action='.$action.'&key='.$adminkey.'&del='.$r_gamestype['id'].'">';
+ echo '<img src="images/del.png" border="0" width="16" height="16" title="Delete" alt="Delete" />';
+ echo '</a>';
+ echo '</td>';
+ echo '</tr>';
+}
+
+echo '</tr></table>';
+
+
+
+
+
+
+
+
+echo'<br><table border="0" cellpadding="1" cellspacing="2" width="600">
+<tr>
+ <td class="medheading" align="center" colspan="2">Add new gamestype</td>
+</tr>
+<form action="'.$_SERVER['PHP_SELF'].'" method="POST">
+<input type="hidden" name="key" value="'.$adminkey.'">
+<input type="hidden" name="action" value="'.$action.'">
+';
+
+$class='grey';
+echo '<tr>';
+echo '<td class="smheading" width="170">If server =</td>';
+echo '<td class="'.$class.'">';
+echo '<select class="searchform" name="serverip">';
+foreach($serverips as $id => $bla) {
+ echo '<option value="'.$serverips[$id].'">'. $serverips[$id];
+ if (!empty($servernames[$id])) echo ' ('. $servernames[$id] .')';
+ echo '</option>';
+ }
+echo '</select>';
+echo '</td></tr>';
+
+
+echo '<tr><td class="smheading" nowrap>and gamename =</td>';
+echo '<td class="'.$class.'">';
+
+echo '<select class="searchform" name="gamename">';
+foreach($gamenames as $id => $bla) {
+ if ($gamenames[$id] == '(user defined)') continue;
+ echo '<option value="'.$gamenames[$id].'">'. $gamenames[$id];
+ if (!empty($gamedisplaynames[$id])) echo ' ('. $gamedisplaynames[$id] .')';
+ echo '</option>';
+}
+echo '</select>';
+echo '</td></tr>';
+
+
+echo '<tr><td class="smheading" nowrap>and mutatorlist contains</td>';
+echo '<td class="'.$class.'">';
+echo '<input type="text" class="searchform" name="mutator" value="*"> <span class="text2">(case insensitive substring)</span>';
+echo '</td></tr>';
+
+
+echo '<tr><td class="smheading" nowrap>==> assume gametype:</td>';
+echo '<td class="'.$class.'">';
+
+echo '<select class="searchform" name="gid">';
+foreach($gamenames as $id => $bla) {
+ if ($gamenames[$id] == '*') continue;
+ echo '<option value="'.$id.'">'. $gamenames[$id];
+ if (!empty($gamedisplaynames[$id])) echo ' ['. $gamedisplaynames[$id] .']';
+ echo '</option>';
+}
+echo '</select>';
+echo '</td></tr>';
+
+echo '<tr><td class="smheading">Update existing matches:</td>';
+echo '<td class="'.$class.'">';
+echo '<input type="checkbox" checked name="update"> <span class="text2">(this cannot be undone easily!)</span>';
+echo '</td></tr>';
+
+
+echo '<tr>';
+echo '<td class="'.$class.'" colspan="2" align="center"><input class="searchformb" type="Submit" name="submit" value="Add"></td>';
+echo '</tr>';
+
+echo'</form>
+ <tr>
+ <td class="smheading" align="center" colspan="2"><a class="grey" href="./admin.php?key='.$_REQUEST[key].'">Go Back To Admin Page</a></td>
+</tr>
+</table>';
+
+?>
diff --git a/html/pages/admin/editweapons.php b/html/pages/admin/editweapons.php new file mode 100755 index 0000000..2baeab9 --- /dev/null +++ b/html/pages/admin/editweapons.php @@ -0,0 +1,58 @@ +<?php
+if (empty($import_adminkey) or isset($_REQUEST['import_adminkey']) or $import_adminkey != $adminkey) die('bla');
+
+if (isset($_REQUEST['submit'])) {
+ foreach($_REQUEST['image'] as $id => $bla) {
+ mysql_query(" UPDATE uts_weapons
+ SET image = '". my_addslashes($_REQUEST['image'][$id]) ."',
+ sequence = '". my_addslashes($_REQUEST['sequence'][$id]) ."',
+ hide = '". (isset($_REQUEST['hide'][$id]) ? 'Y' : 'N') ."'
+ WHERE id = '$id';") or die(mysql_error());
+ }
+}
+
+echo'<br><table border="0" cellpadding="1" cellspacing="2" width="600">
+<tr>
+ <td class="medheading" align="center" colspan="4">Edit weapons</td>
+</tr>
+<tr>
+ <td class="smheading">Name</td>
+ <td class="smheading" align="center" '.OverlibPrintHint('', 'Image to display instead of the weapon\'s name<br>Should exist in images/weapons/<br>Leave empty to display the weapon name').'>Image</td>
+ <td class="smheading" '.OverlibPrintHint('', 'Use this number to set the weapons order to your liking').'>Order</td>
+ <td class="smheading" '.OverlibPrintHint('', 'If checked, this weapon won\'t be shown (including kills, shots, acc, ...)').'>Hide</td>
+</tr>
+<form action="'.$_SERVER['PHP_SELF'].'" method="POST">
+<input type="hidden" name="key" value="'.$adminkey.'">
+<input type="hidden" name="action" value="'.$action.'">
+';
+
+
+$sql_weapons = "SELECT id, name, image, sequence, hide FROM uts_weapons ORDER BY sequence ASC;";
+$q_weapons = mysql_query($sql_weapons) or die(mysql_error());
+$i = 0;
+while ($r_weapons = mysql_fetch_array($q_weapons)) {
+ $i++;
+ $class = ($i%2) ? 'grey' : 'grey2';
+ echo '<tr>';
+ echo '<td class="'.$class.'">'.htmlentities($r_weapons['name']).'</td>';
+ echo '<td class="'.$class.'">';
+ echo '<table border="0" cellspacing="0" cellpadding="0" width="100%"><tr><td width="60%">';
+ echo '<input class="searchform" type="text" name="image['.$r_weapons['id'].']" value="'.$r_weapons['image'].'">';
+ echo '</td><td width="40%" align="center">';
+ if (!empty($r_weapons['image'])) echo ' <img src="images/weapons/'. $r_weapons['image'] .'" border="0">';
+ echo' </td></tr></table></td>';
+ echo '<td class="'.$class.'"><input class="searchform" type="text" name="sequence['.$r_weapons['id'].']" value="'.$r_weapons['sequence'].'" size="3" maxlength="3"></td>';
+ echo '<td class="'.$class.'"><input class="searchform" type="checkbox" name="hide['.$r_weapons['id'].']" '.($r_weapons['hide'] == 'Y' ? 'checked' : '').'></td>';
+ echo '</tr>';
+}
+
+echo '<tr>';
+echo '<td class="darkgrey" colspan="4" align="center"><input class="searchformb" type="Submit" name="submit" value="Save"></td>';
+echo '</tr>';
+
+echo'</form>
+ <tr>
+ <td class="smheading" align="center" colspan="4"><a class="grey" href="./admin.php?key='.$_REQUEST[key].'">Go Back To Admin Page</a></td>
+</tr></table>';
+
+?>
diff --git a/html/pages/admin/emptydb.php b/html/pages/admin/emptydb.php new file mode 100755 index 0000000..9eee7d2 --- /dev/null +++ b/html/pages/admin/emptydb.php @@ -0,0 +1,62 @@ +<?php
+if (empty($import_adminkey) or isset($_REQUEST['import_adminkey']) or $import_adminkey != $adminkey) die('bla');
+
+$options['title'] = 'Empty the Database';
+$i = 0;
+$options['vars'][$i]['name'] = 'sure';
+$options['vars'][$i]['type'] = 'static';
+$options['vars'][$i]['options'] = 'No|Yes';
+$options['vars'][$i]['exitif'] = 'No';
+$options['vars'][$i]['prompt'] = 'Are you sure (all data will be lost)?';
+$options['vars'][$i]['caption'] = 'Sure:';
+$i++;
+$options['vars'][$i]['name'] = 'really';
+$options['vars'][$i]['type'] = 'static';
+$options['vars'][$i]['options'] = 'No|Yes';
+$options['vars'][$i]['exitif'] = 'No';
+$options['vars'][$i]['prompt'] = 'Are you really sure (this can NOT be undone)?';
+$options['vars'][$i]['caption'] = 'Really sure (last warning):';
+$i++;
+
+$results = adminselect($options);
+
+
+IF ($results['sure'] == "Yes" and $results['really'] == "Yes") {
+ echo'<br><table border="0" cellpadding="1" cellspacing="2" width="600">
+ <tr>
+ <td class="smheading" align="center" colspan="2">Empty Database</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="left" width="300">Emptying All Tables but uts_ip2country and uts_weaponstats</td>';
+ mysql_query("TRUNCATE uts_events;") or die(mysql_error());
+ mysql_query("TRUNCATE uts_games;") or die(mysql_error());
+ mysql_query("TRUNCATE uts_gamestype;") or die(mysql_error());
+ mysql_query("TRUNCATE uts_killsmatrix;") or die(mysql_error());
+ mysql_query("TRUNCATE uts_match;") or die(mysql_error());
+ mysql_query("TRUNCATE uts_pinfo;") or die(mysql_error());
+ mysql_query("TRUNCATE uts_player;") or die(mysql_error());
+ mysql_query("TRUNCATE uts_rank;") or die(mysql_error());
+ mysql_query("DELETE FROM uts_weapons WHERE id > 19") or die(mysql_error());
+ mysql_query("ALTER TABLE uts_weapons AUTO_INCREMENT=20") or die(mysql_error());
+ mysql_query("TRUNCATE uts_weaponstats;") or die(mysql_error());
+ echo'<td class="grey" align="left" width="300">Done</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center" colspan="2">Database Emptied - <a href="./admin.php?key='.$_REQUEST[key].'">Go Back To Admin Page</a></td>
+ </tr></table>';
+} else {
+ echo'<br><table border="0" cellpadding="1" cellspacing="2" width="600">
+ <tr>
+ <td class="smheading" align="center" colspan="2">Empty Database</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="left" width="300">Database Not Emptied</td>
+ <td class="grey" align="left" width="300">Answer Was No</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center" colspan="2">Database Not Emptied - <a href="./admin.php?key='.$_REQUEST[key].'">Go Back To Admin Page</a></td>
+ </tr></table>';
+}
+
+
+?>
diff --git a/html/pages/admin/index.htm b/html/pages/admin/index.htm new file mode 100755 index 0000000..e69de29 --- /dev/null +++ b/html/pages/admin/index.htm diff --git a/html/pages/admin/ipsearch.php b/html/pages/admin/ipsearch.php new file mode 100755 index 0000000..4ac9731 --- /dev/null +++ b/html/pages/admin/ipsearch.php @@ -0,0 +1,58 @@ +<?php
+if (empty($import_adminkey) or isset($_REQUEST['import_adminkey']) or $import_adminkey != $adminkey) die('bla');
+
+$options['requireconfirmation'] = false;
+$options['title'] = 'IP Search';
+$i = 0;
+$options['vars'][$i]['name'] = 'ip_from';
+$options['vars'][$i]['type'] = 'text';
+$options['vars'][$i]['prompt'] = 'Enter the IP you want to search from:';
+$options['vars'][$i]['caption'] = 'IP from:';
+$i++;
+$options['vars'][$i]['name'] = 'ip_to';
+$options['vars'][$i]['type'] = 'text';
+$options['vars'][$i]['initialvalue'] = 'ip_from';
+$options['vars'][$i]['prompt'] = 'Enter the IP you want to search to:';
+$options['vars'][$i]['caption'] = 'IP to:';
+$i++;
+
+$results = adminselect($options);
+
+
+$ip_from = $results['ip_from'];
+$ip_to = $results['ip_to'];
+
+echo'<br><table border="0" cellpadding="1" cellspacing="2" width="600">
+<tr>
+ <td class="smheading" align="center" colspan="2">Players using IPs '.$ip_from.' - '.$ip_to.' and their last 5 matches using these IPs</td>
+</tr>';
+
+
+$sql_players = "SELECT pi.name, pi.id AS pid FROM uts_player p, uts_pinfo pi WHERE p.pid = pi.id AND p.ip BETWEEN INET_ATON('$ip_from') AND INET_ATON('$ip_to') GROUP BY pid";
+$q_players = mysql_query($sql_players) or die(mysql_error());
+$j = 0;
+while ($r_players = mysql_fetch_array($q_players)) {
+ echo '<tr>';
+ echo '<td class="dark" align="center" valign="top" width="150">';
+ echo '<a class="darkhuman" href="admin.php?action=pinfo&pid='.$r_players['pid'].'">'.$r_players['name'].'</a></td>';
+ $sql_recent = "SELECT m.time AS time, m.id AS mid, INET_NTOA(p.ip) AS ip FROM uts_player p, uts_match m WHERE m.id = p.matchid AND p.pid = '${r_players['pid']}' AND p.ip BETWEEN INET_ATON('$ip_from') AND INET_ATON('$ip_to') ORDER BY m.time DESC LIMIT 0,5";
+ echo '<td class="grey">';
+ echo '<table width="100%" border="0" cellspacing="0" cellpadding="2">';
+ $q_recent= mysql_query($sql_recent) or die(mysql_error());
+ while ($r_recent = mysql_fetch_array($q_recent)) {
+ $j++;
+ $class = ($j%2) ? 'grey' : 'grey2';
+ echo '<tr><td class="'.$class.'" align="center" width="60%">';
+ echo '<a class="'.$class.'" href="./?p=match&mid='.$r_recent['mid'].'">'.mdate($r_recent['time']).'</a>';
+ echo '</td><td class="'.$class.'" align="center">';
+ echo $r_recent['ip'];
+ echo '</td></tr>';
+ }
+ echo '</table></td></tr>';
+}
+
+
+echo'<tr>
+ <td class="smheading" align="center" colspan="2"><a class="grey" href="./admin.php?key='.$_REQUEST[key].'">Go Back To Admin Page</a></td>
+</tr></table>';
+?>
diff --git a/html/pages/admin/main.php b/html/pages/admin/main.php new file mode 100755 index 0000000..4d60302 --- /dev/null +++ b/html/pages/admin/main.php @@ -0,0 +1,117 @@ +<?php
+if (empty($import_adminkey) or isset($_REQUEST['import_adminkey']) or $import_adminkey != $adminkey) die('bla');
+if (isset($_REQUEST['droptable'])) {
+ $droptable = my_addslashes($_REQUEST['droptable']);
+ if (substr($droptable, 0, 9) == 'uts_temp_' and strlen($droptable) == 17) {
+ mysql_query("DROP TABLE $droptable;") or die(mysql_error());
+ } else {
+ die('NO!');
+ }
+}
+
+
+// Graph width
+$max_width = 150;
+function nf($number) {
+ return(number_format($number));
+}
+
+
+echo'<table class = "box" border="0" cellpadding="1" cellspacing="2" width="600">
+<tr>
+ <td class="smheading" align="center" height="25" colspan="4">Database Statistics</td>
+</tr>';
+
+$q_dbsize = mysql_query("SHOW table STATUS") or die(mysql_error());
+$tot_size = 0;
+$tot_rows = 0;
+$max_size = 0;
+while ($r_dbsize = mysql_fetch_array($q_dbsize)) {
+ if (substr($r_dbsize['Name'], 0, 4) != 'uts_') continue;
+ $size = $r_dbsize['Data_length'] + $r_dbsize['Index_length'];
+ $rows = $r_dbsize['Rows'];
+ $tables[] = array (
+ 'name' => $r_dbsize['Name'],
+ 'size' => $size,
+ 'rows' => $rows
+ );
+ $tot_size += $size;
+ $tot_rows += $rows;
+ if ($max_size < $size) $max_size = $size;
+
+}
+
+$i = 0;
+foreach($tables as $table) {
+ $i++;
+ $class = ($i%2) ? 'grey' : 'grey2';
+
+ $d_size = file_size_info($table['size']);
+ $title = get_dp($table['size'] / $tot_size * 100) .' %';
+ echo'<tr>
+ <td class="smheading" align="left" width="200">';
+ if (substr($table['name'], 0, 9) == 'uts_temp_' and strlen($table['name']) == 17) {
+ echo '<a href="admin.php?key='. urlencode($adminkey) .'&action=main&droptable='.htmlentities($table['name']).'"><img src="images/del.png" border="0" width="16" height="16" title="Click to drop this table" alt="Delete" /></a><em>'.$table['name'].'</em>';
+ } else {
+ echo $table['name'];
+ }
+ echo '</td>
+ <td class="'.$class.'" align="right">'.nf($table['rows']).' rows</td>
+ <td class="'.$class.'" align="right">'.$d_size['size'] .' '. $d_size['type'].'</td>
+ <td class="'.$class.'" width="'.($max_width + 5).'"><img border="0" src="images/bars/h_bar'. ($i % 16 + 1) .'.png" height="10" width="'.(int)($table['size'] / $max_size * $max_width).'" alt="'. $title .'" title="'. $title .'"></td>
+ </tr>';
+}
+
+$d_size = file_size_info($tot_size);
+echo'<tr>
+ <td class="smheading" align="left" width="200">Total Database Size</td>
+ <td class="darkgrey" align="right">'.nf($tot_rows).' rows</td>
+ <td class="darkgrey" align="right">'.$d_size['size'] .' '. $d_size['type'].'</td>
+ <td class="darkgrey" > </td>
+</tr>
+</table><br>';
+
+echo'<table border="0" cellpadding="1" cellspacing="2" width="600">
+ <tr><td width="100%">';
+
+echo '
+ <ul>';
+ echo '<li><a href="admin.php?key='. urlencode($adminkey) .'&action=mplayers">Merge Players</a></li>';
+ echo '<li><a href="admin.php?key='. urlencode($adminkey) .'&action=mservers">Merge Servers</a></li>';
+ echo '<li><a href="admin.php?key='. urlencode($adminkey) .'&action=plm">Merge IPs with more than 1 Player</a></li>';
+ echo '<br>';
+ echo '<li><a href="admin.php?key='. urlencode($adminkey) .'&action=dmatch">Delete Match</a></li>';
+ echo '<li><a href="admin.php?key='. urlencode($adminkey) .'&action=dpmatch">Delete Player From Match</a></li>';
+ echo '<li><a href="admin.php?key='. urlencode($adminkey) .'&action=dplayer">Delete Player</a></li>';
+ echo '<br>';
+ echo '<li><a href="admin.php?key='. urlencode($adminkey) .'&action=pban&saction=ban">Ban Player</a></li>';
+ echo '<li><a href="admin.php?key='. urlencode($adminkey) .'&action=pban&saction=unban">Unban Player</a></li>';
+ echo '<br>';
+ echo '<li><a href="admin.php?key='. urlencode($adminkey) .'&action=pinfo">Extended Player Info</a></li>';
+ echo '<li><a href="admin.php?key='. urlencode($adminkey) .'&action=ipsearch">Search IP</a></li>';
+ if ($import_utdc_download_enable) {
+ echo '<li><a href="admin.php?key='. urlencode($adminkey) .'&action=utdclog">View UTDC logs</a></li>';
+ }
+ if ($import_ac_download_enable) {
+ echo '<li><a href="admin.php?key='. urlencode($adminkey) .'&action=aclog">View AnthChecker logs</a></li>';
+ }
+ if ($import_ace_download_enable) {
+ echo '<li><a href="admin.php?key='. urlencode($adminkey) .'&action=acelog">View ACE logs</a></li>';
+ }
+ echo '<br>';
+ echo '<li><a href="admin.php?key='. urlencode($adminkey) .'&action=editweapons">Edit Weapons</a></li>';
+ echo '<li><a href="admin.php?key='. urlencode($adminkey) .'&action=editgames">Add/Edit Game Names</a></li>';
+ echo '<li><a href="admin.php?key='. urlencode($adminkey) .'&action=editgamestype">Add/Edit Game Types</a></li>';
+ echo '<li><a href="admin.php?key='. urlencode($adminkey) .'&action=recalcranking">Recalculate Rankings</a></li>';
+ echo '<li><a href="admin.php?key='. urlencode($adminkey) .'&action=recalcflags">Recalculate Countryflags</a></li>';
+ echo '<br>';
+ echo '<li><a href="admin.php?key='. urlencode($adminkey) .'&action=check">Check server settings</a></li>';
+ echo '<li><a href="admin.php?key='. urlencode($adminkey) .'&action=emptydb">Empty the database</a></li>';
+echo '
+</ul>
+';
+
+
+
+echo'</td></tr></table>';
+?>
diff --git a/html/pages/admin/mplayers.php b/html/pages/admin/mplayers.php new file mode 100755 index 0000000..3754d99 --- /dev/null +++ b/html/pages/admin/mplayers.php @@ -0,0 +1,91 @@ +<?php
+if (empty($import_adminkey) or isset($_REQUEST['import_adminkey']) or $import_adminkey != $adminkey) die('bla');
+
+$options['title'] = 'Merge Players';
+$i = 0;
+$options['vars'][$i]['name'] = 'mplayer1';
+$options['vars'][$i]['type'] = 'player';
+$options['vars'][$i]['prompt'] = 'Choose player to merge to:';
+$options['vars'][$i]['caption'] = 'Player to merge to:';
+$i++;
+$options['vars'][$i]['name'] = 'mplayer2';
+$options['vars'][$i]['type'] = 'player';
+$options['vars'][$i]['prompt'] = 'Choose player to merge from:';
+$options['vars'][$i]['caption'] = 'Player to merge from:';
+$options['vars'][$i]['exclude'] = 'mplayer1';
+$i++;
+
+$results = adminselect($options);
+
+
+
+$mplayer1 = $results['mplayer1'];
+$mplayer2 = $results['mplayer2'];
+
+
+$mp1name = small_query("SELECT name FROM uts_pinfo WHERE id = $mplayer1");
+$mp2name = small_query("SELECT name FROM uts_pinfo WHERE id = $mplayer2");
+
+echo'<br><table border="0" cellpadding="1" cellspacing="2" width="600">
+<tr>
+ <td class="smheading" align="center" colspan="2">Merging '.$mp2name[name].' Into '.$mp1name[name].'</td>
+</tr>
+<tr>
+ <td class="smheading" align="left" width="200">Removing Info Records</td>';
+mysql_query("DELETE FROM uts_pinfo WHERE id = $mplayer2") or die(mysql_error());
+ echo'<td class="grey" align="left" width="400">Done</td>
+</tr>
+<tr>
+ <td class="smheading" align="left" width="200">Updating Player Records</td>';
+mysql_query("UPDATE uts_player SET pid = $mplayer1 WHERE pid = $mplayer2") or die(mysql_error());
+ echo'<td class="grey" align="left" width="400">Done</td>
+</tr>
+<tr>
+ <td class="smheading" align="left" width="200">Updating Weapon Records</td>';
+mysql_query("UPDATE uts_weaponstats SET pid = $mplayer1 WHERE pid = $mplayer2") or die(mysql_error());
+mysql_query("DELETE FROM uts_weaponstats WHERE pid = $mplayer2") or die(mysql_error());
+ echo'<td class="grey" align="left" width="400">Done</td>
+</tr>
+<tr>
+ <td class="smheading" align="left" width="200">Amending Player Weapon Stats:</td>';
+mysql_query("DELETE FROM uts_weaponstats WHERE matchid='0' AND pid = '$mplayer1'") or die(mysql_error());
+
+$q_weaponstats = mysql_query("SELECT weapon, SUM(kills) AS kills, SUM(shots) AS shots, SUM(hits) as hits, SUM(damage) as damage, AVG(acc) AS acc FROM uts_weaponstats WHERE pid = '$mplayer1' GROUP BY weapon") or die(mysql_error());
+while ($r_weaponstats = mysql_fetch_array($q_weaponstats)) {
+ mysql_query("INSERT INTO uts_weaponstats SET matchid='0', pid='$mplayer1', weapon='${r_weaponstats['weapon']}', kills='${r_weaponstats['kills']}', shots='${r_weaponstats['shots']}', hits='${r_weaponstats['hits']}', damage='${r_weaponstats['damage']}', acc='${r_weaponstats['acc']}'") or die(mysql_error());
+}
+ echo'<td class="grey" align="left" width="400">Done</td>
+</tr>
+<tr>
+ <td class="smheading" align="left" width="200">Updating First Blood Records</td>';
+mysql_query("UPDATE uts_match SET firstblood = $mplayer1 WHERE firstblood = $mplayer2") or die(mysql_error());
+ echo'<td class="grey" align="left" width="400">Done</td>
+</tr>
+<tr>
+ <td class="smheading" align="left" width="200">Temporary Rank</td>';
+mysql_query("UPDATE uts_rank SET pid = $mplayer2 WHERE pid= $mplayer1") or die(mysql_error());
+ echo'<td class="grey" align="left" width="400">Done</td>
+</tr>
+<tr>
+ <td class="smheading" align="left" width="200">Creating New Rank</td>';
+
+$sql_nrank = "SELECT SUM(time) AS time, pid, gid, AVG(rank) AS rank, AVG(prevrank) AS prevrank, SUM(matches) AS matches FROM uts_rank WHERE pid = $mplayer2 GROUP BY pid, gid";
+$q_nrank = mysql_query($sql_nrank) or die(mysql_error());
+while ($r_nrank = mysql_fetch_array($q_nrank)) {
+
+ mysql_query("INSERT INTO uts_rank SET time = '$r_nrank[time]', pid = $mplayer1, gid = $r_nrank[gid], rank = '$r_nrank[rank]', prevrank = '$r_nrank[prevrank]', matches = $r_nrank[matches]") or die(mysql_error());
+}
+
+ echo'<td class="grey" align="left" width="400">Done</td>
+</tr>
+<tr>
+ <td class="smheading" align="left" width="200">Removing Old Rank</td>';
+mysql_query("DELETE FROM uts_rank WHERE pid = $mplayer2") or die(mysql_error());
+ echo'<td class="grey" align="left" width="400">Done</td>
+</tr>
+<tr>
+ <td class="smheading" align="center" colspan="2">Player Record Merged - <a href="./admin.php?key='.$_REQUEST[key].'">Go Back To Admin Page</a></td>
+</tr>
+</table>';
+
+?>
diff --git a/html/pages/admin/mservers.php b/html/pages/admin/mservers.php new file mode 100755 index 0000000..b52a9d1 --- /dev/null +++ b/html/pages/admin/mservers.php @@ -0,0 +1,41 @@ +<?php
+if (empty($import_adminkey) or isset($_REQUEST['import_adminkey']) or $import_adminkey != $adminkey) die('bla');
+
+$options['title'] = 'Merge Servers';
+$i = 0;
+$options['vars'][$i]['name'] = 'mserver1';
+$options['vars'][$i]['type'] = 'server';
+$options['vars'][$i]['prompt'] = 'Choose the server to merge to:';
+$options['vars'][$i]['caption'] = 'Server to merge to:';
+$i++;
+$options['vars'][$i]['name'] = 'mserver2';
+$options['vars'][$i]['type'] = 'server';
+$options['vars'][$i]['prompt'] = 'Choose the server to merge from:';
+$options['vars'][$i]['caption'] = 'Server to merge from:';
+$options['vars'][$i]['exclude'] = 'mserver1';
+$i++;
+
+$results = adminselect($options);
+
+
+$mserver1 = $results[mserver1];
+$mserver2 = $results[mserver2];
+
+$q_myserver1 = small_query("SELECT servername, serverip FROM uts_match WHERE id = $mserver1");
+$q_myserver2 = small_query("SELECT servername, serverip FROM uts_match WHERE id = $mserver2");
+
+echo'<br><table border="0" cellpadding="1" cellspacing="2" width="600">
+<tr>
+ <td class="smheading" align="center" colspan="2">Merging '.$q_myserver2[servername].' ('.$q_myserver2[serverip].')<br>
+ Into '.$q_myserver1[servername].' ('.$q_myserver1[serverip].')</td>
+</tr>
+<tr>
+ <td class="smheading" align="left" width="200">Merging Records</td>';
+mysql_query("UPDATE uts_match SET serverip = '". addslashes($q_myserver1[serverip]) ."', servername = '". addslashes($q_myserver1[servername]) ."' WHERE serverip = '". addslashes($q_myserver2[serverip]) ."' and servername = '". addslashes($q_myserver2[servername]) ."'") or die(mysql_error());
+ echo'<td class="grey" align="left" width="400">Done</td>
+</tr>
+<tr>
+ <td class="smheading" align="center" colspan="2">Server Records Merged - <a href="./admin.php?key='.$_REQUEST[key].'">Go Back To Admin Page</a></td>
+</tr></table>';
+
+?>
diff --git a/html/pages/admin/pban.php b/html/pages/admin/pban.php new file mode 100755 index 0000000..f421ef5 --- /dev/null +++ b/html/pages/admin/pban.php @@ -0,0 +1,74 @@ +<?php
+if (empty($import_adminkey) or isset($_REQUEST['import_adminkey']) or $import_adminkey != $adminkey) die('bla');
+
+$ban = ($_REQUEST['saction'] == 'ban') ? true : false;
+
+if ($ban) {
+ $options['title'] = 'Ban Player';
+} else {
+ $options['title'] = 'Unban Player';
+}
+$i = 0;
+$options['vars'][$i]['name'] = 'pid';
+$options['vars'][$i]['type'] = 'player';
+if ($ban) {
+ $options['vars'][$i]['whereisbanned'] = 'N';
+} else {
+ $options['vars'][$i]['whereisbanned'] = 'Y';
+}
+$options['vars'][$i]['prompt'] = 'Player?';
+$options['vars'][$i]['caption'] = 'Player:';
+$i++;
+
+$results = adminselect($options);
+
+
+$pid = $results['pid'];
+
+if ($ban) {
+ echo'<br><table border="0" cellpadding="1" cellspacing="2" width="600">
+ <tr>
+ <td class="smheading" align="center" colspan="2">Banning Player</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="left">Removing Player Rank:</td>';
+ mysql_query("DELETE FROM uts_rank WHERE pid = $pid") or die(mysql_error());
+ echo'<td class="grey" align="left">Done</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="left">Updating Player Record:</td>';
+ mysql_query("UPDATE uts_pinfo SET banned = 'Y' WHERE id = $pid") or die(mysql_error());
+ echo'<td class="grey" align="left">Done</td>
+ </tr>
+
+ <tr>
+ <td class="smheading" align="center" colspan="2">Player Banned - <a href="./admin.php?key='.$_REQUEST[key].'">Go Back To Admin Page</a></td>
+ </tr></table>';
+} else {
+ echo'<table border="0" cellpadding="1" cellspacing="2" width="600">
+ <tr>
+ <td class="smheading" align="center" colspan="2">Unbanning Player</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="left">Updating Player Record:</td>';
+ mysql_query("UPDATE uts_pinfo SET banned = 'N' WHERE id = $pid") or die(mysql_error());
+ echo'<td class="grey" align="left">Done</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="left" width="200">Restoring Rankings</td>';
+
+ $sql_nrank = "SELECT SUM(gametime) AS time, pid, gid, SUM(rank) AS rank, COUNT(matchid) AS matches FROM uts_player WHERE pid = $pid GROUP BY pid, gid";
+ $q_nrank = mysql_query($sql_nrank) or die(mysql_error());
+ while ($r_nrank = mysql_fetch_array($q_nrank)) {
+
+ mysql_query("INSERT INTO uts_rank SET time = '$r_nrank[time]', pid = $pid, gid = $r_nrank[gid], rank = '$r_nrank[rank]', prevrank = '$r_nrank[rank]', matches = $r_nrank[matches]") or die(mysql_error());
+ }
+
+ echo'<td class="grey" align="left" width="400">Done</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center" colspan="2">Player Unbanned - <a href="./admin.php?key='.$_REQUEST[key].'">Go Back To Admin Page</a></td>
+ </tr></table>';
+}
+
+?>
diff --git a/html/pages/admin/pinfo.php b/html/pages/admin/pinfo.php new file mode 100755 index 0000000..7be13ae --- /dev/null +++ b/html/pages/admin/pinfo.php @@ -0,0 +1,91 @@ +<?php
+if (empty($import_adminkey) or isset($_REQUEST['import_adminkey']) or $import_adminkey != $adminkey) die('bla');
+
+$options['title'] = 'Extended Player Info';
+$options['requireconfirmation'] = false;
+$i = 0;
+$options['vars'][$i]['name'] = 'v_pid';
+$options['vars'][$i]['type'] = 'player';
+$options['vars'][$i]['prompt'] = 'Player?';
+$options['vars'][$i]['caption'] = 'Player:';
+$i++;
+
+if (isset($_REQUEST['pid'])) {
+ $pid = $_REQUEST['pid'];
+}else {
+ $results = adminselect($options);
+ $pid = $results['v_pid'];
+}
+
+$is_admin = true;
+include('pages/players_info.php');
+
+echo '<br>';
+
+$sql_ips = "SELECT INET_NTOA(p.ip) AS ip, COUNT(p.id) AS matches, MIN(m.time) AS first, MAX(m.time) AS last FROM uts_player AS p, uts_match AS m WHERE p.pid = ".$pid." AND m.id = p.matchid GROUP BY ip ORDER BY ip";
+$q_ips = mysql_query($sql_ips) or die("Can't get ip's: " . mysql_error());
+echo '
+<table class = "box" border="0" cellpadding="1" cellspacing="2" width="720">
+ <tbody>
+ <tr>
+ <td class="heading" colspan="5" align="center">IP\'s used</td>
+ </tr>
+ <tr>
+ <td class="smheading" width="80" align = "center">IP</td>
+ <td class="smheading" width="180" align = "left">Hostname</td>
+ <td class="smheading" width="60" align = "center">Matches</td>
+ <td class="smheading" width="200" align = "left">First</td>
+ <td class="smheading" width="200" align = "left">Last</td>
+ </tr>';
+
+while ($r_ips = mysql_fetch_assoc($q_ips)) {
+ echo '
+ <tr>
+ <td class="grey" align = "center">'.$r_ips['ip'].'</td>
+ <td class="grey" align = "left">'.gethostbyaddr($r_ips['ip']).'</td>
+ <td class="grey" align = "center">'.$r_ips['matches'].'</td>
+ <td class="grey" align = "left">'.mdate($r_ips['first']).'</td>
+ <td class="grey" align = "left">'.mdate($r_ips['last']).'</td>
+ </tr>';
+}
+
+echo '
+ </tbody>
+</table>
+<div class="opnote">* Hostnames are real time and might have been different at the time of playing. *</div>
+<br>';
+
+mysql_free_result($q_ips);
+
+$sql_fakes = "SELECT INET_NTOA(p1.ip) AS ip, pi.name FROM uts_player AS p1, uts_player AS p2, uts_pinfo AS pi WHERE p1.pid = ".$pid." AND p1.ip = p2.ip AND p1.pid <> p2.pid AND pi.id = p2.pid GROUP BY pi.name";
+$q_fakes = mysql_query($sql_fakes) or die("Can't retrieve fake nicks: " . mysql_error());
+echo '
+<table class = "box" border="0" cellpadding="1" cellspacing="2" width="480">
+ <tbody>
+ <tr>
+ <td class="heading" colspan="2" align="center">Possible aliasses</td>
+ </tr>
+ <tr>
+ <td class="smheading" width="120" align = "center">Nick</td>
+ <td class="smheading" width="360" align = "center">IP</td>
+ </tr>';
+
+if (mysql_num_rows($q_fakes) == 0) {
+ echo '
+ <tr>
+ <td class="grey" align = "center" colspan="2">No other names found</td>
+ </tr>';
+}
+else {
+ while($r_fakes = mysql_fetch_assoc($q_fakes)) {
+ echo '
+ <tr>
+ <td class="grey" align = "center">'.$r_fakes[ip].'</td>
+ <td class="grey" align = "center">'.$r_fakes[name].'</td>
+ </tr>';
+ }
+}
+echo '
+ </tbody>
+</table><br>';
+?>
diff --git a/html/pages/admin/plm.php b/html/pages/admin/plm.php new file mode 100755 index 0000000..68992e2 --- /dev/null +++ b/html/pages/admin/plm.php @@ -0,0 +1,329 @@ +<?php
+if (empty($import_adminkey) or isset($_REQUEST['import_adminkey']) or $import_adminkey != $adminkey) die('bla');
+
+$debug = 0; // This enables debug messages
+
+/*
+** This function merges two playerss
+** @var $mplayer1 : The player to merge to
+** @var $mplayer2 : The player who gets merged into mplayer 1
+** @return null
+*/
+function merge_players($mplayer1, $mplayer2) {
+ $mp1name = small_query("SELECT name FROM uts_pinfo WHERE id = $mplayer1");
+ $mp2name = small_query("SELECT name FROM uts_pinfo WHERE id = $mplayer2");
+
+ mysql_query("DELETE FROM uts_pinfo WHERE id = $mplayer2") or die(mysql_error());
+ mysql_query("UPDATE uts_player SET pid = $mplayer1 WHERE pid = $mplayer2") or die(mysql_error());
+ mysql_query("UPDATE uts_weaponstats SET pid = $mplayer1 WHERE pid = $mplayer2") or die(mysql_error());
+ mysql_query("DELETE FROM uts_weaponstats WHERE pid = $mplayer2") or die(mysql_error());
+ mysql_query("DELETE FROM uts_weaponstats WHERE matchid='0' AND pid = '$mplayer1'") or die(mysql_error());
+
+ $q_weaponstats = mysql_query("SELECT weapon, SUM(kills) AS kills, SUM(shots) AS shots, SUM(hits) as hits, SUM(damage) as damage, AVG(acc) AS acc FROM uts_weaponstats WHERE pid = '$mplayer1' GROUP BY weapon") or die(mysql_error());
+ while ($r_weaponstats = mysql_fetch_array($q_weaponstats)) {
+ mysql_query("INSERT INTO uts_weaponstats SET matchid='0', pid='$mplayer1', weapon='${r_weaponstats['weapon']}', kills='${r_weaponstats['kills']}', shots='${r_weaponstats['shots']}', hits='${r_weaponstats['hits']}', damage='${r_weaponstats['damage']}', acc='${r_weaponstats['acc']}'") or die(mysql_error());
+ }
+ mysql_query("UPDATE uts_match SET firstblood = $mplayer1 WHERE firstblood = $mplayer2") or die(mysql_error());
+ mysql_query("UPDATE uts_rank SET pid = $mplayer2 WHERE pid= $mplayer1") or die(mysql_error());
+ $sql_nrank = "SELECT SUM(time) AS time, pid, gid, AVG(rank) AS rank, AVG(prevrank) AS prevrank, SUM(matches) AS matches FROM uts_rank WHERE pid = $mplayer2 GROUP BY pid, gid";
+ $q_nrank = mysql_query($sql_nrank) or die(mysql_error());
+ while ($r_nrank = mysql_fetch_array($q_nrank)) {
+
+ mysql_query("INSERT INTO uts_rank SET time = '$r_nrank[time]', pid = $mplayer1, gid = $r_nrank[gid], rank = '$r_nrank[rank]', prevrank = '$r_nrank[prevrank]', matches = $r_nrank[matches]") or die(mysql_error());
+ }
+ mysql_query("DELETE FROM uts_rank WHERE pid = $mplayer2") or die(mysql_error());
+}
+
+// If debugmode is on, get start time
+if($debug) {
+ $time = microtime();
+ $time = explode(' ', $time);
+ $time = $time[1] + $time[0];
+ $begintime = $time;
+}
+
+// Print header & links
+echo '<P><B>Player merging tool</B></P>';
+echo "<P><A href=admin.php?key=".$adminkey."&action=plm>Merge ip's</A> - <A href=admin.php?key=".$adminkey."&action=plm&onlyrange=true>Merge ip's, limited on range</A> - <A href=admin.php?key=".$adminkey."&action=plm&manignore=true>Manage ignored ip's</A> - <A href=admin.php?key=".$adminkey."&action=plm&manignore=true&onlyrange=true>Manage ignored ip's - only range</A><BR><BR></P>";
+
+// CASE: MANAGE IGNORED IPS
+if($_GET['manignore'] == "true") {
+ if($_POST['submit'] == "Remove from ignored list") {
+ echo "<P><B>Stopped ignore ip's</B></P>";
+ foreach($_POST as $key=>$value) {
+ if($key !='submit') {
+ $key = mysql_real_escape_string(str_replace("_",".",$key));
+ $query = "DELETE FROM uts_ignoreips WHERE ip = (INET_ATON('".$key."'))";
+ mysql_query($query) or die(mysql_error());
+ echo "<br>$key";
+ }
+ }
+ } else if($_GET['onlyrange'] == "true") {
+ if($_POST['submit'] == "Confirm") {
+ echo '<P><B>Ignored ip\'s in range '.htmlentities($_POST['from']).' to '.htmlentities($_POST['to']).'</B><br><I>If you want to stop ignoring some ip\'s, because for example you accidently ignored these, check these and press the button at the lower end to confirm this</I></P>';
+ echo '<FORM METHOD="POST" ACTION="admin.php?key='.$adminkey.'&action=plm&manignore=true" target="_blank">';
+
+ $from = mysql_real_escape_string($_POST['from']);
+ $to = mysql_real_escape_string($_POST['to']);
+
+ $ignore_ips = mysql_query("SELECT ip FROM uts_ignoreips WHERE ip >= INET_ATON('$from') AND ip <= INET_ATON('$to') ORDER BY ip ASC");
+
+ if(mysql_num_rows($ignore_ips) > 0) {
+ while ($r_pipcheck = mysql_fetch_array($ignore_ips)) {
+
+ $playerip = $r_pipcheck[ip];
+ $trueplayerip = long2ip($playerip);
+ $pidcount = $r_pipcheck[pidcount];
+
+ echo "<br><input type=checkbox name=$trueplayerip> <b>$trueplayerip</b>";
+
+ // Query for player names and ids associated to that ip during the cycle
+ $sql_pcheck = "SELECT pi.id, pi.name, pi.country, p.pid, p.ip FROM uts_pinfo AS pi, uts_player AS p WHERE pi.id = p.pid AND p.ip = $playerip GROUP BY pi.id, pi.name, p.pid, p.ip, pi.country";
+ $q_pcheck = mysql_query($sql_pcheck) or die(mysql_error());
+ while ($r_pcheck = mysql_fetch_array($q_pcheck)) {
+ echo '<br><a class="darkhuman" href="admin.php?key='.$adminkey.'&action=pinfo&pid='.$r_pcheck[pid].'">'.FormatPlayerName($r_pcheck[country], $r_pcheck['pid'], $r_pcheck['name']).'</a> ';
+ }
+ echo '<br />';
+ }
+ echo '<BR><INPUT TYPE="SUBMIT" VALUE="Remove from ignored list" NAME="submit"></FORM>';
+ } else {
+ echo "<BR><P>No ignored ip's found</P>";
+ }
+ } else {
+ echo "<P><B>Ignored ip's in range: Enter range to filter on</B></P>";
+ echo '<FORM METHOD="POST" ACTION="admin.php?key='.$adminkey.'&action=plm&manignore=true&onlyrange=true">';
+ echo '<BR>Ranging from <INPUT TYPE="TEXT" NAME="from" SIZE="20" VALUE="0.0.0.0"> to <INPUT TYPE="TEXT" NAME="to" SIZE="20" VALUE="255.255.255.255">';
+ echo '<BR><BR><INPUT TYPE="SUBMIT" NAME="submit" VALUE="Confirm"></FORM>';
+ }
+ } else {
+ echo '<P><B>Ignored ip\'s</B><br><I>If you want to stop ignoring some ip\'s, because for example you accidently ignored these, check these and press the button at the lower end to confirm this</I></P>';
+ echo '<FORM METHOD="POST" ACTION="admin.php?key='.$adminkey.'&action=plm&manignore=true" target="_blank">';
+
+ $ignore_ips = mysql_query("SELECT ip FROM uts_ignoreips ORDER BY ip ASC");
+ if(mysql_num_rows($ignore_ips) > 0) {
+ while ($r_pipcheck = mysql_fetch_array($ignore_ips)) {
+
+ $playerip = $r_pipcheck[ip];
+ $trueplayerip = long2ip($playerip);
+ $pidcount = $r_pipcheck[pidcount];
+
+ echo "<br><input type=checkbox name=$trueplayerip> <b>$trueplayerip</b>";
+
+ // Query for player names and ids associated to that ip during the cycle
+ $sql_pcheck = "SELECT pi.id, pi.name, pi.country, p.pid, p.ip FROM uts_pinfo AS pi, uts_player AS p WHERE pi.id = p.pid AND p.ip = $playerip GROUP BY pi.id, pi.name, p.pid, p.ip, pi.country";
+ $q_pcheck = mysql_query($sql_pcheck) or die(mysql_error());
+ while ($r_pcheck = mysql_fetch_array($q_pcheck)) {
+ echo '<br><a class="darkhuman" href="admin.php?key='.$adminkey.'&action=pinfo&pid='.$r_pcheck[pid].'">'.FormatPlayerName($r_pcheck[country], $r_pcheck['pid'], $r_pcheck['name']).'</a> ';
+ }
+ echo '<br />';
+ }
+ echo '<BR><INPUT TYPE="SUBMIT" VALUE="Remove from ignored list" NAME="submit"></FORM>';
+ } else {
+ echo "<BR><P>No ignored ip's found</P>";
+ }
+ }
+
+// CASE: IGNORE SUBMITTED IP'S
+} else if($_POST['submit'] == "ignore") {
+ echo "<P><B>Ignored ips</B></P>";
+ foreach($_POST as $key=>$value) {
+ if($key !='submit') {
+ $key = mysql_real_escape_string(str_replace("_",".",$key));
+ $query = "INSERT INTO uts_ignoreips (ip) VALUES (INET_ATON('".$key."'))";
+ mysql_query($query) or die(mysql_error());
+ echo "<br>$key";
+ }
+ }
+ echo "<br>";
+
+// CASE: SHOW NICKS WITH GIVEN SHARED IP
+} else if(substr($_POST['submit'],0,8) == "merge - ") {
+ echo "<P><B>Merge nicks with shared ip</B></P>";
+
+ $ip = mysql_real_escape_string(str_replace("_",".",substr($_POST['submit'],8)));
+ $sql_pipcheck = "SELECT ip, COUNT(DISTINCT pid) AS pidcount FROM uts_player WHERE ip = INET_ATON('$ip') GROUP BY ip ORDER BY ip ASC";
+ $q_pipcheck = mysql_query($sql_pipcheck) or die(mysql_error());
+ while ($r_pipcheck = mysql_fetch_array($q_pipcheck)) {
+
+ $playerip = $r_pipcheck[ip];
+ $trueplayerip = long2ip($playerip);
+ $pidcount = $r_pipcheck[pidcount];
+
+ // If there is more than one pid associated to an IP ...
+ IF ($pidcount > 1 ) {
+ echo '<FORM METHOD="POST" ACTION="admin.php?key='.$adminkey.'&action=plm">';
+ echo "<br><b>$trueplayerip</b>";
+
+ // Query for player names and ids associated to that ip during the cycle
+ $sql_pcheck = "SELECT pi.id, pi.name, pi.country, p.pid, p.ip FROM uts_pinfo AS pi, uts_player AS p WHERE pi.id = p.pid AND p.ip = $playerip GROUP BY pi.id, pi.name, p.pid, p.ip, pi.country";
+
+ $q_pcheck = mysql_query($sql_pcheck) or die(mysql_error());
+ while ($r_pcheck = mysql_fetch_array($q_pcheck)) {
+ echo '<br><a class="darkhuman" href="./?p=pinfo&pid='.$r_pcheck[pid].'">'.FormatPlayerName($r_pcheck[country], $r_pcheck['pid'], $r_pcheck['name']).'</a> ';
+ $options .= '<OPTION value="'.$r_pcheck[pid].'">'.$r_pcheck['name'].'</OPTION>';
+ }
+ echo '<br><br>Merge to: <SELECT NAME="merge_to">'.$options.'</SELECT>';
+ echo "<br><INPUT TYPE=\"hidden\" NAME=\"ip\" VALUE=\"$ip\"><INPUT TYPE=\"SUBMIT\" VALUE=\"Player merge\" NAME=\"submit\"></FORM>";
+ echo '<br />';
+ }
+ }
+
+// CASE: MERGE NICKS WITH SHARED IP
+} else if($_POST['submit'] == "Player merge") {
+ echo "<P><B>Merging nicks with shared ip</B></P>";
+
+ $ip = mysql_real_escape_string(str_replace("_",".",$_POST['ip']));
+ $merge_to_pid = mysql_real_escape_string($_POST['merge_to']);
+ $sql_pipcheck = "SELECT ip, COUNT(DISTINCT pid) AS pidcount FROM uts_player WHERE ip = INET_ATON('$ip') GROUP BY ip ORDER BY ip ASC";
+ $q_pipcheck = mysql_query($sql_pipcheck) or die(mysql_error());
+ while ($r_pipcheck = mysql_fetch_array($q_pipcheck)) {
+
+ $playerip = $r_pipcheck[ip];
+ $trueplayerip = long2ip($playerip);
+ $pidcount = $r_pipcheck[pidcount];
+
+ // If there is more than one pid associated to an IP ...
+ IF ($pidcount > 1 ) {
+ echo "<b>$trueplayerip</b><br><br>merge:<br>";
+
+ // Query for player names and ids associated to that ip during the cycle
+ $sql_pcheck = "SELECT p.pid FROM uts_pinfo AS pi, uts_player AS p WHERE pi.id = p.pid AND p.ip = $playerip GROUP BY pi.id, pi.name, p.pid, p.ip, pi.country";
+
+ $q_pcheck = mysql_query($sql_pcheck) or die(mysql_error());
+ $i=0;
+ while ($r_pcheck = mysql_fetch_array($q_pcheck)) {
+ if($r_pcheck['pid'] != $merge_to_pid) {
+ $pid_from[$i] = $r_pcheck['pid'];
+ echo $pid_from[$i].'<br>';
+ $i++;
+ }
+ }
+ echo '<br />merge to: '.$merge_to_pid;
+ }
+ }
+ if($debug) echo "<br> -- started merging";
+ for($j=0;$j<count($pid_from);$j++) {
+ merge_players($merge_to_pid, $pid_from[$j]);
+ }
+ if($debug) echo "<br> -- merging ended";
+
+// CASE: SHOW ALL IP'S LINKED TO MORE THAN ONE NICK - ONLY RANGE
+} else if($_GET['onlyrange'] == "true") {
+ if($_POST['submit'] == "Confirm") {
+ echo "<P><B>Showing all ip's in range ".htmlentities($_POST['from'])." to ".htmlentities($_POST['to'])."</B><br><I>If you want to ignore some ip's, because for example different but unrelated nicks are associated with it, check these and press the button at the lower end to confirm this</I></P>";
+ $from = mysql_real_escape_string($_POST['from']);
+ $to = mysql_real_escape_string($_POST['to']);
+
+ $ignore_ips = mysql_query("SELECT ip FROM uts_ignoreips WHERE ip >= INET_ATON('$from') AND ip <= INET_ATON('$to')");
+ $extended_query = "WHERE ip >= INET_ATON('$from') AND ip <= INET_ATON('$to')";
+ $i=0;
+ while($ignore_ips_array = mysql_fetch_array($ignore_ips)) {
+ $ip = $ignore_ips_array[0];
+ $extended_query .= " AND ";
+ $extended_query .= "ip <> '".$ip."'";
+ $i++;
+ }
+
+ echo '<FORM METHOD="POST" ACTION="admin.php?key='.$adminkey.'&action=plm" target="_blank">';
+
+
+ // Query for list of unique ips and player ids
+ $sql_pipcheck = "SELECT ip, COUNT(DISTINCT pid) AS pidcount FROM uts_player ".$extended_query." GROUP BY ip ORDER BY ip ASC";
+ $q_pipcheck = mysql_query($sql_pipcheck) or die(mysql_error());
+ if(mysql_num_rows($q_pipcheck) > 0) {
+ while ($r_pipcheck = mysql_fetch_array($q_pipcheck)) {
+
+ $playerip = $r_pipcheck[ip];
+ $trueplayerip = long2ip($playerip);
+ $pidcount = $r_pipcheck[pidcount];
+
+ // If there is more than one pid associated to an IP ...
+ IF ($pidcount > 1 ) {
+
+ echo "<br><input type=checkbox name=$trueplayerip> <b>$trueplayerip</b>";
+
+ // Query for player names and ids associated to that ip during the cycle
+ $sql_pcheck = "SELECT pi.id, pi.name, pi.country, p.pid, p.ip FROM uts_pinfo AS pi, uts_player AS p WHERE pi.id = p.pid AND p.ip = $playerip GROUP BY pi.id, pi.name, p.pid, p.ip, pi.country";
+ $q_pcheck = mysql_query($sql_pcheck) or die(mysql_error());
+ while ($r_pcheck = mysql_fetch_array($q_pcheck)) {
+ echo '<br><a class="darkhuman" href="admin.php?key='.$adminkey.'&action=pinfo&pid='.$r_pcheck[pid].'">'.FormatPlayerName($r_pcheck[country], $r_pcheck['pid'], $r_pcheck['name']).'</a> ';
+ }
+ echo "<br><INPUT TYPE=\"SUBMIT\" VALUE=\"merge - $trueplayerip\" NAME=\"submit\">";
+ echo '<br />';
+ }
+ }
+
+
+ echo '<BR><INPUT TYPE="SUBMIT" VALUE="ignore" NAME="submit"></FORM>';
+ } else {
+ echo "<P><BR>No ip's found with more than one nick linked to it and which are not ignored and are in this range</P>";
+ }
+
+ } else {
+ echo "<P><B>Showing all ip's in range - Enter range to filter on</B></P>";
+ echo '<FORM METHOD="POST" ACTION="admin.php?key='.$adminkey.'&action=plm&onlyrange=true">';
+ echo '<BR>Ranging from <INPUT TYPE="TEXT" NAME="from" SIZE="20" VALUE="0.0.0.0"> to <INPUT TYPE="TEXT" NAME="to" SIZE="20" VALUE="255.255.255.255">';
+ echo '<BR><BR><INPUT TYPE="SUBMIT" NAME="submit" VALUE="Confirm"></FORM>';
+ }
+
+// CASE: SHOW ALL IP'S LINKED TO MORE THAN ONE NICK
+} else {
+ echo "<P><B>IP's linked with more than one nick</B><br><I>If you want to ignore some ip's, because for example different but unrelated nicks are associated with it, check these and press the button at the lower end to confirm this</I></P>";
+
+ $ignore_ips = mysql_query("SELECT ip FROM uts_ignoreips");
+ $extended_query = "";
+ $i=0;
+ while($ignore_ips_array = mysql_fetch_array($ignore_ips)) {
+ $ip = $ignore_ips_array[0];
+ if($i==0)
+ $extended_query = " WHERE ";
+ else
+ $extended_query .= " AND ";
+ $extended_query .= "ip <> '".$ip."'";
+ $i++;
+ }
+
+ echo '<FORM METHOD="POST" ACTION="admin.php?key='.$adminkey.'&action=plm" target="_blank">';
+
+
+ // Query for list of unique ips and player ids
+ $sql_pipcheck = "SELECT ip, COUNT(DISTINCT pid) AS pidcount FROM uts_player ".$extended_query." GROUP BY ip ORDER BY ip ASC";
+ $q_pipcheck = mysql_query($sql_pipcheck) or die(mysql_error());
+ if(mysql_num_rows($q_pipcheck) > 0) {
+ while ($r_pipcheck = mysql_fetch_array($q_pipcheck)) {
+
+ $playerip = $r_pipcheck[ip];
+ $trueplayerip = long2ip($playerip);
+ $pidcount = $r_pipcheck[pidcount];
+
+ // If there is more than one pid associated to an IP ...
+ IF ($pidcount > 1 ) {
+
+ echo "<br><input type=checkbox name=$trueplayerip> <b>$trueplayerip</b>";
+
+ // Query for player names and ids associated to that ip during the cycle
+ $sql_pcheck = "SELECT pi.id, pi.name, pi.country, p.pid, p.ip FROM uts_pinfo AS pi, uts_player AS p WHERE pi.id = p.pid AND p.ip = $playerip GROUP BY pi.id, pi.name, p.pid, p.ip, pi.country";
+ $q_pcheck = mysql_query($sql_pcheck) or die(mysql_error());
+ while ($r_pcheck = mysql_fetch_array($q_pcheck)) {
+ echo '<br><a class="darkhuman" href="admin.php?key='.$adminkey.'&action=pinfo&pid='.$r_pcheck[pid].'">'.FormatPlayerName($r_pcheck[country], $r_pcheck['pid'], $r_pcheck['name']).'</a> ';
+ }
+ echo "<br><INPUT TYPE=\"SUBMIT\" VALUE=\"merge - $trueplayerip\" NAME=\"submit\">";
+ echo '<br />';
+ }
+ }
+ echo '<BR><INPUT TYPE="SUBMIT" VALUE="ignore" NAME="submit"></FORM>';
+ } else {
+ echo "<P><BR>No ip's found with more than one nick linked to it and which are not ignored</P>";
+ }
+}
+
+// If debugmode is on, determine end time & output execution time
+if($debug) {
+ $time = microtime();
+ $time = explode(" ", $time);
+ $time = $time[1] + $time[0];
+ $endtime = $time;
+ $totaltime = ($endtime - $begintime);
+ echo "<br>execution time: $totaltime";
+}
+?>
\ No newline at end of file diff --git a/html/pages/admin/recalcflags.php b/html/pages/admin/recalcflags.php new file mode 100755 index 0000000..073e648 --- /dev/null +++ b/html/pages/admin/recalcflags.php @@ -0,0 +1,72 @@ +<?php
+if (empty($import_adminkey) or isset($_REQUEST['import_adminkey']) or $import_adminkey != $adminkey) die('bla');
+
+$options['title'] = 'Recalculate Countryflags';
+$options['requireconfirmation'] = false;
+$i = 0;
+$options['vars'][$i]['name'] = 'start';
+$options['vars'][$i]['type'] = 'static';
+$options['vars'][$i]['options'] = 'No|Yes';
+$options['vars'][$i]['exitif'] = 'No';
+$options['vars'][$i]['prompt'] = 'Are you sure';
+$options['vars'][$i]['caption'] = 'Sure:';
+$i++;
+
+$results = adminselect($options);
+
+if ($results['start'] != 'Yes') {
+ include('pages/admin/main.php');
+ exit;
+}
+@ignore_user_abort(true);
+@set_time_limit(0);
+
+include("includes/geoip.inc");
+
+/* Opens the database file */
+$gi = geoip_open("GeoIP.dat",GEOIP_STANDARD);
+
+
+echo'<br><table border="0" cellpadding="1" cellspacing="2" width="600">
+<tr>
+ <td class="smheading" align="center" colspan="2">Recalculating Countryflags</td>
+</tr>';
+
+echo'</tr>
+<tr>
+ <td class="smheading" align="left">Recalculating Rankings:</td>';
+ echo'<td class="grey" align="left">';
+
+ echo'Recalculating pinfo table...<br>';
+ /* update pinfo table */
+ $sql_pids = mysql_query("SELECT uts_pinfo.id as pid, uts_pinfo.country as country, uts_player.ip as ip FROM uts_pinfo, uts_player WHERE uts_pinfo.id = uts_player.pid GROUP BY uts_player.pid;") or die(mysql_error());
+ while($sql_pid = mysql_fetch_array($sql_pids))
+ {
+ $playercountry = strtolower(geoip_country_code_by_addr($gi,long2ip($sql_pid['ip'])));
+
+ if ($playercountry != $sql_pid['country'] )
+ {
+ mysql_query("UPDATE uts_pinfo SET country = '$playercountry' WHERE id = '".$sql_pid['pid']."'") or die(mysql_error());
+ }
+ }
+
+ echo'Recalculating player table...<br>';
+ /* update player table */
+ $sql_pids = mysql_query("SELECT pid, ip, country FROM uts_player");
+ while ($sql_pid = mysql_fetch_array($sql_pids))
+ {
+ $playercountry = strtolower(geoip_country_code_by_addr($gi,long2ip($sql_pid['ip'])));
+
+ if ($playercountry != $sql_pid['country'])
+ {
+ mysql_query("UPDATE uts_player SET country = '$playercountry' WHERE pid = '".$sql_pid['pid']."'") or die(mysql_error());
+ }
+ }
+ echo 'Done</td>
+</tr>
+
+<tr>
+ <td class="smheading" align="center" colspan="2">Countryflags recalculated - <a href="./admin.php?key='.$_REQUEST[key].'">Go Back To Admin Page</a></td>
+</tr></table>';
+
+?>
diff --git a/html/pages/admin/recalcranking.php b/html/pages/admin/recalcranking.php new file mode 100755 index 0000000..1cbc865 --- /dev/null +++ b/html/pages/admin/recalcranking.php @@ -0,0 +1,77 @@ +<?php
+if (empty($import_adminkey) or isset($_REQUEST['import_adminkey']) or $import_adminkey != $adminkey) die('bla');
+
+$options['title'] = 'Recalculate Rankings';
+$options['requireconfirmation'] = false;
+$i = 0;
+$options['vars'][$i]['name'] = 'start';
+$options['vars'][$i]['type'] = 'static';
+$options['vars'][$i]['options'] = 'No|Yes';
+$options['vars'][$i]['exitif'] = 'No';
+$options['vars'][$i]['prompt'] = 'Are you sure';
+$options['vars'][$i]['caption'] = 'Sure:';
+$i++;
+
+$results = adminselect($options);
+
+if ($results['start'] != 'Yes') {
+ include('pages/admin/main.php');
+ exit;
+}
+@ignore_user_abort(true);
+@set_time_limit(0);
+
+
+echo'<br><table border="0" cellpadding="1" cellspacing="2" width="600">
+<tr>
+ <td class="smheading" align="center" colspan="2">Recalculating Rankings</td>
+</tr>';
+
+echo'<tr>
+ <td class="smheading" align="left" width="200">Deleting rankings</td>';
+
+ mysql_query("TRUNCATE uts_rank") or die(mysql_error());
+
+ echo'<td class="grey" align="left" width="400">Done</td>';
+
+echo'</tr>
+<tr>
+ <td class="smheading" align="left">Recalculating Rankings:</td>';
+ echo'<td class="grey" align="left">';
+ $playerbanned = false;
+ $q_pm = mysql_query( " SELECT p.id,
+ p.matchid,
+ p.pid,
+ p.gid,
+ m.gamename
+ FROM uts_player p,
+ uts_pinfo pi,
+ uts_match m
+ WHERE pi.id = p.pid
+ AND pi.banned <> 'Y'
+ AND m.id = p.matchid
+ ORDER BY p.matchid ASC,
+ p.playerid ASC");
+ $i = 0;
+ while ($r_pm = mysql_fetch_array($q_pm)) {
+ $i++;
+ if ($i%50 == 0) {
+ echo '. ';
+ flush();
+ }
+ $playerecordid = $r_pm['id'];
+ $matchid = $r_pm['matchid'];
+ $pid = $r_pm['pid'];
+ $gid = $r_pm['gid'];
+ $gamename = $r_pm['gamename'];
+// echo "$pid|$gid|$matchid<br>";
+ include('import/import_ranking.php');
+ }
+ echo 'Done</td>
+</tr>
+
+<tr>
+ <td class="smheading" align="center" colspan="2">Rankings recalculated - <a href="./admin.php?key='.$_REQUEST[key].'">Go Back To Admin Page</a></td>
+</tr></table>';
+
+?>
diff --git a/html/pages/admin/utdclog.php b/html/pages/admin/utdclog.php new file mode 100755 index 0000000..b22bfd7 --- /dev/null +++ b/html/pages/admin/utdclog.php @@ -0,0 +1,137 @@ +<?php
+if (empty($import_adminkey) or isset($_REQUEST['import_adminkey']) or $import_adminkey != $adminkey) die('bla');
+
+$filename = (!empty($_REQUEST['filename'])) ? my_stripslashes($_REQUEST['filename']) : '';
+$filename = str_replace(array('..', '/', '\\', '<', ':'), array(), $filename);
+
+
+if (!empty($filename)) {
+ if (!file_exists('logs/utdc/'. $filename) or !is_file('logs/utdc/'. $filename)) die('bla');
+ if (isset($_REQUEST['del'])) {
+ unlink('logs/utdc/'. $filename);
+ $filename = '';
+ }
+}
+
+
+
+
+if (empty($filename)) {
+ echo'<br><table class = "box" border="0" cellpadding="1" cellspacing="2" width="600">
+ <tr>
+ <td class="smheading" align="center" width="100%" colspan="4">Available UTDC Logs:</td>
+ </tr>';
+ $logdir = opendir('logs/utdc');
+ $logs = array();
+ $sort = array();
+ $i = 0;
+ while (false !== ($filename = readdir($logdir))) {
+ if (!is_file('logs/utdc/'. $filename)) continue;
+ if ($filename == '.htaccess' or $filename == 'index.htm') continue;
+ $i++;
+ $logs[$i] = $filename;
+ $extra = 0;
+ if (substr($filename, -4) == '.bz2') $extra = 4;
+ if (substr($filename, -3) == '.gz') $extra = 3;
+
+ $sort[$i] = substr($filename, strlen($filename) - (23 + $extra), 19);
+ }
+ closedir($logdir);
+ if (count($logs) == 0) {
+ echo '<tr><td class="grey" colspan="4">No logs available!</td></tr>';
+ } else {
+ arsort($sort);
+ $i = 0;
+ foreach($sort as $id => $date) {
+ $log = $logs[$id];
+ $extra = 0;
+ if (substr($log, -4) == '.bz2') $extra = 4;
+ if (substr($log, -3) == '.gz') $extra = 3;
+
+ $i++;
+ $class = ($i%2) ? 'grey' : 'grey2';
+ echo '<tr><td class="'.$class.'">';
+ $tmp = substr($log, strlen($log) - (23 + $extra), 19);
+ $tmp = str_replace('.', '', $tmp);
+ $ts = mtimestamp($tmp);
+ echo ' <a class="'.$class.'" href="admin.php?key='.$adminkey.'&action='.$action.'&filename='.urlencode($log).'">'.date('Y-m-d H:i', $ts).'</a>';
+ echo '</td><td class="'.$class.'">';
+ echo '<a class="'.$class.'" href="admin.php?key='.$adminkey.'&action='.$action.'&filename='.urlencode($log).'">'.substr($log, 6, strlen($log) - 30 - $extra).'</a>';
+ echo '</td><td class="'.$class.'" align="right">';
+ $d_size = file_size_info(filesize('logs/utdc/'. $log));
+ echo $d_size['size'] .' '. $d_size['type'];
+ echo '</td><td class="'.$class.'" align="center">';
+ echo '<a href="admin.php?key='.$adminkey.'&action='.$action.'&filename='.urlencode($log).'&del=1"><img src="images/del.png" border="0" width="16" height="16" title="Delete" alt="Delete" /></a>';
+ echo '</td></tr>';
+ }
+ }
+}
+
+
+if (!empty($filename)) {
+ if (!file_exists('logs/utdc/'. $filename) or !is_file('logs/utdc/'. $filename)) die('bla');
+ echo'<br><table class = "box" border="0" cellpadding="1" cellspacing="2" width="600">
+ <tr>
+ <td class="smheading" align="center" width="95%" colspan="3">'.$filename.'</td>
+ <td class="smheading" align="center" width="5%" align="right">';
+ echo '<a href="admin.php?key='.$adminkey.'&action='.$action.'&filename='.urlencode($filename).'&del=1"><img src="images/del.png" border="0" width="16" height="16" title="Delete" alt="Delete" /></a>';
+ echo '</td>
+ </tr>';
+ if (substr($filename, -4) == '.enc') {
+ echo '<tr><td class="grey" colspan="4"><span style="font-family: monospace;">';
+ echo '<a href = "pages/admin/utdcshot.php?filename='.urlencode($filename).'" target = "_blank"><img src = "pages/admin/utdcshot.php?filename='.urlencode($filename).'" width = 100% border = 0></a>';
+ echo '</span></td></tr>';
+ }
+ else {
+ $fp = my_fopen('logs/utdc/'.$filename, 'rb', $compression = NULL);
+ if (!$fp) die("Error opening file");
+
+ $i = 0;
+ echo '<tr><td class="grey" colspan="4"><span style="font-family: monospace;">';
+
+ while (($line = my_fgets($fp, 5000, $compression)) !== FALSE) {
+ /*
+ $i++;
+ $class = ($i%2) ? 'grey' : 'grey2';
+ echo '<tr><td class="'.$class.'" colspan="4">';
+ echo '<span style="font-family: monospace;">';
+ echo htmlentities($line);
+ echo '</span>';
+ echo '</td></tr>';
+ */
+ echo wordwrap(htmlentities($line), 80, '<br />', 1) ."<br />";
+ }
+ echo '</span></td></tr>';
+ my_fclose($fp, $compression);
+
+ // look for a matching utdc screenshot
+ $logdir = opendir('logs/utdc');
+ if (substr($filename, -4) == '.bz2') $extra = 4;
+ if (substr($filename, -3) == '.gz') $extra = 3;
+ while (false !== ($file = readdir($logdir))) {
+ if (!is_file('logs/utdc/'. $filename)) continue;
+ if ($filename == '.htaccess' or $filename == 'index.htm') continue;
+ if ((substr($file, -4) == '.enc') and
+ ((substr($filename, strlen($filename)-(23 + $extra), 19) == substr($file, strlen($file)-23, 19)) or ((substr($filename, strlen($filename)-(23 + $extra), 17) == substr($file, strlen($file)-23, 17)) and (abs(intval(substr($file, strlen($file)- 6, 2)) - intval(substr($filename, strlen($filename)-(6 + $extra), 17))) <=3)))) {
+ echo '<tr>
+ <td class="smheading" align="center" width="95%" colspan="3">'.$file.'</td>
+ <td class="smheading" align="center" width="5%" align="right">';
+ echo '<a href="admin.php?key='.$adminkey.'&action='.$action.'&filename='.urlencode($file).'&del=1"><img src="images/del.png" border="0" width="16" height="16" title="Delete" alt="Delete" /></a>';
+ echo '</td>
+ </tr>';
+
+ echo '<tr><td class="grey" colspan="4"><span style="font-family: monospace;">';
+ echo '<a href = "pages/admin/utdcshot.php?filename='.urlencode($file).'" target = "_blank"><img src = "pages/admin/utdcshot.php?filename='.urlencode($file).'" width = 100% border = 0></a>';
+ echo '</span></td></tr>';
+ }
+ }
+ closedir($logdir);
+ }
+}
+
+echo '</tr>';
+if (!empty($filename)) echo'<tr><td class="smheading" align="center" colspan="4"><a class="grey" href="./admin.php?key='.$_REQUEST[key].'&action='.$action.'">Go Back To Logfile Overview</a></td></tr>';
+echo'<tr><td class="smheading" align="center" colspan="4"><a class="grey" href="./admin.php?key='.$_REQUEST[key].'">Go Back To Admin Page</a></td></tr>';
+echo '</table>';
+
+?>
diff --git a/html/pages/admin/utdcshot.php b/html/pages/admin/utdcshot.php new file mode 100755 index 0000000..24b21f7 --- /dev/null +++ b/html/pages/admin/utdcshot.php @@ -0,0 +1,22 @@ +<?php +$filename = (!empty($_REQUEST['filename'])) ? stripslashes($_REQUEST['filename']) : ''; +$filename = str_replace(array('..', '/', '\\', '<', ':'), array(), $filename); + + +if (!empty($filename)) { + if (!file_exists('../../logs/utdc/'. $filename) or !is_file('../../logs/utdc/'. $filename)) die('bla ' . $filename); + + header("Content-type: image/jpg"); + + $fp_in = fopen('../../logs/utdc/'. $filename, 'rb') or die("Can't open file"); + $blocksize = 1024; + while (!feof($fp_in)) { + $buffer .= @fread($fp_in, $blocksize); + if ($buffer === false) return(false); + if ($bytes === false) return(false); + } + + $buffer = preg_replace('[\x00]', '', $buffer); + echo base64_decode($buffer); +} +?>
\ No newline at end of file diff --git a/html/pages/credits.php b/html/pages/credits.php new file mode 100755 index 0000000..e27de84 --- /dev/null +++ b/html/pages/credits.php @@ -0,0 +1,311 @@ +<?php
+echo'
+<div class="text" align="left">
+<p><span class="txttitle">Credits</span></p>
+
+<blockquote><p>
+ 1. <a href="#developers">Developers</a><br>
+ 2. <a href="#changelog">Change Log</a><br>
+ 3. <a href="#todolist">To Do List</a><br>
+ 4. <a href="#thanks">Thanks</a><br>
+ 5. <a href="#copyright">Copyright Notices</a><br>
+</p></blockquote>
+
+<p><a name="developers"></a><b>Developers</b></p>
+<blockquote><p>UTStats was developed by azazel, )°DoE°(-AnthraX, PJMODOS and toa.<br>
+All original pages are W3C <a href="http://validator.w3.org/check?uri=referer" target="_blank">HTML 4.01</a> and
+<a href="http://jigsaw.w3.org/css-validator/" target="_blank">CSS</a> compliant</p>
+
+</blockquote>
+
+<p><a name="changelog"></a><b>Change Log</b></p>
+<blockquote><p>
+<dl>
+ <dt>beta 4.2.8 (23/7/2011 by Rork)</dt>
+ <dd>Bug Fixes:<br>
+ Fixed explain rankings (reported by Letylove49)<br>
+ Fixed delete player (reported by The Cowboy)<br>
+ Fixed delete player from match<br>
+ Fixed support for LMS++<br><br></dd>
+
+ <dt>beta 4.2.7 (24/4/2011 by Rork)</dt>
+ <dd>Added:<br>
+ IP Information in extended player info<br>
+ Possible fake nicks in extended player info<br>
+ Added support for LMS+<br><br></dd>
+
+ <dd>Bug Fixes:<br>
+ Fixed player deletion<br>
+ Fixed DOM import with bots<br>
+ Fixed player info BT records<br>
+ Fixed order players in playersearch<br>
+ Fixed player time on server longer then gametime<br>
+ Fixed lms player sorting<br>
+ Fixed lms ttl<br>
+ Fixed SQL table creation (reported by PopCorn)<br><br></dd>
+
+ <dt>beta 4.2.6 (04/12/2010 by Rork)</dt>
+ <dd>Bug Fixes:<br>
+ Fixed serveral vulnerabilities<br>
+ Fixed DOM specific map page not showing<br>
+ Fix Assault Match looks<br>
+ Add support for new BT times<br>
+ Fixed CTF Match Reports<br><br></dd>
+
+ <dt>beta 4.2.5 (23/10/2010 by Rork)</dt>
+ <dd>Added:<br>
+ Game time in match stats<br>
+ Added applicable totals per gametype on the mappage<br>
+ Bunny Track stats, <A HREF = "http://www.unrealadmin.org/forums/showthread.php?t=18991" TARGET = "_blank">BT++</A> support only<br>
+ Server configuration checker/database setup<br>
+ UTDC Screenshots viewer<br>
+ ACE Logviewer<br>
+ Added out time in LMS<br>
+ Added number of players to recent matches<br>
+ Hide not applicable statistics from player pages<br>
+ Various lay-out improvements<br>
+ Filters in maplist<br>
+ Show Score under Match Totals for teamgames<br>
+ Added debug messages<br><br></dd>
+
+ <dd>Bug Fixes:<br>
+ Fixed delete player from match<br>
+ Fixed bug where players are spec after merging or teamchange<br>
+ Fixed effective rank after merging players<br>
+ Dirty fix for divide by zero bug on logimport (was line 47) (gametime = 0)<br>
+ Fixed dodgy import log recognition<br>
+ Fixed playerlink in explain ranking<br>
+ Two bug fixes by Enakin reported in the 4.2.3 release thread<br>
+ Fixed LMS ttl by using the time until the player is out.<br>
+ Sorted LMS players by ttl, the winner on top<br>
+ Fixed php shorttag in import_playerstuff.php<br>
+ Prevent removing files from ftp after error<br>
+ Prevent importing empty log after ftp error<br>
+ Made the main pages W3C HTML 4.01 Compliant<br>
+ Fixed some vulnerabilities<br><br></dd>
+
+ <dt>beta 4.2.4 (10/04/2010 by Loki)</dt>
+ <dd>Added:<br>
+ Breakdown of server occupation per weekday (By Loki)<br>
+ Breakdown of country of origin (By Loki)<br>
+ Included IpToCountry patch into the release, added GeoIP.dat from March 2010 (By Loki)<br><br></dd>
+ <dd>Bug Fixes:<br>
+ Fixed PHP opening tags (By Loki)<br><br></dd>
+
+ <dt>beta 4.2.3 (18/01/09 by 2399Skillz)</dt>
+ <dd>Bug Fixes:<br>
+ Lots of bug fixes/database corrections (By Enakin)<br><br></dd>
+
+ <dt>beta 4.2.2 (30/12/08 by 2399Skillz)</dt>
+ <dd>Added:<br>
+ Option to import AnthChecker logs (admin viewable only) (Added by Skillz)<br>
+ New player merger page for admins(Added by killereye)<br><br></dd>
+ <dd>Bug Fixes:<br>
+ UT Stats DOM fix (Edited by killereye)<br><br></dd>
+
+ <dt>beta 4.2 (20/10/2005 by Azazel)</dt>
+ <dd>Added:<br>
+ Ranking re-calculation option added to admin section<br>
+ Import and display player pings<br>
+ <i>Explain Ranking</i> page<br>
+ Added an option to the admin page to delete temporary tables (if any)<br><br></dd>
+
+ <dd>Bug Fixes:<br>
+ Import fix for MySQL v3.x<br>
+ Partial Import delete fix<br>
+ bbcode and Clanbase Report Fix - not showing high score win reports.<br>
+ Ranking fix (was more than 300 mins to get full ranking points)<br>
+ Spectator fix (was logging players as spectators)<br>
+ Efficiency on Players Total worked out as SUM rather than AVG<br>
+ Clanbase report fixed<br>
+ Totals on Totals Page fixed<br>
+ Events on Totals Page only show if they really happened<br>
+ Number of matches on Totals Page fixed<br>
+ Fixed a crash when trying to import logs that didnt contain IP records<br>
+ Maps sometimes appeared twice on the maps list / incorrect map statistics<br>
+ First/Prev/Next/Last links on map stas page were not working correctly<br>
+ Improved server actor version uploaded (old one may have caused some server lag at times)<br>
+ Updated import.php for new server actor<br>
+ Few actor fixes<br>
+ Weapon stats for second attacking team in assault games were not correct (reported by wgray8231)<br>
+ Delete player from match didn\'t correctly remove the player from the match (reported by wgray8231)<br><br></dd>
+
+ <dt>beta 4.0</dt>
+ <dd>Added:<br>
+ Many pages overhauled<br>
+ Database overhauled<br>
+ Option to import bots or not (off by default)<br>
+ Command Line Interface now outputs to text not html<br>
+ Ranking stuff on match and player pages include gold/silver/bronze cups for each gametype<br>
+ Rankings tweaked so new players get even less points<br>
+ Maps page now sortable<br>
+ Flag Assists now show, get the new <a href="http://www.unrealadmin.org/forums/showthread.php?t=9561" target="_blank">Smart CTF</a><br>
+ Report generator outputting to Clanbase and bbcode format<br>
+ Support added for custom weapons and gametypes<br>
+ Admin page including server/player merging, deletion of players/matches, renaming of "game types" etc<br>
+ Option to compress logs when backing them up (requires bzip/gzip support in php)<br>
+ More debugging stuff added<br>
+ Accuracy package optimised and recoded for better performance (it will not lag the server in anyway now)<br>
+ More detailed weapon statistics added<br>
+ Totals page expanded with information like on the old NGStats<br>
+ JailBreak should now display its statistics properly<br>
+ Purge logs option added<br>
+ Graphs now display better regardless of data used<br>
+ CTF4 Compatibility<br>
+ Date and Game Type filtering on Recent Matches page<br>
+ Ability to Ban players<br>
+ Ability to ignore matches < X minues in length<br>
+ IP Search within Administration<br>
+ Ability to ignore matches less than X minutes in length<br>
+ Option to import UTDC logs (admin viewable only)<br><br></dd>
+
+ <dd>Bug Fixes:<br>
+ Ranking overhauled to better reflect average game play of players<br>
+ Cleaned up the importer<br>
+ Teamscores now shown correctly regardless of player switching activity<br>
+ Kills matrix is now created on combined player records<br>
+ Kills against bots no longer counted if bots are not imported<br>
+ Domination logs only log when players are in<br>
+ Teamkills identified as kills in non-team games (gg Epic :/)<br>
+ Eff etc fixed because of above Teamkills bug<br>
+ Last line not logging of buffer fixed<br><br></dd>
+
+ <dt>beta 3.2</dt>
+ <dd>Added:<br>
+ Debugging Option<br>
+ Better FTP Capabilities<br>
+ Filters carried over on next last etc on player page<br><br></dd>
+
+ <dd>Bug Fixes:<br>
+ Imports failing on some versions of php 4.3.x<br>
+ Totals page fixed<br>
+ Totals info at the top of match pages fixed<br><br></dd>
+
+ <dt>beta 3.1</dt>
+ <dd>Added:<br>
+ Kills Matchup Matrix
+ Country Flags for Players<br>
+ Hover Hints over key parts of the page (eg. K F D S)<br>
+ Some Graphs<br><br></dd>
+
+ <dd>Bug Fixes:<br>
+ Importer can now import unlimited logs<br>
+ Kills on match pages not listed<br>
+ Games where nothing happens no longer imported<br>
+ Players who have 0 kills & 0 deaths no longer get imported<br>
+ FTP script re-written<br>
+ Pickups removed from insta pages<br>
+ Translocator entries removed from logs (throws not kills)<br>
+ Multis & Sprees report correct player now<br>
+ Kills correctly worked out on non-Team Games<br>
+
+ Frags correctly worked out on all games<br><br></dd>
+
+ <dt>beta 3.0</dt>
+ <dd>Added:<br>
+ SmartCTF events<br>
+ UTGL Compatibility<br><br>
+ Updated:<br>
+ UTStats actor re-written from scratch, it now uses NGLog files<br>
+ Database re-written from scratch<br>
+ PHP code re-written from scratch<br><br></dd>
+
+ <dd>Bug Fixes:<br>
+ Too many to think about<br><br></dd>
+
+ <dt>beta 2.0</dt>
+ <dd>Code rewritten from ground up then lost :(<br><br></dd>
+
+
+ <dt>beta 1.2</dt>
+ <dd>Added:<br>
+ Accuracy Code (best in insta but works on all weapons)<br>
+ UT2004 spree scheme<br>
+ Who killed the Flag Carrier<br>
+ <br>
+ Updated:<br>
+ Complete overhaul of pages/theme to mimic closley UT2004 Stats by Epic<br>
+ Cap times added to Clanbase Report<br>
+ Stats database, now at least 10-20x smaller<br>
+ <br>
+ Bug Fixes:<br>
+ TeamKills no longer appear in DM<br>
+ TeamKills no longer mess up overall stats<br>
+ Bot kills etc no longer included in overall stats<br>
+ Sprees are unique<br><br></dd>
+
+ <dt>beta 1.1</dt>
+ <dd>Added:<br>
+ Clanbse Reports for CTF Match\'s<br>
+ 30 Recent Match\'s to Player View<br><br></dd>
+
+ <dt>beta 1</dt>
+ <dd>Stats output for:<br>
+ Player Joins/Leaves<br>
+ Match Start/End<br>
+ Frags and Item Pickups<br>
+ Sprees (Doubles/Multis and Domination/Monster etc)<br>
+ Events</dd>
+
+</dl></blockquote>
+
+<p><a name="todolist"></a><b>To Do List</b></p>
+<blockquote><dl><dd>
+ <i>"Requests"</i><br>
+ Centralise stats<br>
+ Web based installer<br>
+ Other Anticheat log parser. (UTPure, EUT, etc..)<br>
+ Multi language support<br>
+ Add sftp support<br>
+ Add siege support<br>
+ Wins/Losses to the Career summary<br>
+ Killgraph as in utstatsdb<br>
+ <br></dd></dl>
+</blockquote>
+
+<p><a name="thanks"></a><b>Thanks</b></p>
+<blockquote>
+<dl>
+<dd>Epic for making a game that we still play<br>
+ kostaki for the database pointers, scoring system and the <a href="http://www.inzane.de/" target="_blank">inzane</a> public servers :)<br>
+ Limited for the late night sesions, the linux script and the original zero_out function<br>
+ L0cky and Flash for the original FTP Script<br>
+ Loph for the 6 different reports o/<br>
+ Rush for the improved linux script, testing, suggestions and bug finding<br>
+ TNSe for being TNSe<br>
+ Truff for testing, suggestions and constant bug finding<br>
+ Truff Community for testing, suggestions and input<br>
+ UnrealAdmin.org testers and suggesters<br></dd></dl></blockquote>
+
+<p><a name="copyright"></a><b>Copyright Notices</b></p>
+<blockquote><dl>
+<dd>UTStats<br>
+ Copyright (C) 2004/2005 <a href="http://utstats.unrealadmin.org/" target="_blank">UTStats</a><br>
+ <br>
+ This program is free software; you can redistribute and/or modify<br>
+ it under the terms of the Open Unreal Mod License.<br>
+ <br>
+ If you do make any changes, fixes or updates posting them on the<br>
+ forum would be appreciated.<br>
+ <br>
+ UT Query PHP script v1.01 by Almar Joling, 2003<br>
+ <a href="http://www.persistentrealities.com/" target="_blank">www.persistentrealities.com</a><br>
+ <br>
+ pemftp Class by Alexey Dotsenko <alex at paneuromedia dot com><br>
+ <a href="http://www.phpclasses.org/browse/package/1743.html" target="_blank">http://www.phpclasses.org/browse/package/1743.html</a><br>
+ <br>
+ GeoLite data created by MaxMind<br/>
+ Available from <a href="http://www.maxmind.com/app/geolitecountry" target="_blank">http://www.maxmind.com/app/geolitecountry</a><br>
+ <br>
+ overLIB by Erik Bosrup<br>
+ <a href="http://www.bosrup.com/web/overlib/" target="_blank">http://www.bosrup.com/web/overlib/</a>
+ </dd></dl></blockquote>
+<br>
+<table width="70%">
+ <tbody><tr>
+ <td align="left"><a href="#Top">Back to Top</a></td>
+ <td align="right"> </td>
+ </tr>
+</tbody></table>
+</div>';
+?>
\ No newline at end of file diff --git a/html/pages/dpmatch.php b/html/pages/dpmatch.php new file mode 100755 index 0000000..b563fa0 --- /dev/null +++ b/html/pages/dpmatch.php @@ -0,0 +1,102 @@ +<?php
+if (empty($import_adminkey) or isset($_REQUEST['import_adminkey']) or $import_adminkey != $adminkey) die('bla');
+
+$options['title'] = 'Delete Player from Match';
+$i = 0;
+$options['vars'][$i]['name'] = 'pid';
+$options['vars'][$i]['type'] = 'player';
+$options['vars'][$i]['prompt'] = 'Choose the player you want to delete from a match:';
+$options['vars'][$i]['caption'] = 'Player to delete:';
+$i++;
+$options['vars'][$i]['name'] = 'mid';
+$options['vars'][$i]['type'] = 'match';
+$options['vars'][$i]['whereplayer'] = 'pid';
+$options['vars'][$i]['prompt'] = 'Choose the match you want to delete the player from:';
+$options['vars'][$i]['caption'] = 'Match:';
+$i++;
+
+$results = adminselect($options);
+
+
+$matchid = $results['mid'];
+$pid = $results['pid'];
+
+echo'<br><table border="0" cellpadding="1" cellspacing="2" width="600">
+<tr>
+ <td class="smheading" align="center" colspan="2">Delete Player From Match ID '.$matchid.'</td>
+</tr>';
+
+echo'<tr>
+ <td class="smheading" align="left" width="200">Amending Players Rank:</td>';
+
+$q_radjust = small_query("SELECT pid, gid, rank FROM uts_player WHERE id = $pid");
+if (!$q_radjust) {
+ $sql_crank = false;
+} else {
+ $rank_pid = $q_radjust[pid];
+ $rank_gid = $q_radjust[gid];
+ $rank = $q_radjust[rank];
+
+ $sql_crank = small_query("SELECT id, rank, matches FROM uts_rank WHERE pid = $rank_pid AND gid = '$rank_gid'");
+}
+if (!$sql_crank) {
+ echo'<td class="grey" align="left" width="400">Player not in rankings</td>';
+} else {
+ $rid = $sql_crank[id];
+ $newrank = $sql_crank[rank]-$rank;
+ $oldrank = $sql_crank[rank];
+ $matchcount = $sql_crank[matches]-1;
+
+ mysql_query("UPDATE uts_rank SET rank = $newrank, prevrank = $oldrank, matches = $matchcount WHERE id = $rid") or die(mysql_error());
+ mysql_query("DELETE FROM uts_rank WHERE matches = 0") or die(mysql_error());
+
+ echo'<td class="grey" align="left" width="400">Done</td>';
+}
+echo'</tr>
+<tr>
+ <td class="smheading" align="left">Removing Kill Matrix Entries:</td>';
+ $q_match = mysql_query("SELECT matchid, playerid FROM uts_player WHERE pid = '$pid' and matchid = '$matchid'") or die(mysql_error());
+ while ($r_match = mysql_fetch_array($q_match)) {
+ mysql_query("DELETE FROM uts_killsmatrix WHERE matchid = '${r_match['matchid']}' AND (killer = '${r_match['playerid']}' OR victim = '${r_match['playerid']}')") or die(mysql_error());
+ }
+ echo'<td class="grey" align="left">Done</td>
+</tr>
+
+
+<tr>
+ <td class="smheading" align="left" width="200">Removing Player Weapon Stats:</td>';
+mysql_query("DELETE FROM uts_weaponstats WHERE matchid = $matchid AND pid = $pid") or die(mysql_error());
+ echo'<td class="grey" align="left" width="400">Done</td>
+</tr>
+<tr>
+ <td class="smheading" align="left" width="200">Removing Player From Match:</td>';
+mysql_query("DELETE FROM uts_player WHERE matchid = $matchid AND pid = $pid") or die(mysql_error());
+ echo'<td class="grey" align="left" width="400">Done</td>
+</tr>
+<tr>
+ <td class="smheading" align="left" width="200">Amending Player Weapon Stats:</td>';
+mysql_query("DELETE FROM uts_weaponstats WHERE matchid IN ('$matchid','0') AND pid = '$pid'") or die(mysql_error());
+
+$q_weaponstats = mysql_query("SELECT SUM(kills) AS kills, SUM(shots) AS shots, SUM(hits) as hits, SUM(damage) as damage, AVG(acc) AS acc FROM uts_weaponstats WHERE pid = '$pid' GROUP BY weapon") or die(mysql_error());
+while ($r_weaponstats = mysql_fetch_array($q_weaponstats)) {
+ mysql_query("INSERT INTO uts_weaponstats SET matchid='0', pid='$pid', kills='${r_weaponstats['kills']}', shots='${r_weaponstats['shots']}', hits='${r_weaponstats['hits']}', damage='${r_weaponstats['damage']}', acc='${r_weaponstats['acc']}'") or die(mysql_error());
+}
+ echo'<td class="grey" align="left" width="400">Done</td>
+</tr>
+<tr>
+ <td class="smheading" align="left" width="200">Amending Global Weapon Stats:</td>';
+ mysql_query("DELETE FROM uts_weaponstats WHERE matchid='0' AND pid='0'") or die(mysql_error());
+
+ $q_weaponstats = mysql_query("SELECT weapon, SUM(kills) AS kills, SUM(shots) AS shots, SUM(hits) as hits, SUM(damage) as damage, AVG(acc) AS acc FROM uts_weaponstats WHERE matchid = '0' GROUP BY weapon") or die(mysql_error());
+ while ($r_weaponstats = mysql_fetch_array($q_weaponstats)) {
+ mysql_query("INSERT INTO uts_weaponstats SET matchid='0', pid='0', weapon='${r_weaponstats['weapon']}', kills='${r_weaponstats['kills']}', shots='${r_weaponstats['shots']}', hits='${r_weaponstats['hits']}', damage='${r_weaponstats['damage']}', acc='${r_weaponstats['acc']}'") or die(mysql_error());
+ }
+
+ echo'<td class="grey" align="left" width="400">Done</td>
+</tr>
+
+<tr>
+ <td class="smheading" align="center" colspan="2">Match Deleted - <a href="./admin.php?key='.$_REQUEST[key].'">Go Back To Admin Page</a></td>
+</tr></table>';
+
+?>
diff --git a/html/pages/graph_mbreakdown.php b/html/pages/graph_mbreakdown.php new file mode 100755 index 0000000..44ef717 --- /dev/null +++ b/html/pages/graph_mbreakdown.php @@ -0,0 +1,229 @@ +<?php
+$max_height = 100;;
+
+// Hourly Breakdown
+$sql_ghours = "SELECT HOUR(time) AS res_hour, COUNT(*) AS res_count
+FROM uts_match WHERE $bgwhere GROUP by res_hour";
+$q_ghours = mysql_query($sql_ghours) or die(mysql_error());
+$hour_max = 0;
+$hour_sum = 0;
+while ($r_ghours = mysql_fetch_array($q_ghours)) {
+ $gb_hour[$r_ghours['res_hour']] = $r_ghours['res_count'];
+ if ($r_ghours['res_count'] > $hour_max) $hour_max = $r_ghours['res_count'];
+ $hour_sum += $r_ghours['res_count'];
+}
+if ($hour_max == 0) return;
+
+// Daily Breakdown
+// We use WEEKDAY rather then DAYOFWEEK because now the week starts with Monday instead of Sunday
+$sql_gdays = "SELECT WEEKDAY(time) AS res_day, COUNT(*) AS res_count
+FROM uts_match WHERE $bgwhere GROUP by res_day";
+$q_gdays = mysql_query($sql_gdays) or die(mysql_error());
+$day_max = 0;
+$day_sum = 0;
+while ($r_gdays = mysql_fetch_array($q_gdays)) {
+ $gb_day[$r_gdays['res_day']] = $r_gdays['res_count'];
+ if ($r_gdays['res_count'] > $day_max) $day_max = $r_gdays['res_count'];
+ $day_sum += $r_gdays['res_count'];
+}
+
+// Monthly Breakdown
+$sql_gmonths = "SELECT MONTH(time) AS res_month, COUNT(*) AS res_count
+FROM uts_match WHERE $bgwhere GROUP by res_month";
+$q_gmonths = mysql_query($sql_gmonths) or die(mysql_error());
+$month_max = 0;
+$month_sum = 0;
+while ($r_gmonths = mysql_fetch_array($q_gmonths)) {
+ $gb_month[$r_gmonths['res_month']] = $r_gmonths['res_count'];
+ if ($r_gmonths['res_count'] > $month_max) $month_max = $r_gmonths['res_count'];
+ $month_sum += $r_gmonths['res_count'];
+}
+
+// very dirty hack, to deal with the $bgwhere containing an OR
+// if it contains an OR, all literals should be prefixed with "m."
+if (substr_count($bgwhere, ' or ') == 0){
+ $bgwhere = 'm.' . $bgwhere;
+} else {
+ $bgwhere = substr($bgwhere, 1, -1);
+ $part = explode(' or ', $bgwhere);
+ $bgwhere = '';
+ foreach($part as $i){
+ $bgwhere .= 'm.' . $i . ' OR ';
+ }
+ $bgwhere = '(' . substr($bgwhere, 0, -4) . ')';
+}
+
+// Country Breakdown
+$sql_gcountries = "SELECT country AS res_country, COUNT(*) AS res_count FROM
+ (SELECT p.country AS country FROM uts_player AS p, uts_match AS m
+ WHERE m.id = p.matchid AND $bgwhere GROUP BY p.pid) AS res_table
+GROUP BY res_country ORDER BY res_count DESC";
+$q_gcountries = mysql_query($sql_gcountries) or die(mysql_error());
+$country_max = 0;
+$country_sum = 0;
+$i = 0;
+while ($r_gcountries = mysql_fetch_array($q_gcountries)) {
+ $gb_country[$i] = $r_gcountries['res_country'] . ";" . $r_gcountries['res_count'];
+ if ($r_gcountries['res_count'] > $country_max) $country_max = $r_gcountries['res_count'];
+ $country_sum += $r_gcountries['res_count'];
+ $i++;
+}
+
+echo'
+<table class = "box" border="0" cellpadding="0" cellspacing="2">
+<tbody>
+<tr><td>
+<table border="0" cellpadding="0" cellspacing="0">
+ <tbody>
+ <tr>
+ <td class="heading" align="center" colspan="47">Hourly, Daily and Monthly Activity '.$gtitle.'</td>
+ </tr>
+ <tr>
+ <td class="dark" align="center" colspan="47" height="10"></td>
+ </tr>
+ <tr>
+ <td class="dark" align="center" width="15"></td>';
+
+// Hourly
+for ($i = 0; $i <= 23; $i++) {
+ if (!isset($gb_hour[$i])) $gb_hour[$i] = 0;
+ $title = $gb_hour[$i] .' ('. get_dp($gb_hour[$i] / $hour_sum * 100) .' %)';
+ echo '<td class="dark" align="center" valign="bottom" width="15"><img border="0" src="images/bars/v_bar'. ($i % 16 + 1) .'.png" width="18" height="'.(int)($gb_hour[$i] / $hour_max * $max_height).'" alt="'. $title .'" title="'. $title .'"></td>';
+}
+
+echo '<td class="dark" align="center" valign="bottom" width="15"></td>';
+
+// Daily
+for ($i = 0; $i <= 6; $i++) {
+ if (!isset($gb_day[$i])) $gb_day[$i] = 0;
+ $title = $gb_day[$i] .' ('. get_dp($gb_day[$i] / $day_sum * 100) .' %)';
+ echo '<td class="dark" align="center" valign="bottom" width="15"><img border="0" src="images/bars/v_bar'. ($i % 16 + 1) .'.png" width="18" height="'.(int)($gb_day[$i] / $day_max * $max_height).'" alt="'. $title .'" title="'. $title .'"></td>';
+}
+
+echo '<td class="dark" align="center" valign="bottom" width="15"></td>';
+
+// Monthly
+for ($i = 1; $i <= 12; $i++) {
+ if (!isset($gb_month[$i])) $gb_month[$i] = 0;
+ $title = $gb_month[$i] .' ('. get_dp($gb_month[$i] / $month_sum * 100) .' %)';
+ echo '<td class="dark" align="center" valign="bottom" width="15"><img border="0" src="images/bars/v_bar'. (($i + 8) % 16 + 1) .'.png" width="18" height="'.(int)($gb_month[$i] / $month_max * $max_height).'" alt="'. $title .'" title="'. $title .'"></td>';
+}
+echo '<td class="dark" align="center" valign="bottom" width="15"></td>';
+echo'</tr><tr>
+ <td class="grey" align="center" width="15"></td>
+ <td class="grey" align="center">0</td>
+ <td class="grey" align="center">1</td>
+ <td class="grey" align="center">2</td>
+ <td class="grey" align="center">3</td>
+ <td class="grey" align="center">4</td>
+ <td class="grey" align="center">5</td>
+ <td class="grey" align="center">6</td>
+ <td class="grey" align="center">7</td>
+ <td class="grey" align="center">8</td>
+ <td class="grey" align="center">9</td>
+ <td class="grey" align="center">10</td>
+ <td class="grey" align="center">11</td>
+ <td class="grey" align="center">12</td>
+ <td class="grey" align="center">13</td>
+ <td class="grey" align="center">14</td>
+ <td class="grey" align="center">15</td>
+ <td class="grey" align="center">16</td>
+ <td class="grey" align="center">17</td>
+ <td class="grey" align="center">18</td>
+ <td class="grey" align="center">19</td>
+ <td class="grey" align="center">20</td>
+ <td class="grey" align="center">21</td>
+ <td class="grey" align="center">22</td>
+ <td class="grey" align="center">23</td>
+ <td class="grey" align="center" width="10"></td>
+ <td class="grey" align="center">M</td>
+ <td class="grey" align="center">T</td>
+ <td class="grey" align="center">W</td>
+ <td class="grey" align="center">T</td>
+ <td class="grey" align="center">F</td>
+ <td class="grey" align="center">S</td>
+ <td class="grey" align="center">S</td>
+ <td class="grey" align="center" width="10"></td>
+ <td class="grey" align="center">J</td>
+ <td class="grey" align="center">F</td>
+ <td class="grey" align="center">M</td>
+ <td class="grey" align="center">A</td>
+ <td class="grey" align="center">M</td>
+ <td class="grey" align="center">J</td>
+ <td class="grey" align="center">J</td>
+ <td class="grey" align="center">A</td>
+ <td class="grey" align="center">S</td>
+ <td class="grey" align="center">O</td>
+ <td class="grey" align="center">N</td>
+ <td class="grey" align="center">D</td>
+ <td class="grey" align="center" width="15"></td>
+</tr>
+</tbody></table>
+</tr>
+</tbody>
+</table>
+<br><br>';
+
+global $a_countries;
+// The number of different countries we want to display
+$no_countries = 20;
+
+// Check if there are more countries then $no_countries; if so, we can have a "others" column
+if ( count($gb_country) < $no_countries ){
+ $max_cntry = count($gb_country);
+ $collspan = $max_cntry + 2;
+ $others = false;
+} else {
+ $max_cntry = $no_countries;
+ $collspan = $max_cntry + 3;
+ $others = true;
+}
+
+echo'
+<table class = "box" border="0" cellpadding="0" cellspacing="2">
+<tbody>
+<tr><td><table border="0" cellpadding="0" cellspacing="0">
+ <tbody>
+ <tr>
+ <td class="heading" align="center" colspan="' . $collspan . '"> Origin of Players </td>
+ </tr>
+ <tr>
+ <td class="dark" align="center" colspan="' . $collspan . '" height="10"></td>
+ </tr>
+ <tr>
+ <td class="dark" align="center" width="15"></td>';
+
+// Countries
+$x = 0;
+for ($i = 0; $i < $max_cntry; $i++) {
+ if (!isset($gb_hour[$i])) $gb_hour[$i] = 0;
+ $country = explode(";",$gb_country[$i]);
+ $title = $a_countries[$country[0]] .': ' . $country[1] . ' ('. get_dp($country[1] / $country_sum * 100) .' %)';
+ echo '<td class="dark" align="center" valign="bottom" width="20"><img border="0" src="images/bars/v_bar'. ($i % 16 + 1) .'.png" width="20" height="'.(int)($country[1] / $country_max * $max_height).'" alt="'. $title .'" title="'. $title .'"></td>';
+ $x += $country[1];
+}
+if($others){
+ $countries_left = $country_sum - $x;
+ $title = 'Other Countries: ' . $countries_left . ' ('. get_dp($countries_left / $country_sum * 100) .' %)';
+ echo '<td class="dark" align="center" valign="bottom" width="20"><img border="0" src="images/bars/v_bar'. ($max_cntry % 16 + 1) .'.png" width="20" height="'.(int)($countries_left / $country_max * $max_height).'" alt="'. $title .'" title="'. $title .'"></td>';
+};
+
+echo '<td class="dark" align="center" valign="bottom" width="18"></td>';
+echo'</tr><tr>
+ <td class="grey" align="center" width="18"></td>';
+ for ($i = 0; $i < $max_cntry; $i++) {
+ $country = explode(";",$gb_country[$i]);
+ $country = strtoupper($country[0]);
+ echo '<td class="grey" align="center">' . $country . '</td>';
+ }
+if($others){
+ echo '<td class="grey" align="center">--</td>';
+}
+echo'<td class="grey" align="center" width="15"></td>
+</tr>
+</tbody></table>
+</tr>
+</tbody>
+</table>
+<br>';
+?>
\ No newline at end of file diff --git a/html/pages/graph_pbreakdown.php b/html/pages/graph_pbreakdown.php new file mode 100755 index 0000000..808c7cb --- /dev/null +++ b/html/pages/graph_pbreakdown.php @@ -0,0 +1,137 @@ +<?php
+$max_height = 80;
+
+// Hourly Breakdown
+$sql_ghours = "SELECT HOUR(m.time) AS res_hour, COUNT(p.id) AS res_count
+FROM uts_match m, uts_player p WHERE $bgwhere AND m.id = p.matchid GROUP by res_hour";
+$q_ghours = mysql_query($sql_ghours) or die(mysql_error());
+$hour_max = 0;
+$hour_sum = 0;
+while ($r_ghours = mysql_fetch_array($q_ghours)) {
+ $gb_hour[$r_ghours['res_hour']] = $r_ghours['res_count'];
+ if ($r_ghours['res_count'] > $hour_max) $hour_max = $r_ghours['res_count'];
+ $hour_sum += $r_ghours['res_count'];
+}
+if ($hour_max == 0) return;
+
+// Daily Breakdown
+// We use WEEKDAY rather then DAYOFWEEK because now the week starts with Monday instead of Sunday
+$sql_gdays = "SELECT WEEKDAY(time) AS res_day, COUNT(*) AS res_count
+FROM uts_match m, uts_player p WHERE $bgwhere AND m.id = p.matchid GROUP by res_day";
+$q_gdays = mysql_query($sql_gdays) or die(mysql_error());
+$day_max = 0;
+$day_sum = 0;
+while ($r_gdays = mysql_fetch_array($q_gdays)) {
+ $gb_day[$r_gdays['res_day']] = $r_gdays['res_count'];
+ if ($r_gdays['res_count'] > $day_max) $day_max = $r_gdays['res_count'];
+ $day_sum += $r_gdays['res_count'];
+}
+
+// Monthly Breakdown
+$sql_gmonths = "SELECT MONTH(m.time) AS res_month, COUNT(p.id) AS res_count
+FROM uts_match m, uts_player p WHERE $bgwhere AND m.id = p.matchid GROUP by res_month";
+$q_gmonths = mysql_query($sql_gmonths) or die(mysql_error());
+$month_max = 0;
+$month_sum = 0;
+while ($r_gmonths = mysql_fetch_array($q_gmonths)) {
+ $gb_month[$r_gmonths['res_month']] = $r_gmonths['res_count'];
+ if ($r_gmonths['res_count'] > $month_max) $month_max = $r_gmonths['res_count'];
+ $month_sum += $r_gmonths['res_count'];
+}
+
+
+echo'
+<table class = "box" border="0" cellpadding="0" cellspacing="2">
+<tbody>
+<tr><td>
+<table border="0" cellpadding="0" cellspacing="0">
+ <tbody>
+ <tr>
+ <td class="heading" align="center" colspan="47">Hourly, Daily and Monthly Activity '.$gtitle.'</td>
+ </tr>
+ <tr>
+ <td class="dark" align="center" colspan="47" height="10"></td>
+ </tr>
+ <tr>
+ <td class="dark" align="center" width="15"></td>';
+
+// Hourly
+for ($i = 0; $i <= 23; $i++) {
+ if (!isset($gb_hour[$i])) $gb_hour[$i] = 0;
+ $title = $gb_hour[$i] .' ('. get_dp($gb_hour[$i] / $hour_sum * 100) .' %)';
+ echo '<td class="dark" align="center" valign="bottom" width="15"><img border="0" src="images/bars/v_bar'. ($i % 16 + 1) .'.png" width="18" height="'.(int)($gb_hour[$i] / $hour_max * $max_height).'" alt="'. $title .'" title="'. $title .'"></td>';
+}
+
+echo '<td class="dark" align="center" valign="bottom" width="15"></td>';
+
+// Daily
+for ($i = 0; $i <= 6; $i++) {
+ if (!isset($gb_day[$i])) $gb_day[$i] = 0;
+ $title = $gb_day[$i] .' ('. get_dp($gb_day[$i] / $day_sum * 100) .' %)';
+ echo '<td class="dark" align="center" valign="bottom" width="15"><img border="0" src="images/bars/v_bar'. ($i % 16 + 1) .'.png" width="18" height="'.(int)($gb_day[$i] / $day_max * $max_height).'" alt="'. $title .'" title="'. $title .'"></td>';
+}
+
+echo '<td class="dark" align="center" valign="bottom" width="15"></td>';
+
+// Monthly
+for ($i = 1; $i <= 12; $i++) {
+ if (!isset($gb_month[$i])) $gb_month[$i] = 0;
+ $title = $gb_month[$i] .' ('. get_dp($gb_month[$i] / $month_sum * 100) .' %)';
+ echo '<td class="dark" align="center" valign="bottom" width="15"><img border="0" src="images/bars/v_bar'. (($i + 8) % 16 + 1) .'.png" width="18" height="'.(int)($gb_month[$i] / $month_max * $max_height).'" alt="'. $title .'" title="'. $title .'"></td>';
+}
+echo '<td class="dark" align="center" valign="bottom" width="15"></td>';
+echo'</tr><tr>
+ <td class="grey" align="center" width="15"></td>
+ <td class="grey" align="center">0</td>
+ <td class="grey" align="center">1</td>
+ <td class="grey" align="center">2</td>
+ <td class="grey" align="center">3</td>
+ <td class="grey" align="center">4</td>
+ <td class="grey" align="center">5</td>
+ <td class="grey" align="center">6</td>
+ <td class="grey" align="center">7</td>
+ <td class="grey" align="center">8</td>
+ <td class="grey" align="center">9</td>
+ <td class="grey" align="center">10</td>
+ <td class="grey" align="center">11</td>
+ <td class="grey" align="center">12</td>
+ <td class="grey" align="center">13</td>
+ <td class="grey" align="center">14</td>
+ <td class="grey" align="center">15</td>
+ <td class="grey" align="center">16</td>
+ <td class="grey" align="center">17</td>
+ <td class="grey" align="center">18</td>
+ <td class="grey" align="center">19</td>
+ <td class="grey" align="center">20</td>
+ <td class="grey" align="center">21</td>
+ <td class="grey" align="center">22</td>
+ <td class="grey" align="center">23</td>
+ <td class="grey" align="center" width="10"></td>
+ <td class="grey" align="center">M</td>
+ <td class="grey" align="center">T</td>
+ <td class="grey" align="center">W</td>
+ <td class="grey" align="center">T</td>
+ <td class="grey" align="center">F</td>
+ <td class="grey" align="center">S</td>
+ <td class="grey" align="center">S</td>
+ <td class="grey" align="center" width="10"></td>
+ <td class="grey" align="center">J</td>
+ <td class="grey" align="center">F</td>
+ <td class="grey" align="center">M</td>
+ <td class="grey" align="center">A</td>
+ <td class="grey" align="center">M</td>
+ <td class="grey" align="center">J</td>
+ <td class="grey" align="center">J</td>
+ <td class="grey" align="center">A</td>
+ <td class="grey" align="center">S</td>
+ <td class="grey" align="center">O</td>
+ <td class="grey" align="center">N</td>
+ <td class="grey" align="center">D</td>
+ <td class="grey" align="center" width="15"></td>
+</tr>
+</tbody></table>
+</tr>
+</tbody>
+</table>
+<br>';
+?>
\ No newline at end of file diff --git a/html/pages/help.php b/html/pages/help.php new file mode 100755 index 0000000..fb7a923 --- /dev/null +++ b/html/pages/help.php @@ -0,0 +1,183 @@ +<?php
+echo'
+<div class="text" align="left">
+<p><span class="txttitle">Frequently Asked Questions</span></p>
+
+<blockquote><p>
+ 1. <a href="#servers">Stat Tracking Servers</a><br>
+ 2. <a href="#enable">Enabling your personal stats tracking</a><br>
+ 3. <a href="#info">Information about how the stats work</a><br>
+ 4. <a href="#types">What are the \'official\' Unreal Tournament gametypes?</a><br>
+ 5. <a href="#rank">How does ranking work?</a><br>
+ 6. <a href="#score">Scoring - Individual player points awarded?</a><br>
+ 7. <a href="#tscore">Team Scores?</a><br>
+ 8. <a href="#glossary">Glossary - Terms and abbreviations.</a><br>
+ 9. <a href="#statserver">Enabling Stats on a Server</a><br>
+</p></blockquote>
+
+<p><a name="servers"></a><b>Stat Tracking Servers</b></p>
+<blockquote><p>UTStats only does stats tracking for servers that have UTStats
+ installed.<br>
+ To download and get the latest information, please click the forum link to
+ the left.</p></blockquote>
+
+<p><a name="enable"></a><b>Enabling your personal stats tracking</b></p>
+<blockquote><p>Currently this is not possible, for now you need to use the same
+ nick for this group of servers.<br>
+ If the server runs UTGL your stats nick always will be the one you registered
+ with so there are no stats tracking issues on UTGL servers.</p></blockquote>
+
+<p><a name="info"></a><b>Information about how the stats work</b></p>
+<blockquote><p>A server with stat tracking enabled will send information to the
+stats server about the game - each frag, score, etc. Once the game is
+completed the match is processed and posted on the stats pages. The best
+way to look up a recent match you played is either by your stats ID or the
+server ID. You can search for your user ID or the server ID by name.
+The user names used on the stats pages are based on the last player name you
+used in a match - your stats user name you entered in the networking settings is
+not displayed.</p>
+<p>Bots are not logged, nor are any kills against them.</p>
+</blockquote>
+
+<p><a name="types"></a><b>What are the \'official\' Unreal Tournament gametypes?</b></p>
+<blockquote><p>Out of the box Unreal Tournament features the gametypes
+Deathmatch, Team Deathmatch, Capture the Flag, Assault and Domination.<br>
+There are separate rankings for each of the official game types.</p></blockquote>
+
+<p><a name="rank"></a><b>How does ranking work?</b></p>
+<blockquote><p>Ranking points are based on what you do in a game.<br>
+Points are awarded for fragging and events (eg. flag captures).<br>
+Points are deducted for deaths, suicides and teamkills<br><br>
+Player ranking points are reduced until they have completed 300 minutes of games.</p></blockquote>
+
+<p><a name="score"></a><b>Scoring - Individual player points award:</b></p>
+<blockquote><p>These depend on the game type you are playing. There are
+individual player scores awarded for special achievements, such as captures,
+assists, etc. <br>
+See the Score tables on the Players or Matches subpages to find
+out how many points are actually awarded for each score type.</p></blockquote>
+
+<p><a name="tscore"></a><b>Team Scores?</b></p>
+<blockquote><p>Aside from the individual player scoring in team based gametypes
+(CTF, AS, DOM), there are also Team Scores, that are awarded to
+your team as a whole, for fulfilling a gametype specific objective:<br>
+</p><ul>
+ <li>Capture the Flag - capturing, covering, killing and returning the flag.</li>
+ <li>Assault - achieving an objective.</li>
+ <li>Domination - \'holding\' domination points.</li>
+</ul>
+Note: A team based game is won by the Team Score; the individual player score
+sums do not matter!<p></p></blockquote>
+
+<p><br><a name="glossary"></a><span class="txttitle">Glossary</span></p>
+<blockquote>
+
+<p><a name="fAbb"></a><b>Abbreviations</b></p>
+<blockquote><p>Common abbreviations in UTStats.<br>
+- K = Kills, S = Suicides, F = Frags, D = Deaths<br>
+- E = Events, TK = Team Kills, TD = Team Deaths<br>
+- DM = Deathmatch, TDM = Team Deathmatch, CTF = Capture the Flag,<br>
+- AS = Assault, DOM = Domination<br>
+- FPH = Frags per Hour, SPH = Score per Hour<br>
+- [d] = Time in days, [h] = Time in hours,<br>
+- [m],[min] = Time in minutes, [s],[sec] = Time in seconds</p></blockquote>
+
+<p><a name="fDeaths"></a><b>Deaths</b></p>
+<blockquote><p>Number of times a player gets killed by another player.<br>
+- This does not include environment induced deaths, like trap doors. These and
+self kills are counted separately, as suicides.<br>
+- Team based deaths are counted as team deaths.<br>
+- In tables with weapon specific information, deaths are the number of times a
+player died holding that weapon.</p></blockquote>
+
+<p><a name="fDodging"></a><b>Dodging</b></p>
+<blockquote><p>Special move in Unreal Tournament, that can be activated by
+tapping any movement key twice. Used by many good players to improve their
+maneuverability.</p></blockquote>
+
+<p><a name="fEff"></a><b>Efficiency</b></p>
+<blockquote><p>A ratio that denotes the player\'s kill skill by comparing it with
+his overall performance. A perfect efficiency is equal to 1 (100%),
+anything less than 0.5 (50%) is below average.<br>
+Formula: Kills / (Kills + Deaths + Suicides [+Team Kills])</p></blockquote>
+
+<p><a name="fEvents"></a><b>Events</b></p>
+<blockquote><p>Anything not related to frags, deaths, suicides or kills is
+hereby defined as an event. Typical events would be a flag capture (score
+related) or a flag drop (not score related). Events are mostly used to track all
+the other things going on in a game, that are not frag-related.</p></blockquote>
+
+<p><a name="fFB"></a><b>First Blood</b></p>
+<blockquote><p>Special event awarded to the player who gets the first kill in a
+newly started match.</p></blockquote>
+
+<p><a name="fFrags"></a><b>Frags</b></p>
+<blockquote><p>A player\'s frag count is equal to their kills minus
+suicides. In team games team kills (not team suicides) are also subtracted
+from the player\'s kills.</p></blockquote>
+
+<p><a name="fFPH"></a><b>Frags Per Hour</b></p>
+<blockquote><p>A ratio between the number of frags a player scores per one
+hour. 30 frags in 5 minutes will give you 360 FPH.<br>
+Formula: Frags / (Time played in hours)</p></blockquote>
+
+<p><a name="fKills"></a><b>Kills</b></p>
+<blockquote><p>Number of times a player kills another player.<br>
+Note: UTStats only tracks human vs. human kills. Bot kills and other bot
+related events are tracked at the <i>admins discretion</i>.</p></blockquote>
+
+<p><a name="fMK"></a><b>Multi Kills</b></p>
+<blockquote><p>Special event awarded to the player for killing other players in
+a certain time frame. Every time a player scores a kill he has up to 3
+seconds to make another kill. So 2 kills in 3 seconds gets you a Double
+Kill, 3 kills within 3 seconds apart from another a Multi Kill and so on:<br>
+- Double Kill = 2 kills<br>
+- Multi Kill = 3 kills<br>
+- Ultra Kill = 5 kills<br>
+- Monster Kill = 6 kills</p></blockquote>
+
+<p><a name="fPing"></a><b>Ping</b></p>
+<blockquote><p>Measure of your connection quality. Ping is the round trip
+delay in milliseconds that your computer has to the game server. Low
+values are not important for a fun game, but it sure helps.</p></blockquote>
+
+<p><a name="fSpree"></a><b>Killing Sprees</b></p>
+<blockquote><p>Special event: If you manage to kill 5 or more opponents without
+dying yourself, you will be on a killing spree. If you kill more than 10
+opponents, you are on a rampage, etc.:<br>
+- Killing Spree! 5 kills<br>
+- Rampage! 10 kills<br>
+- Dominating! 15 kills<br>
+- Unstoppable! 20 kills<br>
+- God Like! 25 kills</blockquote>
+
+<p><a name="fSuicides"></a><b>Suicides</b></p>
+<blockquote><p>Number of times a player dies due to action of their own cause.
+Suicides can be environment induced (drowning, getting crushed, falling) or
+weapon related (fatal splash damage from their own weapon).</p></blockquote>
+
+<p><a name="fTD"></a><b>Team Deaths</b></p>
+<blockquote><p>Number of times a player in a team based game is killed by
+someone on their own team.</p></blockquote>
+
+<p><a name="fTK"></a><b>Team Kills</b></p>
+<blockquote><p>Number of times a player in a team based game kills someone on
+their own team.<br>
+Note: Team kills subtract from a player\'s personal frags and thus the team frags
+as a whole.</p></blockquote>
+
+<p><a name="fTTL"></a><b>TTL</b></p>
+<blockquote><p>TTL is Time to Live.<br>
+Its the length of time you are in a game in seconds divided by how many times you die,
+thus giving an average time of how long you will live.</p></blockquote>
+
+</blockquote>
+
+<p><a name="statserver"></a><b>Enabling Stats on a Server</b></p>
+<blockquote><p>Download and get the latest information on UTStats by clicking
+ the forum link to the left.</p></blockquote>
+
+<br>
+<a href="#Top">Back to Top</a>
+</div>';
+?>
\ No newline at end of file diff --git a/html/pages/home.php b/html/pages/home.php new file mode 100755 index 0000000..3cb167d --- /dev/null +++ b/html/pages/home.php @@ -0,0 +1,100 @@ +<?php
+echo'
+<table class="box" border="0" cellpadding="1" cellspacing="1" width="450">
+ <tbody><tr>
+ <td class="heading" colspan="5" align="center">UTStats Summary</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center">Players</td>
+ <td class="smheading" align="center">Servers</td>
+ <td class="smheading" align="center">Maps</td>
+ <td class="smheading" align="center">Matches Logged</td>
+ <td class="smheading" align="center">Player Hours</td>
+ </tr>';
+
+// Get Summary Info
+$r_playercount = small_query("SELECT COUNT(*) AS result FROM uts_pinfo");
+$playercount = $r_playercount['result'];
+$servercount = small_count("SELECT DISTINCT servername FROM uts_match");
+$mapcount = small_count("SELECT COUNT(mapfile) AS result FROM uts_match GROUP BY mapfile");
+$r_matchcount = small_query("SELECT COUNT(*) AS result FROM uts_match");
+$matchcount= $r_matchcount['result'];
+$hourscount = small_query("SELECT SUM(gametime) AS result FROM uts_player");
+
+$gametime = sec2hour($hourscount[result]);
+
+echo'
+ <tr>
+ <td class="lggrey" align="center">'.$playercount.'</td>
+ <td class="lggrey" align="center">'.$servercount.'</td>
+ <td class="lggrey" align="center">'.$mapcount.'</td>
+ <td class="lggrey" align="center">'.$matchcount.'</td>
+ <td class="lggrey" align="center">'.$gametime.'</td>
+ </tr>
+</tbody></table>
+
+<table border="0" width="600">
+ <tbody><tr>
+ <td align="center">
+ <div class="titlemsg">
+ <p>Welcome to UTStats.<br>
+ Here you can look up information on UT matches and players.<br>
+ Select a category from the column on the left.<br></p>
+ </div>
+
+ <table class="box" border="0" cellpadding="1" cellspacing="2">
+ <tbody><tr>
+ <td class="heading" colspan="8" align="center">Game Summary</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center" width="150">Match Type</td>
+ <td class="smheading" align="center" width="52">Frags</td>
+ <td class="smheading" align="center" width="52">Kills</td>
+ <td class="smheading" align="center" width="52">Suicides</td>
+ <td class="smheading" align="center" width="40">Team Kills</td>
+ <td class="smheading" align="center" width="52">Matches</td>
+ <td class="smheading" align="center" width="52">Game Hours</td>
+ </tr>';
+
+$sql_gamesummary = "SELECT g.id AS gid, g.name AS gamename, SUM(p.frags) AS frags, SUM(p.kills) AS kills, SUM(p.suicides) AS suicides, SUM(p.teamkills) AS teamkills, COUNT(DISTINCT p.matchid) AS matchcount
+FROM uts_player AS p, uts_games AS g WHERE p.gid = g.id GROUP BY gamename ORDER BY gamename ASC";
+$q_gamesummary = mysql_query($sql_gamesummary) or die(mysql_error());
+while ($r_gamesummary = mysql_fetch_array($q_gamesummary)) {
+
+ $gid = $r_gamesummary[gid];
+
+ $q_gametime = small_query("SELECT SUM(gametime) AS gametime FROM uts_match WHERE gid = '$gid'");
+ $gametime = sec2hour($q_gametime[gametime]);
+
+ echo'<tr><td class="dark" align="center">'.$r_gamesummary[gamename].'</td>
+ <td class="grey" align="center">'.$r_gamesummary[frags].'</td>
+ <td class="grey" align="center">'.$r_gamesummary[kills].'</td>
+ <td class="grey" align="center">'.$r_gamesummary[suicides].'</td>
+ <td class="grey" align="center">'.$r_gamesummary[teamkills].'</td>
+ <td class="grey" align="center">'.$r_gamesummary[matchcount].'</td>
+ <td class="grey" align="center">'.$gametime.'</td>';
+}
+
+$totalsummary = small_query("SELECT SUM(p.frags) AS frags, SUM(p.kills) AS kills, SUM(p.suicides) AS suicides, SUM(p.teamkills) AS teamkills, COUNT(DISTINCT p.matchid) AS matchcount, SUM(p.gametime) AS gametime
+FROM uts_player AS p, uts_games AS g WHERE p.gid = g.id");
+
+$q_gametime = small_query("SELECT SUM(gametime) AS gametime FROM uts_match");
+$gametime = sec2hour($q_gametime[gametime]);
+
+echo' <tr>
+ <td class="dark" align="center"><b>Totals for All Players</b></td>
+ <td class="darkgrey" align="center">'.$totalsummary[frags].'</td>
+ <td class="darkgrey" align="center">'.$totalsummary[kills].'</td>
+ <td class="darkgrey" align="center">'.$totalsummary[suicides].'</td>
+ <td class="darkgrey" align="center">'.$totalsummary[teamkills].'</td>
+ <td class="darkgrey" align="center">'.$totalsummary[matchcount].'</td>
+ <td class="darkgrey" align="center">'.$gametime.'</td>
+ </tr>
+ </tbody></table>
+</tbody></table><br>';
+
+// Do graph stuff
+$gtitle = "Across All Servers";
+$bgwhere = "id >= 0";
+include("pages/graph_mbreakdown.php");
+?>
\ No newline at end of file diff --git a/html/pages/index.htm b/html/pages/index.htm new file mode 100755 index 0000000..e69de29 --- /dev/null +++ b/html/pages/index.htm diff --git a/html/pages/maps.php b/html/pages/maps.php new file mode 100755 index 0000000..409398c --- /dev/null +++ b/html/pages/maps.php @@ -0,0 +1,143 @@ +<?php
+function InvertSort($curr_field, $filter, $sort) {
+ if ($curr_field != $filter) return(($curr_field == "mapfile") ? "ASC" : "DESC");
+ if ($sort == 'ASC') return('DESC');
+ return('ASC');
+}
+
+function SortPic($curr_field, $filter, $sort) {
+ if ($curr_field != $filter) return;
+ $fname = 'images/s_'. strtolower($sort) .'.png';
+ if (!file_exists($fname)) return;
+ return(' <img src="'. $fname .'" border="0" width="11" height="9" alt="" title="('.strtolower($sort).'ending)">');
+}
+
+
+// Get filter and set sorting
+$filter = my_addslashes($_GET[filter]);
+$sort = my_addslashes($_GET[sort]);
+$q = my_addslashes($_GET[q]);
+$gid = preg_replace('/\D/', '', $_GET[gid]);
+
+IF (empty($filter) or (!in_array(strtolower($filter), array("mapfile", "matchcount", "frags", "matchscore", "gametime")))) {
+ $filter = "mapfile";
+}
+
+if (empty($sort) or ($sort != 'ASC' and $sort != 'DESC')) $sort = ($filter == "mapfile") ? "ASC" : "DESC";
+
+if (isset($gid)) {
+ if ($gid != 0) {
+ $url_condition .= "&gid=".urlencode($gid);
+ $sql_condition = " WHERE gid = $gid";
+ }
+}
+else {
+ $gid = 0;
+}
+
+if (isset($q)) {
+ if ($gid != 0) {
+ $sql_condition .= ' AND mapfile LIKE "%' . $q . '%" ';
+ }
+ else {
+ $sql_condition .= ' WHERE mapfile LIKE "%' . $q . '%" ';
+ }
+ $url_condition .= "&q=".urlencode($q);
+}
+
+
+// Firstly we need to work out First Last Next Prev pages
+
+$mcount = small_count("SELECT mapfile FROM uts_match" . $sql_condition . " GROUP BY mapfile");
+
+$ecount = $mcount/25;
+$ecount2 = number_format($ecount, 0, '.', '');
+
+IF($ecount > $ecount2) {
+ $ecount2 = $ecount2+1;
+}
+
+$fpage = 0;
+IF($ecount < 1) { $lpage = 0; }
+else { $lpage = $ecount2-1; }
+
+$cpage = preg_replace('/\D/', '', $_GET["page"]);
+IF ($cpage == "") { $cpage = "0"; }
+$qpage = $cpage*25;
+
+$tfpage = $cpage+1;
+$tlpage = $lpage+1;
+
+$ppage = $cpage-1;
+$ppageurl = "<a class=\"pages\" href=\"./?p=maps&filter=$filter&sort=$sort&page=$ppage".$url_condition."\">[Previous]</a>";
+IF ($ppage < "0") { $ppageurl = "[Previous]"; }
+
+$npage = $cpage+1;
+$npageurl = "<a class=\"pages\" href=\"./?p=maps&filter=$filter&sort=$sort&page=$npage".$url_condition."\">[Next]</a>";
+IF ($npage >= "$ecount") { $npageurl = "[Next]"; }
+
+$fpageurl = "<a class=\"pages\" href=\"./?p=maps&filter=$filter&sort=$sort&page=$fpage".$url_condition."\">[First]</a>";
+IF ($cpage == "0") { $fpageurl = "[First]"; }
+
+$lpageurl = "<a class=\"pages\" href=\"./?p=maps&filter=$filter&sort=$sort&page=$lpage".$url_condition."\">[Last]</a>";
+IF ($cpage == "$lpage") { $lpageurl = "[Last]"; }
+
+echo'
+<form NAME="mapfilter" METHOD="get" ACTION="">
+<div class="pages"><b>Page ['.$tfpage.'/'.$tlpage.'] Selection: '.$fpageurl.' / '.$ppageurl.' / '.$npageurl.' / '.$lpageurl.'</b></div>
+<table class="box" border="0" cellpadding="1" cellspacing="1">
+ <tbody><tr>
+ <td class="heading" colspan="5" align="center">Unreal Tournament Maps List</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center" width="100%" colspan="5">
+ <input type = "hidden" name = "p" value = "maps">
+ <input type = "hidden" name = "sort" value = "'.$sort.'">
+ <input type = "hidden" name = "filter" value = "'.$filter.'">
+ Filter: ';
+echo '<select class="searchform" name="gid">';
+echo '<option value="0">*</option>';
+$sql_game = "SELECT DISTINCT(p.gid), g.name FROM uts_player AS p, uts_games AS g WHERE p.gid = g.id ORDER BY g.name ASC";
+$q_game = mysql_query($sql_game) or die(mysql_error());
+while ($r_game = mysql_fetch_array($q_game)) {
+ $selected = ($r_game['gid'] == $gid) ? 'selected' : '';
+ echo '<option '.$selected.' value="'.$r_game['gid'].'">'. $r_game['name'] .'</option>';
+}
+echo '</select> ';
+echo ' Search: <input type = "text" name="q" size="16"'.(empty($q) ? '' : ' value="'.htmlentities($q).'"').'>';
+echo ' <input class="searchform" type="Submit" value="Apply">';
+echo '
+ </td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center" width="250"><a class="smheading" href="./?p=maps&filter=mapfile&sort='.InvertSort('mapfile', $filter, $sort).$url_condition.'">Map Name</a>'.SortPic('mapfile', $filter, $sort).'</td>
+ <td class="smheading" align="center" width="150"><a class="smheading" href="./?p=maps&filter=matchcount&sort='.InvertSort('matchcount', $filter, $sort).$url_condition.'">Matches</a>'.SortPic('matchcount', $filter, $sort).'</td>
+ <td class="smheading" align="center"><a class="smheading" href="./?p=maps&filter=frags&sort='.InvertSort('frags', $filter, $sort).$url_condition.'">Avg. Frags</a>'.SortPic('frags', $filter, $sort).'</td>
+ <td class="smheading" align="center" width="100"><a class="smheading" href="./?p=maps&filter=matchscore&sort='.InvertSort('matchscore', $filter, $sort).$url_condition.'">Avg. Score</a>'.SortPic('matchscore', $filter, $sort).'</td>
+ <td class="smheading" align="center" width="100"><a class="smheading" href="./?p=maps&filter=gametime&sort='.InvertSort('gametime', $filter, $sort).$url_condition.'">Time</a>'.SortPic('gametime', $filter, $sort).'</td>
+ </tr>';
+
+$sql_maps = "SELECT IF(RIGHT(mapfile,4) LIKE '.unr', mapfile, CONCAT(mapfile, '.unr')) as mapfile, COUNT(id) AS matchcount, AVG(frags) AS frags, AVG(t0score+t1score+t2score+t3score) AS matchscore, SUM(gametime) AS gametime
+FROM uts_match" . $sql_condition . " GROUP BY mapfile ORDER BY $filter $sort LIMIT $qpage,25";
+$q_maps = mysql_query($sql_maps) or die(mysql_error());
+while ($r_maps = mysql_fetch_array($q_maps)) {
+
+ $r_mapfile = un_ut($r_maps[mapfile]);
+ $myurl = urlencode($r_mapfile);
+ $r_gametime = GetMinutes($r_maps[gametime]);
+
+ echo'
+ <tr>
+ <td class="dark" align="center"><a class="darkhuman" href="./?p=minfo&map='.$myurl.'">'.$r_mapfile.'</a></td>
+ <td class="grey" align="center">'.$r_maps[matchcount].'</td>
+ <td class="grey" align="center">'.get_dp($r_maps[frags]).'</td>
+ <td class="grey" align="center">'.get_dp($r_maps[matchscore]).'</td>
+ <td class="grey" align="center">'.$r_gametime.'</td>
+ </tr>';
+}
+
+echo'
+</tbody></table>
+<div class="pages"><b>Page ['.$tfpage.'/'.$tlpage.'] Selection: '.$fpageurl.' / '.$ppageurl.' / '.$npageurl.' / '.$lpageurl.'</b></div>
+</form>';
+?>
\ No newline at end of file diff --git a/html/pages/maps_info.php b/html/pages/maps_info.php new file mode 100755 index 0000000..329fcce --- /dev/null +++ b/html/pages/maps_info.php @@ -0,0 +1,321 @@ +<?php
+$map = my_addslashes($_GET[map]);
+$bugmap = my_addslashes($_GET[map]);
+$realmap = $bugmap.".unr";
+
+$map_matches = small_query("SELECT COUNT(id) as matchcount, SUM(t0score+t1score+t2score+t3score) AS gamescore,
+SUM(gametime) AS gametime, SUM(kills) AS kills, SUM(deaths) AS deaths, SUM(suicides) AS suicides, SUM(teamkills) AS teamkills FROM uts_match WHERE mapfile = '$realmap' OR mapfile = '$bugmap'");
+$map_last = small_query("SELECT time FROM uts_match WHERE mapfile = '$realmap' OR mapfile = '$bugmap' ORDER BY time DESC LIMIT 0,1");
+
+$map_tottime = GetMinutes($map_matches[gametime]);
+$map_lastmatch = mdate($map_last[time]);
+
+// Map pic code
+$mappic = strtolower("images/maps/".$map.".jpg");
+
+if (file_exists($mappic)) {
+} else {
+ $mappic = ("images/maps/blank.jpg");
+}
+
+echo'
+<table class = "box" border="0" cellpadding="1" cellspacing="2" width="100%">
+ <tbody><tr>
+ <td class="heading" align="center" colspan="4">Statistics for '.htmlentities($map).'</td>
+ </tr>
+ <tr>
+ <td class="dark" align="center">Matches</td>
+ <td class="grey" align="center">'.$map_matches[matchcount].'</td>
+ <td class="grey" align="center" rowspan="9"><img border="0" alt="'.htmlentities($map).'" title="'.htmlentities($map).'" src="'.$mappic.'"></td>
+ </tr>
+ <tr>
+ <td class="dark" align="center">Total Time</td>
+ <td class="grey" align="center">'.$map_tottime.' minutes</td>
+ </tr>';
+// Show some gametype specific stuff
+if ((strtolower(substr($map, 0, 7)) == "ctf-bt-") or (strtolower(substr($map, 0, 3)) == "bt-")) {
+ // Bunny Track
+ $record = small_query("SELECT pi.id, pi.name AS name, pi.country, e.col3 AS time, e.col4 AS date FROM uts_events AS e, uts_pinfo AS pi, uts_player AS p, uts_match AS m WHERE m.id = e.matchid AND m.id = p.matchid AND p.playerid = e.playerid AND pi.id = p.pid AND (m.mapfile = '$realmap' OR m.mapfile = '$bugmap') AND e.col1 = 'btcap' GROUP BY pi.id ORDER BY (0 + e.col3) ASC, e.col4 ASC LIMIT 0,1");
+ if (!empty($record['time'])) {
+ echo '
+ <tr>
+ <td class="dark" align="center">Fastest Capture</td>
+ <td class="grey" align="center"><a href="?p=pinfo&pid='.$record[id].'">'.FormatPlayerName($record['country'], $record['id'], $record['name']).'</a><br>' . btcaptime($record['time']) . ' minutes<BR>'.gmdate('d-m-Y h:i a', $record['date']).'</td>
+ </tr>';
+ }
+ else {
+ echo '
+ <tr>
+ <td class="dark" align="center">Fastest Capture</td>
+ <td class="grey" align="center">No record set!</td>
+ </tr>';
+ }
+ echo '
+ <tr>
+ <td class="dark" align="center">Total Flags Captured</td>
+ <td class="grey" align="center">'.$map_matches[gamescore].'</td>
+ </tr>
+ <tr>
+ <td class="dark" align="center">Total Suicides</td>
+ <td class="grey" align="center">'.$map_matches[suicides].'</td>
+ </tr>';
+}
+else if (strtolower(substr($map, 0, 4)) == "ctf-") {
+ // Capture the Flag
+ $totals = small_query("SELECT SUM(p.flag_taken) as flag_taken, SUM(p.flag_return) AS flag_return, SUM(p.flag_cover) AS flag_cover FROM uts_player AS p, uts_match AS m WHERE m.id = p.matchid AND (m.mapfile = '$realmap' OR m.mapfile = '$bugmap')");
+ echo '
+ <tr>
+ <td class="dark" align="center">Total Flags Captured</td>
+ <td class="grey" align="center">'.$map_matches[gamescore].'</td>
+ </tr>
+ <tr>
+ <td class="dark" align="center">Total Flags Taken</td>
+ <td class="grey" align="center">'.$totals['flag_taken'].'</td>
+ </tr>
+ <tr>
+ <td class="dark" align="center">Total Covers</td>
+ <td class="grey" align="center">'.$totals['flag_cover'].'</td>
+ </tr>
+ <tr>
+ <td class="dark" align="center">Total Flags Returned</td>
+ <td class="grey" align="center">'.$totals['flag_return'].'</td>
+ </tr>
+ <tr>
+ <td class="dark" align="center">Total Kills</td>
+ <td class="grey" align="center">'.$map_matches[kills].'</td>
+ </tr>
+ <tr>
+ <td class="dark" align="center">Total Suicides</td>
+ <td class="grey" align="center">'.$map_matches[suicides].'</td>
+ </tr>';
+}
+else if (strtolower(substr($map, 0, 3)) == "as-") {
+ // Assault
+ $totals = small_query("SELECT SUM(p.ass_obj) as ass_obj FROM uts_player AS p, uts_match AS m WHERE m.id = p.matchid AND (m.mapfile = '$realmap' OR m.mapfile = '$bugmap')");
+ echo '
+ <tr>
+ <td class="dark" align="center">Total Objectives Achieved</td>
+ <td class="grey" align="center">'.$totals[ass_obj].'</td>
+ </tr>
+ <tr>
+ <td class="dark" align="center">Total Kills</td>
+ <td class="grey" align="center">'.$map_matches[kills].'</td>
+ </tr>
+ <tr>
+ <td class="dark" align="center">Total Suicides</td>
+ <td class="grey" align="center">'.$map_matches[suicides].'</td>
+ </tr>';
+}
+else if (strtolower(substr($map, 0, 3)) == "jb-") {
+ // Assault
+ $totals = small_query("SELECT SUM(p.ass_obj) as ass_obj FROM uts_player AS p, uts_match AS m WHERE m.id = p.matchid AND (m.mapfile = '$realmap' OR m.mapfile = '$bugmap')");
+ echo '
+ <tr>
+ <td class="dark" align="center">Team Releases</td>
+ <td class="grey" align="center">'.$totals[ass_obj].'</td>
+ </tr>
+ <tr>
+ <td class="dark" align="center">Total Kills</td>
+ <td class="grey" align="center">'.$map_matches[kills].'</td>
+ </tr>
+ <tr>
+ <td class="dark" align="center">Total Suicides</td>
+ <td class="grey" align="center">'.$map_matches[suicides].'</td>
+ </tr>';
+}
+else if (strtolower(substr($map, 0, 4)) == "dom-") {
+ // Assault
+ $totals = small_query("SELECT SUM(p.dom_cp) as dom_cp FROM uts_player AS p, uts_match AS m WHERE m.id = p.matchid AND (m.mapfile = '$realmap' OR m.mapfile = '$bugmap')");
+ echo '
+ <tr>
+ <td class="dark" align="center">Total Control Points Captured</td>
+ <td class="grey" align="center">'.$totals['dom_cp'].'</td>
+ </tr>
+ <tr>
+ <td class="dark" align="center">Total Kills</td>
+ <td class="grey" align="center">'.$map_matches[kills].'</td>
+ </tr>
+ <tr>
+ <td class="dark" align="center">Total Suicides</td>
+ <td class="grey" align="center">'.$map_matches[suicides].'</td>
+ </tr>';
+}
+else {
+ echo '
+ <tr>
+ <td class="dark" align="center">Total Score</td>
+ <td class="grey" align="center">'.$map_matches[gamescore].'</td>
+ </tr>
+ <tr>
+ <td class="dark" align="center">Total Kills</td>
+ <td class="grey" align="center">'.$map_matches[kills].'</td>
+ </tr>
+ <tr>
+ <td class="dark" align="center">Total Teamkills</td>
+ <td class="grey" align="center">'.$map_matches[teamkills].'</td>
+ </tr>
+ <tr>
+ <td class="dark" align="center">Total Suicides</td>
+ <td class="grey" align="center">'.$map_matches[suicides].'</td>
+ </tr>';
+}
+echo '
+ <tr>
+ <td class="dark" align="center">Last Match</td>
+ <td class="grey" align="center">'.$map_lastmatch.'</td>
+ </tr>
+</tbody></table>
+<br>';
+
+// Do graph stuff
+$bgwhere = "(mapfile = '$realmap' or mapfile = '$bugmap')";
+include("pages/graph_mbreakdown.php");
+
+// Show a list of BT records
+if ((strtolower(substr($map, 0, 7)) == "ctf-bt-") or (strtolower(substr($map, 0, 3)) == "bt-")) {
+ $mcount = small_count("SELECT pi.id FROM uts_events AS e, uts_pinfo AS pi, uts_player AS p, uts_match AS m WHERE m.id = e.matchid AND m.id = p.matchid AND p.playerid = e.playerid AND pi.id = p.pid AND (m.mapfile = '$realmap' OR m.mapfile = '$bugmap') GROUP BY pi.id");
+
+ $ecount = $mcount/25;
+ $ecount2 = number_format($ecount, 0, '.', '');
+
+ IF($ecount > $ecount2) {
+ $ecount2 = $ecount2+1;
+ }
+
+ $fpage = 0;
+ IF($ecount < 1) { $lpage = 0; }
+ else { $lpage = $ecount2-1; }
+
+ $cpage = preg_replace('/\D/', '', $_GET["rpage"]);
+ $qpage = $cpage*25;
+
+ IF ($cpage == "") { $cpage = "0"; }
+
+ $tfpage = $cpage+1;
+ $tlpage = $lpage+1;
+
+ $ppage = $cpage-1;
+ $ppageurl = "<a class=\"pages\" href=\"./?p=minfo&map=".htmlentities($map)."&rpage=$ppage\">[Previous]</a>";
+ IF ($ppage < "0") { $ppageurl = "[Previous]"; }
+
+ $npage = $cpage+1;
+ $npageurl = "<a class=\"pages\" href=\"./?p=minfo&map=".htmlentities($map)."&rpage=$npage\">[Next]</a>";
+ IF ($npage >= "$ecount") { $npageurl = "[Next]"; }
+
+ $fpageurl = "<a class=\"pages\" href=\"./?p=minfo&map=".htmlentities($map)."&rpage=$fpage\">[First]</a>";
+ IF ($cpage == "0") { $fpageurl = "[First]"; }
+
+ $lpageurl = "<a class=\"pages\" href=\"./?p=minfo&map=".htmlentities($map)."&rpage=$lpage\">[Last]</a>";
+ IF ($cpage == "$lpage") { $lpageurl = "[Last]"; }
+
+ $sql_btrecords = "SELECT pi.id, pi.name AS name, pi.country, e.col3 AS time, e.col4 AS date FROM uts_events AS e, uts_pinfo AS pi, uts_player AS p, uts_match AS m WHERE m.id = e.matchid AND m.id = p.matchid AND p.playerid = e.playerid AND pi.id = p.pid AND (m.mapfile = '$realmap' OR m.mapfile = '$bugmap') AND e.col1 = 'btcap' GROUP BY pi.id ORDER BY (0 + e.col3) ASC, e.col4 ASC LIMIT $qpage,25";
+ $q_btrecords = mysql_query($sql_btrecords) or die (mysql_error());
+ if (mysql_num_rows($q_btrecords) > 0) {
+ echo '
+ <div class="pages"><b>Page ['.$tfpage.'/'.$tlpage.'] Selection: '.$fpageurl.' / '.$ppageurl.' / '.$npageurl.' / '.$lpageurl.'</b></div>
+ <table class = "box" border="0" cellpadding="0" cellspacing="2" width="480">
+ <tbody>
+ <tr>
+ <td class="heading" colspan="4" align="center">Fastest captures</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center" width="40">N°</td>
+ <td class="smheading" align="center" width="200">Name</td>
+ <td class="smheading" align="center" width="60">Time</td>
+ <td class="smheading" align="center" width="180">Date</td>
+ </tr>';
+ $i = $qpage;
+ $lasttime = -1;
+ while ($r_btrecords = mysql_fetch_array($q_btrecords)) {
+ $i++;
+ $class = ($i%2) ? 'grey' : 'grey2';
+ echo '
+ <tr><td class = "'.$class.'" align = "right">'.($lasttime == $r_btrecords['time'] ? '' : $i).' </td>
+ <td class = "'.$class.'" align = "center"><a href="?p=pinfo&pid='.$r_btrecords[id].'">', FormatPlayerName($r_btrecords['country'], $r_btrecords['id'], $r_btrecords['name']), '</a></td>
+ <td class = "'.$class.'" align = "center">', btcaptime($r_btrecords['time']), '</td>
+ <td class = "'.$class.'" align = "center">', gmdate('d-m-Y h:i a', $r_btrecords['date']), '</td></tr>';
+ $lasttime = $r_btrecords['time'];
+ }
+ echo '
+ </tbody>
+ </table>
+ <div class="pages"><b>Page ['.$tfpage.'/'.$tlpage.'] Selection: '.$fpageurl.' / '.$ppageurl.' / '.$npageurl.' / '.$lpageurl.'</b></div><br>';
+ }
+}
+
+
+
+// Show a list of recent matches
+$mcount = small_count("SELECT id FROM uts_match WHERE mapfile = '$realmap' OR mapfile = '$bugmap' GROUP BY id");
+
+$ecount = $mcount/25;
+$ecount2 = number_format($ecount, 0, '.', '');
+
+IF($ecount > $ecount2) {
+ $ecount2 = $ecount2+1;
+}
+
+$fpage = 0;
+IF($ecount < 1) { $lpage = 0; }
+else { $lpage = $ecount2-1; }
+
+$cpage = preg_replace('/\D/', '', $_GET["page"]);
+$qpage = $cpage*25;
+
+IF ($cpage == "") { $cpage = "0"; }
+
+$tfpage = $cpage+1;
+$tlpage = $lpage+1;
+
+$ppage = $cpage-1;
+$ppageurl = "<a class=\"pages\" href=\"./?p=minfo&map=".htmlentities($map)."&page=$ppage\">[Previous]</a>";
+IF ($ppage < "0") { $ppageurl = "[Previous]"; }
+
+$npage = $cpage+1;
+$npageurl = "<a class=\"pages\" href=\"./?p=minfo&map=".htmlentities($map)."&page=$npage\">[Next]</a>";
+IF ($npage >= "$ecount") { $npageurl = "[Next]"; }
+
+$fpageurl = "<a class=\"pages\" href=\"./?p=minfo&map=".htmlentities($map)."&page=$fpage\">[First]</a>";
+IF ($cpage == "0") { $fpageurl = "[First]"; }
+
+$lpageurl = "<a class=\"pages\" href=\"./?p=minfo&map=".htmlentities($map)."&page=$lpage\">[Last]</a>";
+IF ($cpage == "$lpage") { $lpageurl = "[Last]"; }
+
+// list recent matches
+echo'
+<div class="pages"><b>Page ['.$tfpage.'/'.$tlpage.'] Selection: '.$fpageurl.' / '.$ppageurl.' / '.$npageurl.' / '.$lpageurl.'</b></div>
+<table class="box" border="0" cellpadding="1" cellspacing="1">
+ <tbody><tr>
+ <td class="heading" colspan="5" align="center">Recent Matches</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center" width="250">Date</td>
+ <td class="smheading" align="center" width="100">Match Type</td>
+ <td class="smheading" align="center">Player Count</td>
+ <td class="smheading" align="center" width="100">Time</td>
+ </tr>';
+
+$sql_maps = "SELECT m.id, m.time, g.name AS gamename, m.gametime
+FROM uts_match AS m, uts_games AS g WHERE (m.mapfile = '$realmap' OR m.mapfile = '$bugmap') AND m.gid = g.id ORDER BY time DESC LIMIT $qpage,25";
+$q_maps = mysql_query($sql_maps) or die(mysql_error());
+while ($r_maps = mysql_fetch_array($q_maps)) {
+
+ $r_mapfile = un_ut($r_maps[mapfile]);
+ $r_matchtime = mdate($r_maps[time]);
+ $r_gametime = GetMinutes($r_maps[gametime]);
+
+ $map_pcount = small_count("SELECT id FROM uts_player WHERE matchid = $r_maps[id]");
+
+ echo'
+ <tr>
+ <td class="dark" align="center"><a class="darkhuman" href="./?p=match&mid='.$r_maps[id].'">'.$r_matchtime.'</a></td>
+ <td class="grey" align="center">'.$r_maps[gamename].'</td>
+ <td class="grey" align="center">'.$map_pcount.'</td>
+ <td class="grey" align="center">'.$r_gametime.'</td>
+ </tr>';
+}
+
+echo'
+</tbody></table>
+<div class="pages"><b>Page ['.$tfpage.'/'.$tlpage.'] Selection: '.$fpageurl.' / '.$ppageurl.' / '.$npageurl.' / '.$lpageurl.'</b></div>';
+?>
diff --git a/html/pages/match.php b/html/pages/match.php new file mode 100755 index 0000000..22a0399 --- /dev/null +++ b/html/pages/match.php @@ -0,0 +1,10 @@ +<?php
+$mid = preg_replace('/\D/', '', $_GET[mid]);
+$pid = preg_replace('/\D/', '', $_GET[pid]);
+
+IF ($pid != "") {
+ include("match_player.php");
+} else {
+ include("match_info.php");
+}
+?>
\ No newline at end of file diff --git a/html/pages/match_info.php b/html/pages/match_info.php new file mode 100755 index 0000000..27b6669 --- /dev/null +++ b/html/pages/match_info.php @@ -0,0 +1,78 @@ +<?php
+$r_info = small_query("SELECT teamgame, t0, t1, t2, t3, t0score, t1score, t2score, t3score FROM uts_match WHERE id = '$mid'");
+if (!$r_info) die("Match not found");
+$teamgame = ($r_info['teamgame'] == 'True') ? true : false;
+
+echo '
+<table class = "box" border="0" cellpadding="1" cellspacing="2" width="720">
+ <tbody><tr>
+ <td class="heading" align="center">Unreal Tournament Match</td>
+ </tr>
+</tbody></table>
+<br>';
+include("pages/match_info_server.php");
+
+$GLOBALS['gid'] = $gid;
+$_GLOBALS['gid'] = $gid;
+$GLOBALS['gamename'] = $gamename;
+$_GLOBALS['gamename'] = $gamename;
+
+include('includes/teamstats.php');
+switch($real_gamename) {
+ case "Assault":
+ case "Assault (insta)":
+ include("pages/match_info_ass.php");
+ break;
+
+ case "Capture the Flag":
+ case "Capture the Flag (insta)":
+ include("pages/match_info_ctf.php");
+ teamstats($mid, 'Match Summary');
+ break;
+
+ case "Domination":
+ case "Domination (insta)":
+ teamstats($mid, 'Match Summary', 'dom_cp', 'Dom Pts');
+ break;
+
+ case "JailBreak":
+ case "JailBreak (insta)":
+ teamstats($mid, 'Match Summary', 'ass_obj', 'Team Releases');
+ break;
+
+ case "Bunny Track":
+ include("pages/match_info_bt.php");
+ break;
+
+ case "Extended Last Man Standing":
+ case "Extended Last Man Standing (insta)":
+ case "Last Man Standing":
+ case "Last Man Standing (insta)":
+ case "Last Man Standing +":
+ case "Last Man Standing + (insta)":
+ case "Last Man Standing++":
+ case "Last Man Standing++ (insta)":
+ include("pages/match_info_lms.php");
+ break;
+
+ default:
+ if ($teamgame) {
+ teamstats($mid, 'Match Summary');
+ } else {
+ teamstats($mid, 'Player Summary');
+ }
+}
+
+
+if ($real_gamename == "Assault" or $real_gamename== "Assault (insta)") {
+ include("pages/match_info_other2.php");
+}
+else if ($real_gamename != "Bunny Track") {
+ include("pages/match_info_other.php");
+}
+
+if ($real_gamename == "Capture the Flag" or $real_gamename== "Capture the Flag (insta)") {
+ include("pages/match_report.php");
+}
+
+?>
\ No newline at end of file diff --git a/html/pages/match_info_ass.php b/html/pages/match_info_ass.php new file mode 100755 index 0000000..df968ec --- /dev/null +++ b/html/pages/match_info_ass.php @@ -0,0 +1,64 @@ +<?php
+// Get information about this match
+$sql_assault = small_query("SELECT assaultid, ass_att, gametime, ass_win FROM uts_match WHERE id = $mid");
+$ass_id = $sql_assault[assaultid];
+$gametime = $sql_assault[gametime];
+
+// Get information about the other match
+$sql_assault2 = small_query("SELECT id, gametime, ass_win FROM uts_match WHERE assaultid = '$ass_id' AND id != $mid LIMIT 0,1");
+$mid2 = $sql_assault2[id];
+$gametime2 = $sql_assault2[gametime];
+
+// Work out who was attacking which match
+$ass_att = $sql_assault[ass_att];
+IF($ass_att == 0) {
+ $ass_att = "Red";
+ $ass_att2 = "Blue";
+} else {
+ $ass_att = "Blue";
+ $ass_att2 = "Red";
+}
+
+// Work out the end result for each match
+$asswin = $sql_assault[ass_win];
+$asswin2 = $sql_assault2[ass_win];
+IF($asswin == 0) {
+ $asswin = "$ass_att2 Successfully Defended";
+} else {
+ $asswin = "$ass_att Successfully Attacked";
+}
+
+IF($asswin2 == 0) {
+ $asswin2 = "$ass_att Successfully Defended";
+} else {
+ $asswin2 = "$ass_att2 Successfully Attacked";
+}
+
+$gametime = sec2min($gametime);
+$gametime2 = sec2min($gametime2);
+
+
+teamstats($mid, 'Match Summary - '.$ass_att.' Team Attacking', 'ass_obj', 'Ass Obj');
+
+echo'
+<table class = "box" border="0" cellpadding="0" cellspacing="2" width="720">
+ <tbody><tr>
+ <td class="hlheading" colspan="15" align="center">'.$asswin.'</td>
+ </tr>
+</tbody></table>
+<br>';
+
+// The Other Game (if it happened)
+
+IF($mid2 != NULL) {
+ teamstats($mid2, 'Match Summary - '.$ass_att2.' Team Attacking', 'ass_obj', 'Ass Obj');
+
+ echo'
+ <table class = "box" border="0" cellpadding="0" cellspacing="2" width="720">
+ <tbody><tr>
+ <td class="hlheading" colspan="15" align="center">'.$asswin2.'</td>
+ </tr>
+ </tbody></table>
+ <br>';
+}
+?>
diff --git a/html/pages/match_info_bt.php b/html/pages/match_info_bt.php new file mode 100755 index 0000000..ed14e3d --- /dev/null +++ b/html/pages/match_info_bt.php @@ -0,0 +1,164 @@ +<?php
+/* get events first
+$sql_caprecords = "SELECT playerid, col3 FROM uts_events WHERE matchid = $mid AND col1 = 'btcap' ORDER BY col3 DESC";
+$q_caprecords = mysql_query($sql_caprecords);
+
+while ($r_caprecords = mysql_fetch_array($q_caprecords)) {
+ $caprecords[$r_caprecords['playerid']] = btcaptime($r_caprecords['col3']);
+} */
+
+echo'
+<table class = "box" border="0" cellpadding="0" cellspacing="2" width="720">
+ <tbody><tr>
+ <td class="heading" colspan="12" align="center">Game Summary</td>
+ </tr>
+ <tr>
+ <td class="hlheading" colspan="12" align="center">Team: Red</td>
+ </tr>
+ <tr>
+ <td class="smheading" rowspan="2" align="center">Player</td>
+ <td class="smheading" rowspan="2" align="center" width="90">Time</td>
+ <td class="smheading" colspan="2" align="center" width="90">Score</td>
+ <td class="smheading" rowspan="2" align="center" width="50">Flag Captures</td>
+ <td class="smheading" rowspan="2" align="center" width="50">Fastest Capture</td>
+ <td class="smheading" rowspan="2" align="center" width="50">Suicides</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center">Team</td>
+ <td class="smheading" align="center">Player</td>
+ </tr>';
+
+$sql_msred = "SELECT p.playerid, pi.name, pi.banned, p.country, p.pid, p.gamescore, p.gametime, p.flag_capture, p.suicides, p.rank, MIN(e.col3) AS captime
+ FROM uts_pinfo AS pi, uts_player AS p
+ LEFT JOIN uts_events AS e
+ ON p.playerid = e.playerid AND p.matchid = e.matchid AND e.col1 = 'btcap'
+ WHERE p.pid = pi.id AND p.matchid = $mid AND team = 0
+ GROUP BY p.playerid
+ ORDER BY e.col1 DESC, (0 + e.col3) ASC, gamescore DESC";
+$q_msred = mysql_query($sql_msred) or die(mysql_error());
+$i = 0;
+while ($r_msred = zero_out(mysql_fetch_array($q_msred))) {
+ if (!$r_msred['playerid']) {
+ $r_msred['playerid'] = 0;
+ }
+ $i++;
+ $class = ($i % 2) ? 'grey' : 'grey2';
+
+ $redpname = $r_msred[name];
+ $myurl = urlencode($r_msred[name]);
+
+
+
+ echo'<tr>';
+ if ($r_msred['banned'] != 'Y') {
+ echo '<td nowrap class="darkhuman" align="left"><a class="darkhuman" href="./?p=matchp&mid='.$mid.'&pid='.$r_msred['pid'].'">'.FormatPlayerName($r_msred[country], $r_msred['pid'], $redpname, $gid, $gamename, true, $r_msred['rank']).'</a></td>';
+ } else {
+ $r_msred ['gamescore'] = '-';
+ $r_msred ['suicides'] = '-';
+ $r_msred ['flag_capture'] = '-';
+ echo '<td nowrap class="darkhuman" align="left"><span style="text-decoration: line-through;">'.FormatPlayerName($r_msred[country], $r_msred['pid'], $redpname, $gid, $gamename, true, $r_msred['rank']).'</span></td>';
+ }
+
+ echo '
+ <td class="'.$class.'" align="center">'.GetMinutes($r_msred[gametime]).'</td>
+ <td class="'.$class.'" align="center"></td>
+ <td class="'.$class.'" align="center">'.$r_msred[gamescore].'</td>
+ <td class="'.$class.'" align="center">'.$r_msred[flag_capture].'</td>
+ <td class="'.$class.'" align="center">'.btcaptime($r_msred[captime]).'</td>
+ <td class="'.$class.'" align="center">'.$r_msred[suicides].'</td>
+ </tr>';
+}
+
+$teamscore = small_query("SELECT t0score AS teamscore FROM uts_match WHERE id = $mid");
+$msredtot = small_query("SELECT SUM(gamescore) AS gamescore, SUM(suicides) AS suicides, SUM(flag_capture) AS flag_capture FROM uts_player WHERE matchid = $mid AND team = 0 ORDER BY gamescore DESC");
+
+
+echo'
+ <tr>
+ <td class="dark" align="center">Totals</td>
+ <td class="darkgrey" align="center"></td>
+ <td class="darkgrey" align="center">'.$teamscore[teamscore].'</td>
+ <td class="darkgrey" align="center">'.$msredtot[gamescore].'</td>
+ <td class="darkgrey" align="center">'.$msredtot[flag_capture].'</td>
+ <td class="darkgrey" align="center"></td>
+ <td class="darkgrey" align="center">'.$msredtot[suicides].'</td>
+ </tr>';
+
+echo'
+ <tr>
+ <td class="hlheading" colspan="12" align="center">Team: Blue</td>
+ </tr>
+ <tr>
+ <td class="smheading" rowspan="2" align="center">Player</td>
+ <td class="smheading" rowspan="2" align="center" width="90">Time</td>
+ <td class="smheading" colspan="2" align="center" width="90">Score</td>
+ <td class="smheading" rowspan="2" align="center" width="50">Flag Captures</td>
+ <td class="smheading" rowspan="2" align="center" width="50">Fastest Capture</td>
+ <td class="smheading" rowspan="2" align="center" width="50">Suicides</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center">Team</td>
+ <td class="smheading" align="center">Player</td>
+ </tr>';
+
+$sql_msblue = "SELECT p.playerid, pi.name, pi.banned, p.country, p.pid, p.gamescore, p.gametime, p.flag_capture, p.suicides, p.rank, MIN(e.col3) AS captime
+ FROM uts_pinfo AS pi, uts_player AS p
+ LEFT JOIN uts_events AS e
+ ON p.playerid = e.playerid AND p.matchid = e.matchid AND e.col1 = 'btcap'
+ WHERE p.pid = pi.id AND p.matchid = $mid AND team = 1
+ GROUP BY p.playerid
+ ORDER BY e.col1 DESC, (0 + e.col3) ASC, gamescore DESC";
+$q_msblue = mysql_query($sql_msblue) or die(mysql_error());
+$i = 0;
+while ($r_msblue = zero_out(mysql_fetch_array($q_msblue))) {
+ if (!$r_msblue['playerid']) {
+ $r_msblue['playerid'] = 0;
+ }
+ $i++;
+ $class = ($i % 2) ? 'grey' : 'grey2';
+
+ $bluepname = $r_msblue[name];
+ $myurl = urlencode($r_msblue[name]);
+
+
+
+ echo'<tr>';
+ if ($r_msblue['banned'] != 'Y') {
+ echo '<td nowrap class="darkhuman" align="left"><a class="darkhuman" href="./?p=matchp&mid='.$mid.'&pid='.$r_msblue['pid'].'">'.FormatPlayerName($r_msblue[country], $r_msblue['pid'], $bluepname, $gid, $gamename, true, $r_msblue['rank']).'</a></td>';
+ } else {
+ $r_msblue ['gamescore'] = '-';
+ $r_msblue ['suicides'] = '-';
+ $r_msblue ['flag_capture'] = '-';
+ echo '<td nowrap class="darkhuman" align="left"><span style="text-decoration: line-through;">'.FormatPlayerName($r_msblue[country], $r_msblue['pid'], $bluepname, $gid, $gamename, true, $r_msblue['rank']).'</span></td>';
+ }
+
+ echo '
+ <td class="'.$class.'" align="center">'.GetMinutes($r_msblue[gametime]).'</td>
+ <td class="'.$class.'" align="center"></td>
+ <td class="'.$class.'" align="center">'.$r_msblue[gamescore].'</td>
+ <td class="'.$class.'" align="center">'.$r_msblue[flag_capture].'</td>
+ <td class="'.$class.'" align="center">'.btcaptime($r_msblue[captime]).'</td>
+ <td class="'.$class.'" align="center">'.$r_msblue[suicides].'</td>
+ </tr>';
+}
+
+$teamscore = small_query("SELECT t1score AS teamscore FROM uts_match WHERE id = $mid");
+$msbluetot = small_query("SELECT SUM(gamescore) AS gamescore, SUM(suicides) AS suicides, SUM(flag_capture) AS flag_capture FROM uts_player WHERE matchid = $mid AND team = 1 ORDER BY gamescore DESC");
+
+
+echo'
+ <tr>
+ <td class="dark" align="center">Totals</td>
+ <td class="darkgrey" align="center"></td>
+ <td class="darkgrey" align="center">'.$teamscore[teamscore].'</td>
+ <td class="darkgrey" align="center">'.$msbluetot[gamescore].'</td>
+ <td class="darkgrey" align="center">'.$msbluetot[flag_capture].'</td>
+ <td class="darkgrey" align="center"></td>
+ <td class="darkgrey" align="center">'.$msbluetot[suicides].'</td>
+ </tr>';
+
+
+echo'</tbody></table>
+<br>';
+
+?>
diff --git a/html/pages/match_info_ctf.php b/html/pages/match_info_ctf.php new file mode 100755 index 0000000..7426a4e --- /dev/null +++ b/html/pages/match_info_ctf.php @@ -0,0 +1,362 @@ +<?php
+echo'
+<table class = "box" border="0" cellpadding="0" cellspacing="2" width="720">
+ <tbody><tr>
+ <td class="heading" colspan="12" align="center">Flag Event Summary</td>
+ </tr>
+ <tr>
+ <td class="hlheading" colspan="12" align="center">Team: Red</td>
+ </tr>
+ <tr>
+ <td class="smheading" rowspan="2" align="center">Player</td>
+ <td class="smheading" colspan="2" align="center" width="90">Score</td>
+ <td class="smheading" rowspan="2" align="center" width="50">Flag Taken</td>
+ <td class="smheading" rowspan="2" align="center" width="50">Flag Pickup</td>
+ <td class="smheading" rowspan="2" align="center" width="50">Flag Drop</td>
+ <td class="smheading" rowspan="2" align="center" width="60">Flag Assist</td>
+ <td class="smheading" rowspan="2" align="center" width="50">Flag Cover</td>
+ <td class="smheading" rowspan="2" align="center" width="50">Flag Seal</td>
+ <td class="smheading" rowspan="2" align="center" width="60">Flag Capture</td>
+ <td class="smheading" rowspan="2" align="center" width="60">Flag Kill</td>
+ <td class="smheading" rowspan="2" align="center" width="50">Flag Return</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center">Team</td>
+ <td class="smheading" align="center">Player</td>
+ </tr>';
+
+$sql_msred = "SELECT p.playerid, pi.name, pi.banned, p.country, p.pid, p.gamescore, p.flag_taken, p.flag_pickedup, p.flag_dropped, p.flag_assist, p.flag_cover, p.flag_seal, p.flag_capture, p.flag_kill, p.flag_return, p.rank
+FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $mid AND team = 0 ORDER BY gamescore DESC";
+$q_msred = mysql_query($sql_msred) or die(mysql_error());
+$i = 0;
+while ($r_msred = zero_out(mysql_fetch_array($q_msred))) {
+ $i++;
+ $class = ($i % 2) ? 'grey' : 'grey2';
+
+ $redpname = $r_msred[name];
+ $myurl = urlencode($r_msred[name]);
+
+
+
+ echo'<tr>';
+ if ($r_msred['banned'] != 'Y') {
+ echo '<td nowrap class="darkhuman" align="left"><a class="darkhuman" href="./?p=matchp&mid='.$mid.'&pid='.$r_msred['pid'].'">'.FormatPlayerName($r_msred[country], $r_msred['pid'], $redpname, $gid, $gamename, true, $r_msred['rank']).'</a></td>';
+ } else {
+ $r_msred ['gamescore'] = '-';
+ $r_msred ['flag_taken'] = '-';
+ $r_msred ['flag_pickedup'] = '-';
+ $r_msred ['flag_dropped'] = '-';
+ $r_msred ['flag_assist'] = '-';
+ $r_msred ['flag_cover'] = '-';
+ $r_msred ['flag_seal'] = '-';
+ $r_msred ['flag_capture'] = '-';
+ $r_msred ['flag_kill'] = '-';
+ $r_msred ['flag_return'] = '-';
+ echo '<td nowrap class="darkhuman" align="left"><span style="text-decoration: line-through;">'.FormatPlayerName($r_msred[country], $r_msred['pid'], $redpname, $gid, $gamename, true, $r_msred['rank']).'</span></td>';
+ }
+
+ echo '
+ <td class="'.$class.'" align="center"></td>
+ <td class="'.$class.'" align="center">'.$r_msred[gamescore].'</td>
+ <td class="'.$class.'" align="center">'.$r_msred[flag_taken].'</td>
+ <td class="'.$class.'" align="center">'.$r_msred[flag_pickedup].'</td>
+ <td class="'.$class.'" align="center">'.$r_msred[flag_dropped].'</td>
+ <td class="'.$class.'" align="center">'.$r_msred[flag_assist].'</td>
+ <td class="'.$class.'" align="center">'.$r_msred[flag_cover].'</td>
+ <td class="'.$class.'" align="center">'.$r_msred[flag_seal].'</td>
+ <td class="'.$class.'" align="center">'.$r_msred[flag_capture].'</td>
+ <td class="'.$class.'" align="center">'.$r_msred[flag_kill].'</td>
+ <td class="'.$class.'" align="center">'.$r_msred[flag_return].'</td>
+ </tr>';
+}
+
+$teamscore = small_query("SELECT t0score AS teamscore FROM uts_match WHERE id = $mid");
+$msredtot = small_query("SELECT SUM(gamescore) AS gamescore, SUM(flag_taken) AS flag_taken, SUM(flag_pickedup) AS flag_pickedup, SUM(flag_dropped) AS flag_dropped, SUM(flag_assist) AS flag_assist, SUM(flag_cover) AS flag_cover, SUM(flag_seal) AS flag_seal, SUM(flag_capture) AS flag_capture, SUM(flag_kill)as flag_kill, SUM(flag_return) AS flag_return
+FROM uts_player WHERE matchid = $mid AND team = 0 ORDER BY gamescore DESC");
+
+
+echo'
+ <tr>
+ <td class="dark" align="center">Totals</td>
+ <td class="darkgrey" align="center">'.$teamscore[teamscore].'</td>
+ <td class="darkgrey" align="center">'.$msredtot[gamescore].'</td>
+ <td class="darkgrey" align="center">'.$msredtot[flag_taken].'</td>
+ <td class="darkgrey" align="center">'.$msredtot[flag_pickedup].'</td>
+ <td class="darkgrey" align="center">'.$msredtot[flag_dropped].'</td>
+ <td class="darkgrey" align="center">'.$msredtot[flag_assist].'</td>
+ <td class="darkgrey" align="center">'.$msredtot[flag_cover].'</td>
+ <td class="darkgrey" align="center">'.$msredtot[flag_seal].'</td>
+ <td class="darkgrey" align="center">'.$msredtot[flag_capture].'</td>
+ <td class="darkgrey" align="center">'.$msredtot[flag_kill].'</td>
+ <td class="darkgrey" align="center">'.$msredtot[flag_return].'</td>
+ </tr>
+
+
+ <tr>
+ <td class="hlheading" colspan="12" align="center">Team: Blue</td>
+ </tr>
+ <tr>
+ <td class="smheading" rowspan="2" align="center">Player</td>
+ <td class="smheading" colspan="2" align="center" width="90">Score</td>
+ <td class="smheading" rowspan="2" align="center" width="50">Flag Taken</td>
+ <td class="smheading" rowspan="2" align="center" width="50">Flag Pickup</td>
+ <td class="smheading" rowspan="2" align="center" width="50">Flag Drop</td>
+ <td class="smheading" rowspan="2" align="center" width="60">Flag Assist</td>
+ <td class="smheading" rowspan="2" align="center" width="50">Flag Cover</td>
+ <td class="smheading" rowspan="2" align="center" width="50">Flag Seal</td>
+ <td class="smheading" rowspan="2" align="center" width="60">Flag Capture</td>
+ <td class="smheading" rowspan="2" align="center" width="60">Flag Kill</td>
+ <td class="smheading" rowspan="2" align="center" width="50">Flag Return</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center">Team</td>
+ <td class="smheading" align="center">Player</td>
+ </tr>';
+
+$sql_msblue = "SELECT p.playerid, pi.name, pi.banned, p.country, p.pid, p.gamescore, p.flag_taken, p.flag_pickedup, p.flag_dropped, p.flag_assist, p.flag_cover, p.flag_seal, p.flag_capture, p.flag_kill, p.flag_return, p.rank
+FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $mid AND team = 1 ORDER BY gamescore DESC";
+$q_msblue = mysql_query($sql_msblue) or die(mysql_error());
+$i = 0;
+while ($r_msblue = zero_out(mysql_fetch_array($q_msblue))) {
+ $i++;
+ $class = ($i % 2) ? 'grey' : 'grey2';
+
+ $bluepname = $r_msblue[name];
+ $myurl = urlencode($r_msblue[name]);
+
+ echo'<tr>';
+ if ($r_msblue['banned'] != 'Y') {
+ echo '<td nowrap class="darkhuman" align="left"><a class="darkhuman" href="./?p=matchp&mid='.$mid.'&pid='.$r_msblue['pid'].'">'.FormatPlayerName($r_msblue[country], $r_msblue['pid'], $bluepname, $gid, $gamename, true, $r_msblue['rank']).'</a></td>';
+ } else {
+ $r_msblue ['gamescore'] = '-';
+ $r_msblue ['flag_taken'] = '-';
+ $r_msblue ['flag_pickedup'] = '-';
+ $r_msblue ['flag_dropped'] = '-';
+ $r_msblue ['flag_assist'] = '-';
+ $r_msblue ['flag_cover'] = '-';
+ $r_msblue ['flag_seal'] = '-';
+ $r_msblue ['flag_capture'] = '-';
+ $r_msblue ['flag_kill'] = '-';
+ $r_msblue ['flag_return'] = '-';
+ echo '<td nowrap class="darkhuman" align="left"><span style="text-decoration: line-through;">'.FormatPlayerName($r_msblue[country], $r_msblue['pid'], $bluepname, $gid, $gamename, true, $r_msblue['rank']).'</span></td>';
+ }
+
+ echo '
+ <td class="'.$class.'" align="center"></td>
+ <td class="'.$class.'" align="center">'.$r_msblue[gamescore].'</td>
+ <td class="'.$class.'" align="center">'.$r_msblue[flag_taken].'</td>
+ <td class="'.$class.'" align="center">'.$r_msblue[flag_pickedup].'</td>
+ <td class="'.$class.'" align="center">'.$r_msblue[flag_dropped].'</td>
+ <td class="'.$class.'" align="center">'.$r_msblue[flag_assist].'</td>
+ <td class="'.$class.'" align="center">'.$r_msblue[flag_cover].'</td>
+ <td class="'.$class.'" align="center">'.$r_msblue[flag_seal].'</td>
+ <td class="'.$class.'" align="center">'.$r_msblue[flag_capture].'</td>
+ <td class="'.$class.'" align="center">'.$r_msblue[flag_kill].'</td>
+ <td class="'.$class.'" align="center">'.$r_msblue[flag_return].'</td>
+ </tr>';
+}
+
+$teamscore = small_query("SELECT t1score AS teamscore FROM uts_match WHERE id = $mid");
+$msbluetot = small_query("SELECT SUM(gamescore) AS gamescore, SUM(flag_taken) AS flag_taken, SUM(flag_pickedup) AS flag_pickedup, SUM(flag_dropped) AS flag_dropped, SUM(flag_assist) AS flag_assist, SUM(flag_cover) AS flag_cover, SUM(flag_seal) AS flag_seal, SUM(flag_capture) AS flag_capture, SUM(flag_kill)as flag_kill, SUM(flag_return) AS flag_return
+FROM uts_player WHERE matchid = $mid AND team = 1 ORDER BY gamescore DESC");
+
+echo'
+ <tr>
+ <td class="dark" align="center">Totals</td>
+ <td class="darkgrey" align="center">'.$teamscore[teamscore].'</td>
+ <td class="darkgrey" align="center">'.$msbluetot[gamescore].'</td>
+ <td class="darkgrey" align="center">'.$msbluetot[flag_taken].'</td>
+ <td class="darkgrey" align="center">'.$msbluetot[flag_pickedup].'</td>
+ <td class="darkgrey" align="center">'.$msbluetot[flag_dropped].'</td>
+ <td class="darkgrey" align="center">'.$msbluetot[flag_assist].'</td>
+ <td class="darkgrey" align="center">'.$msbluetot[flag_cover].'</td>
+ <td class="darkgrey" align="center">'.$msbluetot[flag_seal].'</td>
+ <td class="darkgrey" align="center">'.$msbluetot[flag_capture].'</td>
+ <td class="darkgrey" align="center">'.$msbluetot[flag_kill].'</td>
+ <td class="darkgrey" align="center">'.$msbluetot[flag_return].'</td>
+ </tr>';
+
+// Check If Green Team Were Used (CTF4 Compatibility)
+
+$greencheck = small_count("SELECT * FROM uts_player WHERE matchid = $mid AND team = 2");
+IF ($greencheck > 0) {
+
+ echo'<tr>
+ <td class="hlheading" colspan="12" align="center">Team: Green</td>
+ </tr>
+ <tr>
+ <td class="smheading" rowspan="2" align="center">Player</td>
+ <td class="smheading" colspan="2" align="center" width="90">Score</td>
+ <td class="smheading" rowspan="2" align="center" width="50">Flag Taken</td>
+ <td class="smheading" rowspan="2" align="center" width="50">Flag Pickup</td>
+ <td class="smheading" rowspan="2" align="center" width="50">Flag Drop</td>
+ <td class="smheading" rowspan="2" align="center" width="60">Flag Assist</td>
+ <td class="smheading" rowspan="2" align="center" width="50">Flag Cover</td>
+ <td class="smheading" rowspan="2" align="center" width="50">Flag Seal</td>
+ <td class="smheading" rowspan="2" align="center" width="60">Flag Capture</td>
+ <td class="smheading" rowspan="2" align="center" width="60">Flag Kill</td>
+ <td class="smheading" rowspan="2" align="center" width="50">Flag Return</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center">Team</td>
+ <td class="smheading" align="center">Player</td>
+ </tr>';
+
+ $sql_msgreen = "SELECT p.playerid, pi.name, pi.banned, p.country, p.pid, p.gamescore, p.flag_taken, p.flag_pickedup, p.flag_dropped, p.flag_assist, p.flag_cover, p.flag_seal, p.flag_capture, p.flag_kill, p.flag_return, p.rank
+ FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $mid AND team = 2 ORDER BY gamescore DESC";
+ $q_msgreen = mysql_query($sql_msgreen) or die(mysql_error());
+ $i = 0;
+ while ($r_msgreen = zero_out(mysql_fetch_array($q_msgreen))) {
+ $i++;
+ $class = ($i % 2) ? 'grey' : 'grey2';
+
+ $greenpname = $r_msgreen[name];
+ $myurl = urlencode($r_msgreen[name]);
+
+ echo'<tr>';
+ if ($r_msgreen['banned'] != 'Y') {
+ echo '<td nowrap class="darkhuman" align="left"><a class="darkhuman" href="./?p=matchp&mid='.$mid.'&pid='.$r_msgreen['pid'].'">'.FormatPlayerName($r_msgreen[country], $r_msgreen['pid'], $greenpname, $gid, $gamename, true, $r_msgreen['rank']).'</a></td>';
+ } else {
+ $r_msgreen ['gamescore'] = '-';
+ $r_msgreen ['flag_taken'] = '-';
+ $r_msgreen ['flag_pickedup'] = '-';
+ $r_msgreen ['flag_dropped'] = '-';
+ $r_msgreen ['flag_assist'] = '-';
+ $r_msgreen ['flag_cover'] = '-';
+ $r_msgreen ['flag_seal'] = '-';
+ $r_msgreen ['flag_capture'] = '-';
+ $r_msgreen ['flag_kill'] = '-';
+ $r_msgreen ['flag_return'] = '-';
+ echo '<td nowrap class="darkhuman" align="left"><span style="text-decoration: line-through;">'.FormatPlayerName($r_msgreen[country], $r_msgreen['pid'], $greenpname, $gid, $gamename, true, $r_msgreen['rank']).'</span></td>';
+ }
+
+ echo '
+ <td class="'.$class.'" align="center"></td>
+ <td class="'.$class.'" align="center">'.$r_msgreen[gamescore].'</td>
+ <td class="'.$class.'" align="center">'.$r_msgreen[flag_taken].'</td>
+ <td class="'.$class.'" align="center">'.$r_msgreen[flag_pickedup].'</td>
+ <td class="'.$class.'" align="center">'.$r_msgreen[flag_dropped].'</td>
+ <td class="'.$class.'" align="center">'.$r_msgreen[flag_assist].'</td>
+ <td class="'.$class.'" align="center">'.$r_msgreen[flag_cover].'</td>
+ <td class="'.$class.'" align="center">'.$r_msgreen[flag_seal].'</td>
+ <td class="'.$class.'" align="center">'.$r_msgreen[flag_capture].'</td>
+ <td class="'.$class.'" align="center">'.$r_msgreen[flag_kill].'</td>
+ <td class="'.$class.'" align="center">'.$r_msgreen[flag_return].'</td>
+ </tr>';
+ }
+
+ $teamscore = small_query("SELECT t1score AS teamscore FROM uts_match WHERE id = $mid");
+ $msgreentot = small_query("SELECT SUM(gamescore) AS gamescore, SUM(flag_taken) AS flag_taken, SUM(flag_pickedup) AS flag_pickedup, SUM(flag_dropped) AS flag_dropped, SUM(flag_assist) AS flag_assist, SUM(flag_cover) AS flag_cover, SUM(flag_seal) AS flag_seal, SUM(flag_capture) AS flag_capture, SUM(flag_kill)as flag_kill, SUM(flag_return) AS flag_return
+ FROM uts_player WHERE matchid = $mid AND team = 2 ORDER BY gamescore DESC");
+
+ echo'
+ <tr>
+ <td class="dark" align="center">Totals</td>
+ <td class="darkgrey" align="center">'.$teamscore[teamscore].'</td>
+ <td class="darkgrey" align="center">'.$msgreentot[gamescore].'</td>
+ <td class="darkgrey" align="center">'.$msgreentot[flag_taken].'</td>
+ <td class="darkgrey" align="center">'.$msgreentot[flag_pickedup].'</td>
+ <td class="darkgrey" align="center">'.$msgreentot[flag_dropped].'</td>
+ <td class="darkgrey" align="center">'.$msgreentot[flag_assist].'</td>
+ <td class="darkgrey" align="center">'.$msgreentot[flag_cover].'</td>
+ <td class="darkgrey" align="center">'.$msgreentot[flag_seal].'</td>
+ <td class="darkgrey" align="center">'.$msgreentot[flag_capture].'</td>
+ <td class="darkgrey" align="center">'.$msgreentot[flag_kill].'</td>
+ <td class="darkgrey" align="center">'.$msgreentot[flag_return].'</td>
+ </tr>';
+}
+
+// Check If Gold Team Were Used (CTF4 Compatibility)
+
+$goldcheck = small_count("SELECT * FROM uts_player WHERE matchid = $mid AND team = 3");
+IF ($goldcheck > 0) {
+
+ echo'<tr>
+ <td class="hlheading" colspan="12" align="center">Team: Gold</td>
+ </tr>
+ <tr>
+ <td class="smheading" rowspan="2" align="center">Player</td>
+ <td class="smheading" colspan="2" align="center" width="90">Score</td>
+ <td class="smheading" rowspan="2" align="center" width="50">Flag Taken</td>
+ <td class="smheading" rowspan="2" align="center" width="50">Flag Pickup</td>
+ <td class="smheading" rowspan="2" align="center" width="50">Flag Drop</td>
+ <td class="smheading" rowspan="2" align="center" width="60">Flag Assist</td>
+ <td class="smheading" rowspan="2" align="center" width="50">Flag Cover</td>
+ <td class="smheading" rowspan="2" align="center" width="50">Flag Seal</td>
+ <td class="smheading" rowspan="2" align="center" width="60">Flag Capture</td>
+ <td class="smheading" rowspan="2" align="center" width="60">Flag Kill</td>
+ <td class="smheading" rowspan="2" align="center" width="50">Flag Return</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center">Team</td>
+ <td class="smheading" align="center">Player</td>
+ </tr>';
+
+ $sql_msgold = "SELECT p.playerid, pi.name, pi.banned, p.country, p.pid, p.gamescore, p.flag_taken, p.flag_pickedup, p.flag_dropped, p.flag_assist, p.flag_cover, p.flag_seal, p.flag_capture, p.flag_kill, p.flag_return, p.rank
+ FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $mid AND team = 3 ORDER BY gamescore DESC";
+ $q_msgold = mysql_query($sql_msgold) or die(mysql_error());
+ $i = 0;
+ while ($r_msgold = zero_out(mysql_fetch_array($q_msgold))) {
+ $i++;
+ $class = ($i % 2) ? 'grey' : 'grey2';
+
+ $goldpname = $r_msgold[name];
+ $myurl = urlencode($r_msgold[name]);
+
+ echo'<tr>';
+ if ($r_msgold['banned'] != 'Y') {
+ echo '<td nowrap class="darkhuman" align="left"><a class="darkhuman" href="./?p=matchp&mid='.$mid.'&pid='.$r_msgold['pid'].'">'.FormatPlayerName($r_msgold[country], $r_msgold['pid'], $goldpname, $gid, $gamename, true, $r_msgold['rank']).'</a></td>';
+ } else {
+ $r_msgold ['gamescore'] = '-';
+ $r_msgold ['flag_taken'] = '-';
+ $r_msgold ['flag_pickedup'] = '-';
+ $r_msgold ['flag_dropped'] = '-';
+ $r_msgold ['flag_assist'] = '-';
+ $r_msgold ['flag_cover'] = '-';
+ $r_msgold ['flag_seal'] = '-';
+ $r_msgold ['flag_capture'] = '-';
+ $r_msgold ['flag_kill'] = '-';
+ $r_msgold ['flag_return'] = '-';
+ echo '<td nowrap class="darkhuman" align="left"><span style="text-decoration: line-through;">'.FormatPlayerName($r_msgold[country], $r_msgold['pid'], $goldpname, $gid, $gamename, true, $r_msgold['rank']).'</span></td>';
+ }
+
+ echo '
+ <td class="'.$class.'" align="center"></td>
+ <td class="'.$class.'" align="center">'.$r_msgold[gamescore].'</td>
+ <td class="'.$class.'" align="center">'.$r_msgold[flag_taken].'</td>
+ <td class="'.$class.'" align="center">'.$r_msgold[flag_pickedup].'</td>
+ <td class="'.$class.'" align="center">'.$r_msgold[flag_dropped].'</td>
+ <td class="'.$class.'" align="center">'.$r_msgold[flag_assist].'</td>
+ <td class="'.$class.'" align="center">'.$r_msgold[flag_cover].'</td>
+ <td class="'.$class.'" align="center">'.$r_msgold[flag_seal].'</td>
+ <td class="'.$class.'" align="center">'.$r_msgold[flag_capture].'</td>
+ <td class="'.$class.'" align="center">'.$r_msgold[flag_kill].'</td>
+ <td class="'.$class.'" align="center">'.$r_msgold[flag_return].'</td>
+ </tr>';
+ }
+
+ $teamscore = small_query("SELECT t1score AS teamscore FROM uts_match WHERE id = $mid");
+ $msgoldtot = small_query("SELECT SUM(gamescore) AS gamescore, SUM(flag_taken) AS flag_taken, SUM(flag_pickedup) AS flag_pickedup, SUM(flag_dropped) AS flag_dropped, SUM(flag_assist) AS flag_assist, SUM(flag_cover) AS flag_cover, SUM(flag_seal) AS flag_seal, SUM(flag_capture) AS flag_capture, SUM(flag_kill)as flag_kill, SUM(flag_return) AS flag_return
+ FROM uts_player WHERE matchid = $mid AND team = 3 ORDER BY gamescore DESC");
+
+ echo'
+ <tr>
+ <td class="dark" align="center">Totals</td>
+ <td class="darkgrey" align="center">'.$teamscore[teamscore].'</td>
+ <td class="darkgrey" align="center">'.$msgoldtot[gamescore].'</td>
+ <td class="darkgrey" align="center">'.$msgoldtot[flag_taken].'</td>
+ <td class="darkgrey" align="center">'.$msgoldtot[flag_pickedup].'</td>
+ <td class="darkgrey" align="center">'.$msgoldtot[flag_dropped].'</td>
+ <td class="darkgrey" align="center">'.$msgoldtot[flag_assist].'</td>
+ <td class="darkgrey" align="center">'.$msgoldtot[flag_cover].'</td>
+ <td class="darkgrey" align="center">'.$msgoldtot[flag_seal].'</td>
+ <td class="darkgrey" align="center">'.$msgoldtot[flag_capture].'</td>
+ <td class="darkgrey" align="center">'.$msgoldtot[flag_kill].'</td>
+ <td class="darkgrey" align="center">'.$msgoldtot[flag_return].'</td>
+ </tr>';
+}
+
+echo'</tbody></table>
+<br>';
+
+?>
diff --git a/html/pages/match_info_killsmatrix.php b/html/pages/match_info_killsmatrix.php new file mode 100755 index 0000000..be16905 --- /dev/null +++ b/html/pages/match_info_killsmatrix.php @@ -0,0 +1,131 @@ +<?php
+function PrintVertical($text) {
+ $len = strlen($text);
+ $ret = '';
+ for ($i = 0; $i < $len; $i++) {
+ $ret .= substr($text, $i, 1) .'<br>';
+ }
+ return($ret);
+}
+
+// Retrieve the killmatrix
+$sql_km = " SELECT killer,
+ victim,
+ kills
+ FROM uts_killsmatrix
+ WHERE matchid = $mid;";
+
+$q_km = mysql_query($sql_km) or die(mysql_error());
+while ($r_km = mysql_fetch_array($q_km)) {
+ $km[intval($r_km['killer'])][intval($r_km['victim'])] = $r_km['kills'];
+}
+
+// No matrix: bye
+if (!isset($km)) return;
+
+// Are we processing a teamgame?
+$qm_teamgame = small_query("SELECT teamgame FROM uts_match WHERE id = '$mid';");
+$teamgame = $qm_teamgame['teamgame'];
+$teamgame = ($teamgame == 'False') ? false : true;
+
+// Get the players of this match
+$sql_players = " SELECT p.pid,
+ p.playerid,
+ pi.name,
+ pi.country,
+ pi.banned,
+ p.team,
+ p.suicides
+ FROM uts_player p,
+ uts_pinfo pi
+ WHERE (p.pid = pi.id)
+ AND matchid = '$mid'
+ ORDER BY team ASC,
+ gamescore DESC;";
+$q_players = mysql_query($sql_players) or die(mysql_error());
+while ($r_players = mysql_fetch_array($q_players)) {
+ $players[intval($r_players['playerid'])] = array( 'pid' => $r_players['pid'],
+ 'name' => $r_players['name'],
+ 'country' => $r_players['country'],
+ 'banned' => $r_players['banned'],
+ 'suicides' => intval($r_players['suicides']),
+ 'team' => intval($r_players['team']));
+}
+
+
+// Table header
+$extra = $teamgame ? 3 : 2;
+echo '<table class = "box" border="0" cellpadding="1" cellspacing="2">
+ <tbody><tr>
+ <td class="heading" colspan="'. (count($players) + $extra) .'" align="center">Kills Match Up</td>
+ </tr>
+ <tr>
+ <td class="dark" colspan="'.$extra.'" rowspan="'.$extra.'" align="center"> </td>
+ <td class="dark" colspan="'. count($players).'" align="center"><strong>Victim</strong></td>
+ </tr>
+ <tr>';
+
+// Victims
+foreach($players as $player) {
+
+
+ echo '<td class="darkhuman" align="center" onmouseover="overlib(\''.
+ str_replace('"', '\\\'', QuoteHintText(FormatPlayerName($player['country'], $player['pid'], $player['name'], $gid, $gamename))) .'\');" onmouseout="nd();">
+ <a class="darkhuman" href="?p=matchp&mid='. $mid .'&pid='. urlencode($player['pid']). '">'.
+ PrintVertical($player['name']) .
+ '</a></td>';
+}
+echo '</tr><tr>';
+
+// Team colors victims
+if ($teamgame) {
+ foreach($players as $player) {
+ switch($player['team']) {
+ case 0: $teamcolor = 'redteam'; break;
+ case 1: $teamcolor = 'blueteam'; break;
+ case 2: $teamcolor = 'greenteam'; break;
+ case 3: $teamcolor = 'goldteam'; break;
+ }
+ echo '<td class="'. $teamcolor .'" align="center" width="20">
+ </td>';
+ }
+ echo '</tr>';
+}
+
+// Killer rows
+$first = true;
+$i = 0;
+foreach($players as $kid => $killer) {
+ if ($killer['banned'] == 'Y') continue;
+ $i++;
+ echo '<tr>';
+ if ($first) echo'<td class="dark" rowspan="'. count($players) .'" align="center" width="20"><strong>K<br>i<br>l<br>l<br>e<br>r</strong></td>';
+ echo '<td nowrap class="darkhuman" align="left" style="width: 150px;">';
+ echo '<a class="darkhuman" href="?p=matchp&mid='. $mid .'&pid='. urlencode($killer['pid']). '">'.
+ FormatPlayerName($killer['country'], $killer['pid'], $killer['name'], $gid, $gamename) .' </a></td>';
+ if ($teamgame) {
+ switch($killer['team']) {
+ case 0: $teamcolor = 'redteam'; break;
+ case 1: $teamcolor = 'blueteam'; break;
+ case 2: $teamcolor = 'greenteam'; break;
+ case 3: $teamcolor = 'goldteam'; break;
+ }
+ echo '<td class="'. $teamcolor .'" align="center" width="20"> </td>';
+ }
+ foreach($players as $vid => $victim) {
+ $class = ($kid == $vid) ? 'darkgrey' : 'grey';
+ //if ($i % 2) $class .= '2';
+ echo '<td class="'. $class .'" align="center" width="20">';
+ if ($kid == $vid) {
+ $val = ($killer['suicides'] != 0) ? $killer['suicides'] : ' ';
+ } else {
+ $val = (isset($km[$kid][$vid])) ? $km[$kid][$vid] : ' ';
+ }
+ echo $val .'</td>';
+ }
+
+ $first = false;
+}
+
+echo '</tbody></table><br>';
+?>
\ No newline at end of file diff --git a/html/pages/match_info_lms.php b/html/pages/match_info_lms.php new file mode 100755 index 0000000..1c6aa05 --- /dev/null +++ b/html/pages/match_info_lms.php @@ -0,0 +1,144 @@ +<?php
+
+ global $gamename, $gid;
+ $r_info = small_query("SELECT teamgame, t0score, t1score, t2score, t3score FROM uts_match WHERE id = '$mid'");
+ if (!$r_info) die("Match not found");
+ $teams = ($r_info['teamgame'] == 'True') ? true : false;
+ $teamscore[-1] = 0;
+ $teamscore[0] = $r_info['t0score'];
+ $teamscore[1] = $r_info['t1score'];
+ $teamscore[2] = $r_info['t2score'];
+ $teamscore[3] = $r_info['t3score'];
+
+
+ $cols = 11;
+ $oldteam = -1;
+
+
+ echo'
+ <table class = "box" border="0" cellpadding="0" cellspacing="2" width="600">
+ <tbody><tr>
+ <td class="heading" colspan="'.$cols.'" align="center">Player Summary</td>
+ </tr>';
+
+
+ $sql_players = "SELECT pi.name, pi.banned, p.playerid, p.pid, p.team, p.country, p.gametime, p.gamescore, p.frags, p.deaths, p.suicides, p.teamkills, p.eff, p.accuracy, p.ttl, p.rank, MAX(e.col2)
+ FROM uts_pinfo AS pi, uts_player AS p
+ LEFT JOIN uts_events AS e
+ ON p.playerid = e.playerid AND p.matchid = e.matchid AND e.col1 = 'out' AND p.gamescore = 0
+ WHERE p.pid = pi.id AND p.matchid = $mid
+ GROUP BY p.playerid
+ ORDER BY p.gamescore DESC, (0+e.col2) DESC";
+
+ $q_players = mysql_query($sql_players) or die(mysql_error());
+ $header = true;
+
+ $totals['gamescore'] = 0;
+ if ($extra) $totals[$extra] = 0;
+ $totals['frags'] = 0;
+ $totals['kills'] = 0;
+ $totals['deaths'] = 0;
+ $totals['suicides'] = 0;
+ $totals['teamkills'] = 0;
+ $totals['eff'] = 0;
+ $totals['acc'] = 0;
+ $totals['ttl'] = 0;
+ $num = 0;
+
+ while ($r_players = zero_out(mysql_fetch_array($q_players))) {
+ if ($header) {
+ $header = false;
+ echo '
+ <tr>
+ <td class="smheading" align="center">Player</td>
+ <td class="smheading" align="center" width="50">Time</td>
+ <td class="smheading" align="center" width="50">Score</td>
+ <td class="smheading" align="center" width="50">Out</td>
+ <td class="smheading" align="center" width="40" '.OverlibPrintHint('F').'>F</td>
+ <td class="smheading" align="center" width="40" '.OverlibPrintHint('K').'>K</td>
+ <td class="smheading" align="center" width="40" '.OverlibPrintHint('D').'>D</td>
+ <td class="smheading" align="center" width="40" '.OverlibPrintHint('S').'>S</td>';
+ if ($teams) echo '<td class="smheading" align="center" width="40" '.OverlibPrintHint('TK').'>TK</td>';
+ echo '
+ <td class="smheading" align="center" width="55" '.OverlibPrintHint('EFF').'>Eff.</td>
+ <td class="smheading" align="center" width="55" '.OverlibPrintHint('ACC').'>Acc.</td>
+ <td class="smheading" align="center" width="50" '.OverlibPrintHint('TTL').'>Avg TTL</td>
+ </tr>';
+ }
+
+ $eff = get_dp($r_players['eff']);
+ $acc = get_dp($r_players['accuracy']);
+ $ttl = GetMinutes($r_players['ttl']);
+ $kills = $r_players['frags'] + $r_players['suicides'];
+ $pname = $r_players['name'];
+
+ $totals['gamescore'] += $r_players['gamescore'];
+ if ($extra) $totals[$extra] += $r_players[$extra];
+ $totals['frags'] += $r_players['frags'];
+ $totals['kills'] += $kills;
+ $totals['deaths'] += $r_players['deaths'];
+ $totals['suicides'] += $r_players['suicides'];
+ $totals['teamkills'] += $r_players['teamkills'];
+ $totals['eff'] += $r_players['eff'];
+ $totals['acc'] += $r_players['accuracy'];
+ $totals['ttl'] += $r_players['ttl'];
+ $num++;
+
+ if ($r_players['banned'] == 'Y') {
+ $eff = '-';
+ $acc = '-';
+ $ttl = '-';
+ $kills = '-';
+ $r_players['gamescore'] = '-';
+ $r_players[$extra] = '-';
+ $r_players['frags'] = '-';
+ $r_players['deaths'] = '-';
+ $r_players['suicides'] = '-';
+ $r_players['teamkills'] = '-';
+ }
+
+
+ $class = ($num % 2) ? 'grey' : 'grey2';
+ echo '<tr>';
+ if ($r_players['banned'] != 'Y') {
+ echo '<td nowrap class="darkhuman" align="left"><a class="darkhuman" href="./?p=matchp&mid='.$mid.'&pid='.$r_players['pid'].'">'.FormatPlayerName($r_players['country'], $r_players['pid'], $r_players['name'], $gid, $gamename, true, $r_players['rank']).'</a></td>';
+ } else {
+ echo '<td nowrap class="darkhuman" align="left"><span style="text-decoration: line-through;">'.FormatPlayerName($r_players['country'], $r_players['pid'], $r_players['name'], $gid, $gamename, true, $r_players['rank']).'</span></td>';
+ }
+ echo '<td class="'.$class.'" align="center">'.GetMinutes($r_players[gametime]).'</td>';
+ echo '<td class="'.$class.'" align="center">'.$r_players[gamescore].'</td>';
+ echo '<td class="'.$class.'" align="center">'.(empty($r_players['MAX(e.col2)']) ? '' : GetMinutes($r_players['MAX(e.col2)'])).'</td>';
+
+ echo '<td class="'.$class.'" align="center">'.$r_players[frags].'</td>';
+ echo '<td class="'.$class.'" align="center">'.$kills.'</td>';
+ echo '<td class="'.$class.'" align="center">'.$r_players[deaths].'</td>';
+ echo '<td class="'.$class.'" align="center">'.$r_players[suicides].'</td>';
+
+ echo '<td class="'.$class.'" align="center">'.$eff.'</td>';
+ echo '<td class="'.$class.'" align="center">'.$acc.'</td>';
+ echo '<td class="'.$class.'" align="center">'.$ttl.'</td>';
+ echo '</tr>';
+ }
+ if ($num == 0) $num = 1;
+ $eff = get_dp($totals['eff'] / $num);
+ $acc = get_dp($totals['acc'] / $num);
+ $ttl = GetMinutes($totals['ttl'] / $num);
+
+
+ echo '<tr>';
+ echo '<td nowrap class="dark" align="center">Totals</td>';
+ echo '<td class="darkgrey" align="center"></td>';
+ echo '<td class="darkgrey" align="center">'.$totals[gamescore].'</td>';
+ echo '<td class="darkgrey" align="center"></td>';
+ echo '<td class="darkgrey" align="center">'.$totals[frags].'</td>';
+ echo '<td class="darkgrey" align="center">'.$totals[kills].'</td>';
+ echo '<td class="darkgrey" align="center">'.$totals[deaths].'</td>';
+ echo '<td class="darkgrey" align="center">'.$totals[suicides].'</td>';
+
+ if ($teams) echo '<td class="darkgrey" align="center">'.$totals[teamkills].'</td>';
+
+ echo '<td class="darkgrey" align="center">'.$eff.'</td>';
+ echo '<td class="darkgrey" align="center">'.$acc.'</td>';
+ echo '<td class="darkgrey" align="center">'.$ttl.'</td>';
+ echo '</tr>';
+ echo '</tbody></table><br>';
diff --git a/html/pages/match_info_other.php b/html/pages/match_info_other.php new file mode 100755 index 0000000..d0a3527 --- /dev/null +++ b/html/pages/match_info_other.php @@ -0,0 +1,115 @@ +<?php
+include('pages/match_info_killsmatrix.php');
+
+include('includes/weaponstats.php');
+weaponstats($mid, NULL);
+
+echo'<br>
+<table class = "box" border="0" cellpadding="0" cellspacing="2" width="600">
+ <tbody><tr>
+ <td class="heading" colspan="11" align="center">Special Events</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center" rowspan="2" width="">Player</td>
+ <td class="smheading" align="center" rowspan="2" width="60">First Blood</td>
+ <td class="smheading" align="center" colspan="4" width="160" '.OverlibPrintHint('Multis').'>Multis</td>
+ <td class="smheading" align="center" colspan="5" width="200" '.OverlibPrintHint('Sprees').'>Sprees</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center" width="40" '.OverlibPrintHint('DK').'>Dbl</td>
+ <td class="smheading" align="center" width="40" '.OverlibPrintHint('MK').'>Multi</td>
+ <td class="smheading" align="center" width="40" '.OverlibPrintHint('UK').'>Ultra</td>
+ <td class="smheading" align="center" width="40" '.OverlibPrintHint('MOK').'>Mons</td>
+ <td class="smheading" align="center" width="40" '.OverlibPrintHint('KS').'>Kill</td>
+ <td class="smheading" align="center" width="40" '.OverlibPrintHint('RA').'>Ram</td>
+ <td class="smheading" align="center" width="40" '.OverlibPrintHint('DO').'>Dom</td>
+ <td class="smheading" align="center" width="40" '.OverlibPrintHint('US').'>Uns</td>
+ <td class="smheading" align="center" width="40" '.OverlibPrintHint('GL').'>God</td>
+ </tr>';
+$sql_firstblood = small_query("SELECT firstblood FROM uts_match WHERE id = $mid");
+$sql_multis = "SELECT p.pid, pi.name, p.country, SUM(spree_double) AS spree_double, SUM(spree_multi) AS spree_multi,
+SUM(spree_ultra) AS spree_ultra, SUM(spree_monster) AS spree_monster,
+SUM(spree_kill) AS spree_kill, SUM(spree_rampage) AS spree_rampage, SUM(spree_dom) AS spree_dom,
+SUM(spree_uns) AS spree_uns, SUM(spree_god) AS spree_god
+FROM uts_player as p, uts_pinfo AS pi WHERE p.pid = pi.id AND pi.banned <> 'Y' AND matchid = $mid GROUP BY pid ORDER BY name ASC";
+$q_multis = mysql_query($sql_multis) or die(mysql_error());
+$i = 0;
+while ($r_multis = zero_out(mysql_fetch_array($q_multis))) {
+ $i++;
+ $class = ($i % 2) ? 'grey' : 'grey2';
+ $r_pname = $r_multis[name];
+ $myurl = urlencode($r_pname);
+
+ echo'
+ <tr>
+ <td nowrap class="darkhuman" align="left"><a class="darkhuman" href="./?p=matchp&mid='.$mid.'&pid='.$r_multis['pid'].'">'.FormatPlayerName($r_multis[country], $r_multis[pid], $r_pname, $gid, $gamename).'</a></td>
+ <td class="'.$class.'" align="center">', ($sql_firstblood['firstblood'] == $r_multis['pid'] ? "Yes": ""), '</td>
+ <td class="'.$class.'" align="center">'.$r_multis[spree_double].'</td>
+ <td class="'.$class.'" align="center">'.$r_multis[spree_multi].'</td>
+ <td class="'.$class.'" align="center">'.$r_multis[spree_ultra].'</td>
+ <td class="'.$class.'" align="center">'.$r_multis[spree_monster].'</td>
+ <td class="'.$class.'" align="center">'.$r_multis[spree_kill].'</td>
+ <td class="'.$class.'" align="center">'.$r_multis[spree_rampage].'</td>
+ <td class="'.$class.'" align="center">'.$r_multis[spree_dom].'</td>
+ <td class="'.$class.'" align="center">'.$r_multis[spree_uns].'</td>
+ <td class="'.$class.'" align="center">'.$r_multis[spree_god].'</td>
+ </tr>';
+}
+
+// No items in insta matches or lms
+if ((strpos($gamename, '(insta)') === false) && (strpos($gamename, "Last Man Standing") === false)) {
+ echo'</tbody></table><br>
+ <table class = "box" border="0" cellpadding="0" cellspacing="2" width="600">
+ <tbody><tr>
+ <td class="heading" colspan="7" align="center">Pickups Summary</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center">Player</td>
+ <td class="smheading" align="center" width="71">Pads</td>
+ <td class="smheading" align="center" width="71">Armour</td>
+ <td class="smheading" align="center" width="71">Keg</td>
+ <td class="smheading" align="center" width="71">Invisibility</td>
+ <td class="smheading" align="center" width="71">Shield<br>Belt</td>
+ <td class="smheading" align="center" width="71">Damage Amp</td>
+ </tr>';
+
+ $sql_pickups = "SELECT p.pid, pi.name, p.country, SUM(p.pu_pads) AS pu_pads, SUM(p.pu_armour) AS pu_armour, SUM(p.pu_keg) AS pu_keg,
+ SUM(p.pu_invis) AS pu_invis, SUM(p.pu_belt) AS pu_belt, SUM(p.pu_amp) AS pu_amp
+ FROM uts_player as p, uts_pinfo AS pi WHERE p.pid = pi.id AND pi.banned <> 'Y' AND matchid = $mid GROUP BY pid ORDER BY name ASC";
+ $q_pickups = mysql_query($sql_pickups) or die(mysql_error());
+ $i = 0;
+ while ($r_pickups = zero_out(mysql_fetch_array($q_pickups))) {
+ $i++;
+ $class = ($i % 2) ? 'grey' : 'grey2';
+ $r_pname = $r_pickups[name];
+ $myurl = urlencode($r_pname);
+
+ echo'
+ <tr>
+ <td nowrap class="darkhuman" align="left"><a class="darkhuman" href="./?p=matchp&mid='.$mid.'&pid='.$r_pickups['pid'].'">'.FormatPlayerName($r_pickups[country], $r_pickups[pid], $r_pname, $gid, $gamename).'</a></td>
+ <td class="'.$class.'" align="center">'.$r_pickups[pu_pads].'</td>
+ <td class="'.$class.'" align="center">'.$r_pickups[pu_armour].'</td>
+ <td class="'.$class.'" align="center">'.$r_pickups[pu_keg].'</td>
+ <td class="'.$class.'" align="center">'.$r_pickups[pu_invis].'</td>
+ <td class="'.$class.'" align="center">'.$r_pickups[pu_belt].'</td>
+ <td class="'.$class.'" align="center">'.$r_pickups[pu_amp].'</td>
+ </tr>';
+ }
+}
+echo'</tbody></table>';
+
+/* $sql_firstblood = small_query("SELECT pi.name, pi.country, m.firstblood FROM uts_match AS m, uts_pinfo AS pi WHERE m.firstblood = pi.id AND m.id = $mid");
+if (!$sql_firstblood) $sql_firstblood = array('country' => '', 'name' => '(unknown)', 'firstblood' => NULL);
+
+echo'
+<br>
+<table border="0" cellpadding="1" cellspacing="2" width="200">
+ <tbody>
+ <tr>
+ <td class="heading" colspan="2" align="center">First Blood</td>
+ </tr>
+ <tr>
+ <td class="grey2" align="center" width="150">'.FormatPlayerName($sql_firstblood[country], $sql_firstblood[firstblood], $sql_firstblood[name], $gid, $gamename).'</td>
+ </tr>
+</tbody></table>'; */
+?>
diff --git a/html/pages/match_info_other2.php b/html/pages/match_info_other2.php new file mode 100755 index 0000000..1f72fdd --- /dev/null +++ b/html/pages/match_info_other2.php @@ -0,0 +1,143 @@ +<?php
+//include('pages/match_info_killsmatrix.php');
+
+include('includes/weaponstats.php');
+weaponstats($mid, 0, 'Weapons Summary - '.$ass_att.' Attacking');
+
+IF($mid2 != NULL) {
+ echo '<br>';
+ weaponstats($mid2, 0, 'Weapons Summary - '.$ass_att2.' Attacking');
+}
+
+echo'
+<br>
+<table class = "box" border="0" cellpadding="0" cellspacing="2" width="720">
+ <tbody><tr>
+ <td class="heading" colspan="7" align="center">Pickups Summary - '.$ass_att.' Attacking</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center">Player</td>
+ <td class="smheading" align="center" width="80">Pads</td>
+ <td class="smheading" align="center" width="80">Armour</td>
+ <td class="smheading" align="center" width="80">Keg</td>
+ <td class="smheading" align="center" width="80">Invisibility</td>
+ <td class="smheading" align="center" width="80">Shield Belt</td>
+ <td class="smheading" align="center" width="80">Damage Amp</td>
+ </tr>';
+
+$sql_pickups = "SELECT p.pid, pi.name, p.country, SUM(p.pu_pads) AS pu_pads, SUM(p.pu_armour) AS pu_armour, SUM(p.pu_keg) AS pu_keg,
+SUM(p.pu_invis) AS pu_invis, SUM(p.pu_belt) AS pu_belt, SUM(p.pu_amp) AS pu_amp
+FROM uts_player as p, uts_pinfo AS pi WHERE p.pid = pi.id AND pi.banned <> 'Y' AND matchid = $mid GROUP BY pid ORDER BY name ASC";
+$q_pickups = mysql_query($sql_pickups) or die(mysql_error());
+$i = 0;
+while ($r_pickups = zero_out(mysql_fetch_array($q_pickups))) {
+ $i++;
+ $class = ($i % 2) ? 'grey' : 'grey2';
+
+ $r_pname = $r_pickups[name];
+ $myurl = urlencode($r_pname);
+
+ echo'
+ <tr>
+ <td nowrap class="darkhuman" align="left"><a class="darkhuman" href="./?p=matchp&mid='.$mid.'&pid='.$r_pickups[pid].'">'.FormatPlayerName($r_pickups[country], $r_pickups[pid], $r_pname, $gid, $gamename).'</a></td>
+ <td class="'.$class.'" align="center">'.$r_pickups[pu_pads].'</td>
+ <td class="'.$class.'" align="center">'.$r_pickups[pu_armour].'</td>
+ <td class="'.$class.'" align="center">'.$r_pickups[pu_keg].'</td>
+ <td class="'.$class.'" align="center">'.$r_pickups[pu_invis].'</td>
+ <td class="'.$class.'" align="center">'.$r_pickups[pu_belt].'</td>
+ <td class="'.$class.'" align="center">'.$r_pickups[pu_amp].'</td>
+ </tr>';
+}
+
+IF($mid2 == NULL) {
+} else {
+ echo'</tbody></table>
+ <br>
+ <table class = "box" border="0" cellpadding="0" cellspacing="2" width="720">
+ <tbody><tr>
+ <td class="heading" colspan="7" align="center">Pickups Summary - '.$ass_att2.' Attacking</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center">Player</td>
+ <td class="smheading" align="center" width="80">Pads</td>
+ <td class="smheading" align="center" width="80">Armour</td>
+ <td class="smheading" align="center" width="80">Keg</td>
+ <td class="smheading" align="center" width="80">Invisibility</td>
+ <td class="smheading" align="center" width="80">Shield Belt</td>
+ <td class="smheading" align="center" width="80">Damage Amp</td>
+ </tr>';
+
+ $sql_pickups = "SELECT p.pid, pi.name, p.country, SUM(p.pu_pads) AS pu_pads, SUM(p.pu_armour) AS pu_armour, SUM(p.pu_keg) AS pu_keg,
+ SUM(p.pu_invis) AS pu_invis, SUM(p.pu_belt) AS pu_belt, SUM(p.pu_amp) AS pu_amp
+ FROM uts_player as p, uts_pinfo AS pi WHERE p.pid = pi.id AND pi.banned <> 'Y' AND matchid = $mid2 GROUP BY pid ORDER BY name ASC";
+ $q_pickups = mysql_query($sql_pickups) or die(mysql_error());
+ $i = 0;
+ while ($r_pickups = zero_out(mysql_fetch_array($q_pickups))) {
+ $i++;
+ $class = ($i % 2) ? 'grey' : 'grey2';
+
+ $r_pname = $r_pickups[name];
+ $myurl = urlencode($r_pname);
+
+ echo'
+ <tr>
+ <td nowrap class="darkhuman" align="left"><a class="darkhuman" href="./?p=matchp&mid='.$mid.'&pid='.$r_pickups[pid].'">'.FormatPlayerName($r_pickups[country], $r_pickups[pid], $r_pname, $gid, $gamename).'</a></td>
+ <td class="'.$class.'" align="center">'.$r_pickups[pu_pads].'</td>
+ <td class="'.$class.'" align="center">'.$r_pickups[pu_armour].'</td>
+ <td class="'.$class.'" align="center">'.$r_pickups[pu_keg].'</td>
+ <td class="'.$class.'" align="center">'.$r_pickups[pu_invis].'</td>
+ <td class="'.$class.'" align="center">'.$r_pickups[pu_belt].'</td>
+ <td class="'.$class.'" align="center">'.$r_pickups[pu_amp].'</td>
+ </tr>';
+ }
+}
+
+$sql_firstblood = small_query("SELECT pi.name, pi.country, m.firstblood FROM uts_match AS m, uts_pinfo AS pi WHERE m.firstblood = pi.id AND m.id = $mid");
+if (!$sql_firstblood) $sql_firstblood = array('country' => '', 'name' => '(unknown)', 'firstblood' => NULL);
+$sql_multis = small_query("SELECT SUM(spree_double) AS spree_double, SUM(spree_multi) AS spree_multi, SUM(spree_ultra) AS spree_ultra, SUM(spree_monster) AS spree_monster FROM uts_player WHERE matchid = $mid");
+
+IF($mid2 == NULL) {
+} else {
+$sql_firstblood2 = small_query("SELECT pi.name, pi.country, m.firstblood FROM uts_match AS m, uts_pinfo AS pi WHERE m.firstblood = pi.id AND m.id = $mid2");
+if (!$sql_firstblood2) $sql_firstblood2 = array('country' => '', 'name' => '(unknown)', 'firstblood' => NULL);
+$sql_multis2 = small_query("SELECT SUM(spree_double) AS spree_double, SUM(spree_multi) AS spree_multi, SUM(spree_ultra) AS spree_ultra, SUM(spree_monster) AS spree_monster FROM uts_player WHERE matchid = $mid2");
+}
+echo'</tbody></table>
+<br>
+<table class = "box" border="0" cellpadding="1" cellspacing="2" width="720">
+ <tbody><tr>
+ <td class="heading" colspan="2" align="center">Special Events - '.$ass_att.' Attacking</td>
+ <td class="heading" colspan="2" align="center">Special Events - '.$ass_att2.' Attacking</td>
+ </tr>
+ <tr>
+ <td class="dark" align="center" width="150">First Blood</td>
+ <td class="grey" align="center" width="150">'.FormatPlayerName($sql_firstblood[country], $sql_firstblood[firstblood], $sql_firstblood[name], $gid, $gamename).'</td>
+ <td class="dark" align="center" width="150">First Blood</td>
+ <td class="grey" align="center" width="150">'.FormatPlayerName($sql_firstblood2[country], $sql_firstblood[firstblood], $sql_firstblood2[name], $gid, $gamename).'</td>
+ </tr>
+ <tr>
+ <td class="dark" align="center">Double Kills</td>
+ <td class="grey2" align="center">'.$sql_multis[spree_double].'</td>
+ <td class="dark" align="center">Double Kills</td>
+ <td class="grey2" align="center">'.$sql_multis2[spree_double].'</td>
+ </tr>
+ <tr>
+ <td class="dark" align="center">Multi Kills</td>
+ <td class="grey" align="center">'.$sql_multis[spree_multi].'</td>
+ <td class="dark" align="center">Multi Kills</td>
+ <td class="grey" align="center">'.$sql_multis2[spree_multi].'</td>
+ </tr>
+ <tr>
+ <td class="dark" align="center">Ultra Kills</td>
+ <td class="grey2" align="center">'.$sql_multis[spree_ultra].'</td>
+ <td class="dark" align="center">Ultra Kills</td>
+ <td class="grey2" align="center">'.$sql_multis2[spree_ultra].'</td>
+ </tr>
+ <tr>
+ <td class="dark" align="center">Monster Kills</td>
+ <td class="grey" align="center">'.$sql_multis[spree_monster].'</td>
+ <td class="dark" align="center">Monster Kills</td>
+ <td class="grey" align="center">'.$sql_multis2[spree_monster].'</td>
+ </tr>
+</tbody></table>';
+?>
diff --git a/html/pages/match_info_server.php b/html/pages/match_info_server.php new file mode 100755 index 0000000..fb92456 --- /dev/null +++ b/html/pages/match_info_server.php @@ -0,0 +1,114 @@ +<?php
+echo'
+<table class="box" border="0" cellpadding="1" cellspacing="2">
+ <tbody><tr>
+ <td class="heading" colspan="6" align="center">Totals for This Match</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center" width="45">Team Score</td>
+ <td class="smheading" align="center" width="50">Player Score</td>
+ <td class="smheading" align="center" width="45">Frags</td>
+ <td class="smheading" align="center" width="45">Kills</td>
+ <td class="smheading" align="center" width="50">Deaths</td>
+ <td class="smheading" align="center" width="60">Suicides</td>
+ </tr>';
+
+// Get Summary Info
+$teamscore = small_query("SELECT SUM(t0score + t1score + t2score + t3score) AS result FROM uts_match WHERE id = $mid");
+$playerscore = small_query("SELECT SUM(gamescore) AS result FROM uts_player WHERE matchid = $mid");
+$fragcount = small_query("SELECT SUM(frags) AS result FROM uts_match WHERE id = $mid");
+$killcount = small_query("SELECT SUM(kills) AS result FROM uts_match WHERE id = $mid");
+$deathcount = small_query("SELECT SUM(deaths) AS result FROM uts_match WHERE id = $mid");
+$suicidecount = small_query("SELECT SUM(suicides) AS result FROM uts_match WHERE id = $mid");
+
+echo'
+ <tr>
+ <td class="smheading" align="center" width="45">'.$teamscore[result].'</td>
+ <td class="smheading" align="center" width="50">'.$playerscore[result].'</td>
+ <td class="smheading" align="center" width="45">'.$fragcount[result].'</td>
+ <td class="smheading" align="center" width="45">'.$killcount[result].'</td>
+ <td class="smheading" align="center" width="50">'.$deathcount[result].'</td>
+ <td class="smheading" align="center" width="60">'.$suicidecount[result].'</td>
+ </tr>';
+
+// Teamgame? Then show score
+if ($teamgame) {
+ echo '
+ <tr>
+ <td class="heading" align="center" valign="middle" colspan="6">';
+ echo '
+ Score:';
+ if ($r_info[t0]) {
+ echo '
+ '.$r_info[t0score];
+ }
+ if ($r_info[t1]) {
+ echo '
+ - '.$r_info[t1score];
+ }
+ if ($r_info[t2]) {
+ echo '
+ - '.$r_info[t2score];
+ }
+ if ($r_info[t3]) {
+ echo '
+ - '.$r_info[t3score];
+ }
+ echo '
+ </td>
+ </tr>';
+}
+
+echo '
+</tbody></table>
+<br>
+<table class = "box" border="0" cellpadding="1" cellspacing="2" width="720">
+ <tbody><tr>
+ <td class="heading" colspan="4" align="center">Unreal Tournament Match Stats</td>
+ </tr>';
+
+$matchinfo = small_query("SELECT m.time, m.servername, g.name AS gamename, m.gamename AS real_gamename, m.gid, m.mapname, m.mapfile, m.serverinfo, m.gameinfo, m.mutators, m.serverip FROM uts_match AS m, uts_games AS g WHERE m.gid = g.id AND m.id = $mid");
+$matchdate = mdate($matchinfo[time]);
+$gamename = $matchinfo[gamename];
+$real_gamename = $matchinfo[real_gamename];
+$gid = $matchinfo[gid];
+
+$mapname = un_ut($matchinfo[mapfile]);
+$mappic = strtolower("images/maps/".$mapname.".jpg");
+
+if (file_exists($mappic)) {
+} else {
+ $mappic = ("images/maps/blank.jpg");
+}
+
+ $myurl = urlencode($mapname);
+
+ echo'
+ <tr>
+ <td class="dark" align="center" width="110">Match Date</td>
+ <td class="grey" align="center">'.$matchdate.'</td>
+ <td class="dark" align="center" width="110">Server</td>
+ <td class="grey" align="center" width="146"><a class="grey" href="./?p=sinfo&serverip='.$matchinfo[serverip].'">'.$matchinfo[servername].'</a></td>
+ </tr>
+ <tr>
+ <td class="dark" align="center">Match Type</td>
+ <td class="grey" align="center">'.$gamename.'</td>
+ <td class="dark" align="center">Map Name</td>
+ <td class="greyhuman" align="center"><a class="grey" href="./?p=minfo&map='.$myurl.'">'.$matchinfo[mapname].'</a></td>
+ </tr>
+ <tr>
+ <td class="dark" align="center">Server Info</td>
+ <td class="grey" align="center">'.$matchinfo[serverinfo].'</td>
+ <td class="dark" align="center" rowspan="4" colspan="2"><img border="0" alt="'.$mapname.'" title="'.$mapname.'" src="'.$mappic.'"></td>
+ </tr>
+ <tr>
+ <td class="dark" align="center">Game Info</td>
+ <td class="grey" align="center">'.$matchinfo[gameinfo].'</td>
+ </tr>
+ <tr>
+ <td class="dark" align="center">Mutators</td>
+ <td class="grey" align="center">'.$matchinfo[mutators].'</td>
+ </tr>
+</tbody></table>
+<br>';
+?>
diff --git a/html/pages/match_player.php b/html/pages/match_player.php new file mode 100755 index 0000000..4cc73a0 --- /dev/null +++ b/html/pages/match_player.php @@ -0,0 +1,151 @@ +<?php
+$mid = preg_replace('/\D/', '', $_GET[mid]);
+$pid = preg_replace('/\D/', '', $_GET[pid]);
+
+$r_infos = small_query("SELECT p.playerid, p.country, pi.name, pi.banned, p.gid, g.name AS gamename FROM uts_player p, uts_pinfo pi, uts_games g WHERE p.gid = g.id AND p.pid = pi.id AND p.pid = '$pid' AND matchid = '$mid' LIMIT 0,1;");
+
+if (!$r_infos) {
+ echo "Unable to retrieve data!";
+ include("includes/footer.php");
+ exit;
+}
+if ($r_infos['banned'] == 'Y') {
+ if (isset($is_admin) and $is_admin) {
+ echo "Warning: Banned player - Admin override<br>";
+ } else {
+ echo "Sorry, this player has been banned!";
+ include("includes/footer.php");
+ exit;
+ }
+}
+
+$playerid = $r_infos['playerid'];
+$playername = $r_infos['name'];
+$country = $r_infos['country'];
+$gamename = $r_infos['gamename'];
+$gid = $r_infos['gid'];
+
+echo'
+<table class = "box" border="0" cellpadding="1" cellspacing="2" width="720">
+ <tbody><tr>
+ <td class="heading" align="center">Individual Match Stats for <a href="./?p=pinfo&pid='.$pid.'">'.FlagImage($country) .' '. htmlentities($playername) .'</a>
+ <span style="font-size: 70%">'. RankImageOrText($pid, $playername, NULL, $gid, $gamename, true, '(%IT% in %GN% with %RP% ranking points)') .'</span>
+ </td>
+ </tr>
+</tbody></table>
+<br>';
+
+// Get Summary Info
+include("pages/match_info_server.php");
+
+echo '
+<br>
+<table class = "box" border="0" cellpadding="0" cellspacing="2" width="400">
+ <tbody><tr>
+ <td class="heading" colspan="8" align="center">Game Summary</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center" width="40">Frags</td>
+ <td class="smheading" align="center" width="40">Kills</td>
+ <td class="smheading" align="center" width="50">Deaths</td>
+ <td class="smheading" align="center" width="60">Suicides</td>
+ <td class="smheading" align="center" width="70">Efficiency</td>
+ <td class="smheading" align="center" width="50">Accuracy</td>
+ <td class="smheading" align="center" width="50">Avg TTL</td>
+ <td class="smheading" align="center" width="50">Time</td>
+ </tr>';
+
+$r_gsumm = zero_out(small_query("SELECT gamescore, frags, SUM(frags+suicides) AS kills, deaths, suicides, teamkills, eff, accuracy, ttl, gametime, spree_kill, spree_rampage, spree_dom, spree_uns, spree_god
+FROM uts_player WHERE matchid = $mid AND pid = '$pid'
+GROUP BY pid"));
+
+ echo'
+ <tr>
+ <td class="grey" align="center">'.$r_gsumm[frags].'</td>
+ <td class="grey" align="center">'.$r_gsumm[kills].'</td>
+ <td class="grey" align="center">'.$r_gsumm[deaths].'</td>
+ <td class="grey" align="center">'.$r_gsumm[suicides].'</td>
+ <td class="grey" align="center">'.$r_gsumm[eff].'</td>
+ <td class="grey" align="center">'.$r_gsumm[accuracy].'</td>
+ <td class="grey" align="center">'.$r_gsumm[ttl].'</td>
+ <td class="grey" align="center">'.GetMinutes($r_gsumm[gametime]).'</td>
+ </tr>';
+
+echo'
+</tbody></table>
+<br>
+<table class = "box" border="0" cellpadding="0" cellspacing="2" width="400">
+ <tbody><tr>
+ <td class="heading" colspan="10" align="center">Special Events</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center" rowspan="2" width="40">First Blood</td>
+ <td class="smheading" align="center" colspan="4" width="160" '.OverlibPrintHint('Multis').'>Multis</td>
+ <td class="smheading" align="center" colspan="5" width="200" '.OverlibPrintHint('Sprees').'>Sprees</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center" width="40" '.OverlibPrintHint('DK').'>Dbl</td>
+ <td class="smheading" align="center" width="40" '.OverlibPrintHint('MK').'>Multi</td>
+ <td class="smheading" align="center" width="40" '.OverlibPrintHint('UK').'>Ultra</td>
+ <td class="smheading" align="center" width="40" '.OverlibPrintHint('MOK').'>Mons</td>
+ <td class="smheading" align="center" width="40" '.OverlibPrintHint('KS').'>Kill</td>
+ <td class="smheading" align="center" width="40" '.OverlibPrintHint('RA').'>Ram</td>
+ <td class="smheading" align="center" width="40" '.OverlibPrintHint('DO').'>Dom</td>
+ <td class="smheading" align="center" width="40" '.OverlibPrintHint('US').'>Uns</td>
+ <td class="smheading" align="center" width="40" '.OverlibPrintHint('GL').'>God</td>
+ </tr>';
+
+$r_gsumm = zero_out(small_query("SELECT spree_double, spree_multi, spree_ultra, spree_monster, spree_kill, spree_rampage, spree_dom, spree_uns, spree_god
+FROM uts_player WHERE matchid = $mid AND pid = '$pid'
+GROUP BY pid"));
+
+$sql_firstblood = small_query("SELECT firstblood FROM uts_match WHERE id = $mid");
+
+IF ($sql_firstblood[firstblood] == $pid) {
+ $firstblood = "Yes";
+} else {
+ $firstblood = "No";
+}
+
+
+ echo'
+ <tr>
+ <td class="grey" align="center">'.$firstblood.'</td>
+ <td class="grey" align="center">'.$r_gsumm[spree_double].'</td>
+ <td class="grey" align="center">'.$r_gsumm[spree_multi].'</td>
+ <td class="grey" align="center">'.$r_gsumm[spree_ultra].'</td>
+ <td class="grey" align="center">'.$r_gsumm[spree_monster].'</td>
+ <td class="grey" align="center">'.$r_gsumm[spree_kill].'</td>
+ <td class="grey" align="center">'.$r_gsumm[spree_rampage].'</td>
+ <td class="grey" align="center">'.$r_gsumm[spree_dom].'</td>
+ <td class="grey" align="center">'.$r_gsumm[spree_uns].'</td>
+ <td class="grey" align="center">'.$r_gsumm[spree_god].'</td>
+ </tr>
+ </tbody></table>
+<br>';
+
+include('includes/weaponstats.php');
+weaponstats($mid, $pid);
+
+$r_pings = small_query("SELECT lowping, avgping, highping FROM uts_player WHERE pid = $pid and matchid = $mid and lowping > 0");
+if ($r_pings and $r_pings['lowping']) {
+echo '
+ <br>
+ <table class = "box" border="0" cellpadding="0" cellspacing="2">
+ <tbody><tr>
+ <td class="heading" colspan="6" align="center">Pings</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center" width="80">Min</td>
+ <td class="smheading" align="center" width="80">Avg</td>
+ <td class="smheading" align="center" width="80">Max</td>
+ </tr>
+ <tr>
+ <td class="grey" align="center">'.ceil($r_pings['lowping']).'</td>
+ <td class="grey" align="center">'.ceil($r_pings['avgping']).'</td>
+ <td class="grey" align="center">'.ceil($r_pings['highping']).'</td>
+ </tr>
+ </tbody></table>';
+}
+
+?>
diff --git a/html/pages/match_report.php b/html/pages/match_report.php new file mode 100755 index 0000000..0f452ba --- /dev/null +++ b/html/pages/match_report.php @@ -0,0 +1,17 @@ +<?php
+$matchid = preg_replace('/\D/', '', $_GET[mid]);
+
+echo'<br><table class = "box" border="0" cellpadding="1" cellspacing="2" width="300">
+ <tbody>
+ <tr>
+ <td class="heading" align="center">Match Reports</td>
+ </tr>
+ <tr>
+ <td class="dark" align="center"><a class="darkhuman" href="./?p=report&id='.$matchid.'&rtype=clanbase">Clanbase Cup Format</a></td>
+ </tr>
+ <tr>
+ <td class="dark" align="center"><a class="darkhuman" href="./?p=report&id='.$matchid.'&rtype=bbcode">Forum BBCode Format</a></td>
+ </tr>
+ </tbody>
+</table>';
+?>
\ No newline at end of file diff --git a/html/pages/players.php b/html/pages/players.php new file mode 100755 index 0000000..1d9788a --- /dev/null +++ b/html/pages/players.php @@ -0,0 +1,124 @@ +<?php
+function InvertSort($curr_field, $filter, $sort) {
+ if ($curr_field != $filter) return(($curr_field == "name") ? "ASC" : "DESC");
+ if ($sort == 'ASC') return('DESC');
+ return('ASC');
+}
+
+function SortPic($curr_field, $filter, $sort) {
+ if ($curr_field != $filter) return;
+ $fname = 'images/s_'. strtolower($sort) .'.png';
+ if (!file_exists($fname)) return;
+ return(' <img src="'. $fname .'" border="0" width="11" height="9" alt="" title="('.strtolower($sort).'ending)">');
+}
+
+
+// Get filter and set sorting
+$filter = my_addslashes($_GET[filter]);
+$sort = my_addslashes($_GET[sort]);
+
+IF (empty($filter) or (!in_array(strtolower($filter), array("name", "games", "gamescore", "frags", "kills", "deaths", "suicides", "eff", "accuracy", "ttl", "gametime")))) {
+ $filter = "name";
+}
+
+if (empty($sort) or ($sort != 'ASC' and $sort != 'DESC')) $sort = ($filter == "name") ? "ASC" : "DESC";
+
+
+// Work out Prev, Next, First, Last Stuff
+
+$r_pcount = small_query("SELECT COUNT(*) AS pcount FROM uts_pinfo");
+$pcount = $r_pcount['pcount'];
+
+$ecount = $pcount/50;
+$ecount2 = number_format($ecount, 0, '.', '');
+
+IF($ecount > $ecount2) {
+ $ecount2 = $ecount2+1;
+}
+
+$fpage = 0;
+IF($ecount < 1) { $lpage = 0; }
+else { $lpage = $ecount2-1; }
+
+$cpage = preg_replace('/\D/', '', $_GET["page"]);
+IF ($cpage == "") { $cpage = "0"; }
+$qpage = $cpage*50;
+
+$tfpage = $cpage+1;
+$tlpage = $lpage+1;
+
+$ppage = $cpage-1;
+$ppageurl = "<a class=\"pages\" href=\"./?p=players&filter=$filter&sort=$sort&page=$ppage\">[Previous]</a>";
+IF ($ppage < "0") { $ppageurl = "[Previous]"; }
+
+$npage = $cpage+1;
+$npageurl = "<a class=\"pages\" href=\"./?p=players&filter=$filter&sort=$sort&page=$npage\">[Next]</a>";
+IF ($npage >= "$ecount") { $npageurl = "[Next]"; }
+
+$fpageurl = "<a class=\"pages\" href=\"./?p=players&filter=$filter&sort=$sort&page=$fpage\">[First]</a>";
+IF ($cpage == "0") { $fpageurl = "[First]"; }
+
+$lpageurl = "<a class=\"pages\" href=\"./?p=players&filter=$filter&sort=$sort&page=$lpage\">[Last]</a>";
+IF ($cpage == "$lpage") { $lpageurl = "[Last]"; }
+
+// Show information
+echo'
+<form NAME="playersearch" METHOD="post" ACTION="./?p=psearch">
+<div class="pages"><b>Page ['.$tfpage.'/'.$tlpage.'] Selection: '.$fpageurl.' / '.$ppageurl.' / '.$npageurl.' / '.$lpageurl.'</b></div>
+<div class="opnote">* Click headings to change Sorting *</div>
+<table class="box" border="0" cellpadding="1" cellspacing="1">
+ <tbody><tr>
+ <td class="heading" colspan="12" align="center">Unreal Tournament Player List</td>
+ </tr>
+ <tr>
+ <td class = "smheading" colspan = "12" ALIGN="center">Name Search:
+ <input TYPE="text" NAME="name" MAXLENGTH="35" SIZE="20" CLASS="searchform">
+ <input TYPE="submit" NAME="Default" VALUE="Search" CLASS="searchformb"></td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center" width="150"><a class="smheading" href="./?p=players&filter=name&sort='.InvertSort('name', $filter, $sort).'">Player Name</a>'.SortPic('name', $filter, $sort).'</td>
+ <td class="smheading" align="center" width="45"><a class="smheading" href="./?p=players&filter=games&sort='.InvertSort('games', $filter, $sort).'">Matches</a>'.SortPic('games', $filter, $sort).'</td>
+ <td class="smheading" align="center" width="50"><a class="smheading" href="./?p=players&filter=gamescore&sort='.InvertSort('gamescore', $filter, $sort).'">Score</a>'.SortPic('gamescore', $filter, $sort).'</td>
+ <td class="smheading" align="center" width="50"><a class="smheading" href="./?p=players&filter=frags&sort='.InvertSort('frags', $filter, $sort).'">Frags</a>'.SortPic('frags', $filter, $sort).'</td>
+ <td class="smheading" align="center" width="50"><a class="smheading" href="./?p=players&filter=kills&sort='.InvertSort('kills', $filter, $sort).'">Kills</a>'.SortPic('kills', $filter, $sort).'</td>
+ <td class="smheading" align="center" width="50"><a class="smheading" href="./?p=players&filter=deaths&sort='.InvertSort('deaths', $filter, $sort).'">Deaths</a>'.SortPic('deaths', $filter, $sort).'</td>
+ <td class="smheading" align="center" width="50"><a class="smheading" href="./?p=players&filter=suicides&sort='.InvertSort('suicides', $filter, $sort).'">Suicides</a>'.SortPic('suicides', $filter, $sort).'</td>
+ <td class="smheading" align="center" width="45"><a class="smheading" href="./?p=players&filter=eff&sort='.InvertSort('eff', $filter, $sort).'">Eff.</a>'.SortPic('eff', $filter, $sort).'</td>
+ <td class="smheading" align="center" width="45"><a class="smheading" href="./?p=players&filter=accuracy&sort='.InvertSort('accuracy', $filter, $sort).'">Acc.</a>'.SortPic('accuracy', $filter, $sort).'</td>
+ <td class="smheading" align="center" width="45"><a class="smheading" href="./?p=players&filter=ttl&sort='.InvertSort('ttl', $filter, $sort).'">TTL</a>'.SortPic('ttl', $filter, $sort).'</td>
+ <td class="smheading" align="center" width="45"><a class="smheading" href="./?p=players&filter=gametime&sort='.InvertSort('gametime', $filter, $sort).'">Hours</a>'.SortPic('gametime', $filter, $sort).'</td>
+ </tr>';
+
+$sql_plist = "SELECT pi.name AS name, pi.country AS country, p.pid, COUNT(p.id) AS games, SUM(p.gamescore) as gamescore, SUM(p.frags) AS frags, SUM(p.kills) AS kills,
+SUM(p.deaths) AS deaths, SUM(p.suicides) as suicides, AVG(p.eff) AS eff, AVG(p.accuracy) AS accuracy, AVG(p.ttl) AS ttl, SUM(gametime) as gametime
+FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND pi.banned <> 'Y' GROUP BY p.pid ORDER BY $filter $sort LIMIT $qpage,50";
+$q_plist = mysql_query($sql_plist) or die(mysql_error());
+while ($r_plist = mysql_fetch_array($q_plist)) {
+
+ $gametime = sec2hour($r_plist[gametime]);
+ $eff = get_dp($r_plist[eff]);
+ $acc = get_dp($r_plist[accuracy]);
+ $ttl = GetMinutes($r_plist[ttl]);
+ $r_pname = $r_plist[name];
+ $myurl = urlencode($r_pname);
+
+ echo'
+ <tr>
+ <td nowrap class="dark" align="left"><a class="darkhuman" href="./?p=pinfo&pid='.$r_plist['pid'].'">'.FormatPlayerName($r_plist[country], $r_plist['pid'], $r_pname).'</a></td>
+ <td class="grey" align="center">'.$r_plist[games].'</td>
+ <td class="grey" align="center">'.$r_plist[gamescore].'</td>
+ <td class="grey" align="center">'.$r_plist[frags].'</td>
+ <td class="grey" align="center">'.$r_plist[kills].'</td>
+ <td class="grey" align="center">'.$r_plist[deaths].'</td>
+ <td class="grey" align="center">'.$r_plist[suicides].'</td>
+ <td class="grey" align="center">'.$eff.'</td>
+ <td class="grey" align="center">'.$acc.'</td>
+ <td class="grey" align="center">'.$ttl.'</td>
+ <td class="grey" align="center">'.$gametime.'</td>
+ </tr>';
+}
+echo'
+</tbody></table>
+<div class="pages"><b>Page ['.$tfpage.'/'.$tlpage.'] Selection: '.$fpageurl.' / '.$ppageurl.' / '.$npageurl.' / '.$lpageurl.'</b></div>
+</form>';
+?>
diff --git a/html/pages/players_explain_ranking.php b/html/pages/players_explain_ranking.php new file mode 100755 index 0000000..5930cfb --- /dev/null +++ b/html/pages/players_explain_ranking.php @@ -0,0 +1,190 @@ +<?php
+function row($name = NULL, $amount = 0, $multiplier = 0, $extra_multiplier = true) {
+ static $i = 0;
+ if (empty($name)) {
+ echo '<tr><td colspan="4" height="3"></td></tr>';
+ $i = 0;
+ return(0);
+ }
+ $i++;
+ $class = ($i%2) ? 'grey' : 'grey2';
+ if ($extra_multiplier) $multiplier *= 600;
+ $points = $amount * $multiplier;
+
+ $d_points = get_dp($points);
+ if ($points % 1 == 0) $d_points = ceil($points);
+ echo '<tr>';
+ echo '<td class="dark">'. htmlentities($name) .'</td>';
+ echo '<td class="'.$class.'" align="center">'. $amount .'</td>';
+ echo '<td class="'.$class.'" align="center">'. $multiplier .'</td>';
+ echo '<td class="'.$class.'" align="right">'. $d_points .'</td>';
+ echo '</tr>';
+ return($points);
+}
+
+$pid = isset($pid) ? $pid : $_GET['pid'];
+$gid = isset($gid) ? $gid : $_GET['gid'];
+
+$pid = preg_replace('/\D/', '', $pid);
+$gid = preg_replace('/\D/', '', $gid);
+
+$r_info = small_query("SELECT name, country, banned FROM uts_pinfo WHERE id = '$pid'");
+if (!$r_info) {
+ echo "Player not found";
+ include("includes/footer.php");
+ exit;
+}
+
+if ($r_info['banned'] == 'Y') {
+ if (isset($is_admin) and $is_admin) {
+ echo "Warning: Banned player - Admin override<br>";
+ } else {
+ echo "Sorry, this player has been banned!";
+ include("includes/footer.php");
+ exit;
+ }
+}
+
+$playername = $r_info['name'];
+
+$r_game = small_query("SELECT name, gamename FROM uts_games WHERE id = '$gid'");
+if (!$r_game) {
+ echo "Game ($gid) not found.";
+ include("includes/footer.php");
+ exit;
+}
+$real_gamename = $r_game['gamename'];
+
+
+$r_cnt = small_query("SELECT
+ SUM(frags) AS frags, SUM(deaths) AS deaths, SUM(suicides) AS suicides, SUM(teamkills) AS teamkills,
+ SUM(flag_taken) AS flag_taken, SUM(flag_pickedup) AS flag_pickedup, SUM(flag_return) AS flag_return, SUM(flag_capture) AS flag_capture, SUM(flag_cover) AS flag_cover,
+ SUM(flag_seal) AS flag_seal, SUM(flag_assist) AS flag_assist, SUM(flag_kill) AS flag_kill,
+ SUM(dom_cp) AS dom_cp, SUM(ass_obj) AS ass_obj,
+ SUM(spree_double) AS spree_double, SUM(spree_multi) AS spree_multi, SUM(spree_ultra) AS spree_ultra, SUM(spree_monster) AS spree_monster,
+ SUM(spree_kill) AS spree_kill, SUM(spree_rampage) AS spree_rampage, SUM(spree_dom) AS spree_dom, SUM(spree_uns) AS spree_uns, SUM(spree_god) AS spree_god,
+ SUM(gametime) AS gametime
+ FROM uts_player WHERE pid = $pid and gid = $gid");
+
+
+
+
+echo'
+<table class = "box" border="0" cellpadding="1" cellspacing="2" width="720">
+ <tbody><tr>
+ <td class="heading" align="center"><a href="?p=pinfo&pid='.$pid.'">'.FlagImage($r_info['country'], false).' '.htmlentities($playername).'</a>\'s '. htmlentities($r_game['name']) .' ranking explained </td>
+ </tr>
+</tbody></table>';
+echo '<br /><br />';
+
+
+
+
+
+echo '
+<table class="box" border="0" cellpadding="1" cellspacing="1">
+<tbody>
+ <tr>
+ <td class="smheading" width="250"></td>
+ <td class="smheading" width="80" align="center">Amount</td>
+ <td class="smheading" width="80" align="center">Multiplier</td>
+ <td class="smheading" width="100" align="right">Points</t>
+ </tr>';
+
+if ($real_gamename == "Bunny Track") {
+ $sql_btmaprank = "SELECT e.col2 AS no, COUNT(e.col2) AS count FROM uts_events AS e, uts_player AS p WHERE p.pid = $pid AND p.gid = $gid AND p.playerid = e.playerid AND e.matchid = p.matchid AND e.col2 > 0 AND e.col2 <= 5 GROUP BY e.col2";
+ $q_btmaprank = mysql_query($sql_btmaprank) or die ("Can't retrieve \$q_btmaprank: ". mysql_error());
+ $mapranks = array();
+ while($r_btmaprank = mysql_fetch_assoc($q_btmaprank)) {
+ $mapranks[$r_btmaprank[no]] = $r_btmaprank[count];
+ }
+
+ $t_points += row('First place', (!empty($mapranks[1]) ? $mapranks[1] : 0), 10);
+ $t_points += row('Second place', (!empty($mapranks[2]) ? $mapranks[2] : 0), 8);
+ $t_points += row('Third place', (!empty($mapranks[3]) ? $mapranks[3] : 0), 6);
+ $t_points += row('Fourth place', (!empty($mapranks[4]) ? $mapranks[4] : 0), 4);
+ $t_points += row('Fifth place', (!empty($mapranks[5]) ? $mapranks[5] : 0), 2);
+}
+else {
+ $t_points = 0;
+ $t_points += row('Frags', $r_cnt['frags'], 0.5);
+ $t_points += row('Deaths', $r_cnt['deaths'], -0.25);
+ $t_points += row('Suicides', $r_cnt['suicides'], -0.25 );
+ $t_points += row('Teamkills', $r_cnt['teamkills'], -2);
+ row();
+ $t_points += row('Flag Takes', $r_cnt['flag_taken'], 1);
+ $t_points += row('Flag Pickups', $r_cnt['flag_pickedup'], 1);
+ $t_points += row('Flag Returns', $r_cnt['flag_return'], 1);
+ $t_points += row('Flag Captures', $r_cnt['flag_capture'], 10);
+ $t_points += row('Flag Covers', $r_cnt['flag_cover'], 3);
+ $t_points += row('Flag Seals', $r_cnt['flag_seal'], 2);
+ $t_points += row('Flag Assists', $r_cnt['flag_assist'], 5);
+ $t_points += row('Flag Kills', $r_cnt['flag_kill'], 2);
+ row();
+ $t_points += row('Controlpoint Captures', $r_cnt['dom_cp'], 10);
+ if (strpos($real_gamename, 'Assault') !== false) {
+ $t_points += row('Assault Objectives', $r_cnt['ass_obj'], 10);
+ } else {
+ $t_points += row('Assault Objectives', 0, 10);
+ }
+ if (strpos($real_gamename, 'JailBreak') !== false) {
+ $t_points += row('Team Releases', $r_cnt['ass_obj'], 1.5);
+ } else {
+ $t_points += row('Team Releases', 0, 1.5);
+ }
+ row();
+ $t_points += row('Double Kills', $r_cnt['spree_double'], 1);
+ $t_points += row('Multi Kills', $r_cnt['spree_multi'], 1);
+ $t_points += row('Ultra Kills', $r_cnt['spree_ultra'], 1);
+ $t_points += row('Monster Kills', $r_cnt['spree_monster'], 2);
+ row();
+ $t_points += row('Killing Sprees', $r_cnt['spree_kill'], 1);
+ $t_points += row('Rampages', $r_cnt['spree_rampage'], 1);
+ $t_points += row('Dominatings', $r_cnt['spree_dom'], 1.5);
+ $t_points += row('Unstoppables', $r_cnt['spree_uns'], 2);
+ $t_points += row('Godlikes', $r_cnt['spree_god'], 3);
+}
+
+row();
+row();
+echo '<tr> <td class="dark">Total</td>
+ <td class="grey" align="center"></td>
+ <td class="grey" align="center"></td>
+ <td class="grey" align="right">'. ceil($t_points) .'</td>
+ </tr>';
+
+$gametime = ceil($r_cnt['gametime'] / 60);
+$t_points = $t_points / $gametime;
+echo '<tr> <td class="dark">Divided by game minutes</td>
+ <td class="grey2" align="center">'.$gametime.'</td>
+ <td class="grey2" align="center"></td>
+ <td class="grey2" align="right">'. get_dp($t_points) .'</td>
+ </tr>';
+
+IF ($gametime < 10) {
+ $t_points += row('Penalty for playing < 10 minutes', get_dp($t_points), 0, false);
+}
+
+IF ($gametime >= 10 && $gametime < 50) {
+ $t_points += row('Penalty for playing < 50 minutes', get_dp($t_points), -0.75, false);
+}
+
+IF ($gametime >= 50 && $gametime < 100) {
+ $t_points += row('Penalty for playing < 100 minutes', get_dp($t_points), -0.5, false);
+}
+
+IF ($gametime >= 100 && $gametime < 200) {
+ $t_points += row('Penalty for playing < 200 minutes', get_dp($t_points), -0.3, false);
+}
+
+IF ($gametime >= 200 && $gametime < 300) {
+ $t_points += row('Penalty for playing < 300 minutes', get_dp($t_points), -0.15, false);
+}
+row();
+echo '<tr> <td class="darkgrey"><strong>Total</strong></td>
+ <td class="darkgrey" align="center"></td>
+ <td class="darkgrey" align="center"></td>
+ <td class="darkgrey" align="right"><strong>'. get_dp($t_points) .'</strong></td>
+ </tr>';
+echo '</tbody></table>';
+?>
diff --git a/html/pages/players_info.php b/html/pages/players_info.php new file mode 100755 index 0000000..11064dc --- /dev/null +++ b/html/pages/players_info.php @@ -0,0 +1,442 @@ +<?php
+global $pic_enable;
+$pid = isset($pid) ? $pid : $_GET['pid'];
+$pid = preg_replace('/\D/', '', $pid);
+
+$r_info = small_query("SELECT name, country, banned FROM uts_pinfo WHERE id = '$pid'");
+if (!$r_info) {
+ echo "Player not found";
+ include("includes/footer.php");
+ exit;
+}
+
+if ($r_info['banned'] == 'Y') {
+ if (isset($is_admin) and $is_admin) {
+ echo "Warning: Banned player - Admin override<br>";
+ } else {
+ echo "Sorry, this player has been banned!";
+ include("includes/footer.php");
+ exit;
+ }
+}
+
+$playername = $r_info['name'];
+
+if (isset($_GET['togglewatch'])) {
+ $status = ToggleWatchStatus($pid);
+ include('includes/header.php');
+ if ($status == 1) {
+ echo htmlentities($playername) ." has been added to your watchlist";
+ } else {
+ echo htmlentities($playername) ." has been removed from your watchlist";
+ }
+ echo "<br>";
+ $target = $PHP_SELF .'?p=pinfo&pid='. $pid;
+ echo 'You will be taken back to the <a href="'. $target .'">'. htmlentities($playername) .'\'s page</a> in a moment.';
+ echo '<meta http-equiv="refresh" content="2;URL='. $target .'">';
+ return;
+}
+
+
+if (isset($_GET['pics'])) {
+ $gid = $_GET['gid'];
+ $gid = preg_replace("/\D/", "", $gid);
+ if (!$pic_enable) {
+ echo "Sorry, pictures are disabled by the administrator";
+ return;
+ }
+ $oururl = $_SERVER["HTTP_HOST"].$_SERVER["PHP_SELF"];
+ $oururl = str_replace("index.php", "", $oururl);
+
+ echo '<div class="pages" align="left">';
+ require('includes/config_pic.php');
+ $disp = false;
+ foreach($pic as $num => $options) {
+ if (!$options['enabled']) continue;
+ if ($options['gidrequired'] and empty($gid)) continue;
+ $disp = true;
+ $pinfourl = "http://${oururl}?p=pinfo&pid=$pid";
+ $lgid = ($options['gidrequired']) ? $gid : 0;
+ $imgurl = "http://${oururl}pic.php/$num/$pid/$lgid/.".$options['output']['type'];
+ echo '<table class="box" border="0" cellspacing="2" cellpadding="1" align="center"><tr>';
+ echo '<td colspan="2" align="center"><img src="'. $imgurl .'" border="0" /></td>';
+ echo '</tr><tr>';
+ echo '<td class="smheading">BB Code:</td><td><textarea rows="1" cols="85">'. str_replace(' ', ' ', htmlentities('[url='.$pinfourl.'][img]'.$imgurl.'[/img][/url]')) .'</textarea></td>';
+ echo '</tr><tr>';
+ echo '<td class="smheading">HTML Code:</td><td><textarea rows="1" cols="85">'. str_replace(' ', ' ', htmlentities('<a href="'.$pinfourl.'" target="_blank"><img src="'.$imgurl.'" border="0"></img></a>')) .'</textarea></td>';
+ echo '</tr></table><br><br>';
+ }
+ if (!$disp) echo "Sorry, no pictures in this category";
+ echo '</div>';
+ return;
+}
+
+
+
+
+
+echo'
+<table class="box" border="0" cellpadding="1" cellspacing="2" width="710">
+ <tbody><tr>
+ <td class="heading" colspan="12" align="center">Career Summary for '.FlagImage($r_info['country'], false).' '.htmlentities($playername).' ';
+
+if (PlayerOnWatchlist($pid)) {
+ echo '<a href="?p=pinfo&pid='.$pid.'&togglewatch=1&noheader=1"><img src="images/unwatch.png" width="17" height="11" border="0" alt="" title="You are watching this player. Click to remove from your watchlist."></a>';
+} else {
+ echo '<a href="?p=pinfo&pid='.$pid.'&togglewatch=1&noheader=1"><img src="images/watch.png" width="17" height="11" border="0" alt="" title="Click to add this player to your watchlist."></a>';
+}
+
+echo '
+ </td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center">Match Type</td>
+ <td class="smheading" align="center">Score</td>
+ <td class="smheading" align="center" '.OverlibPrintHint('F').'>F</td>
+ <td class="smheading" align="center" '.OverlibPrintHint('K').'>K</td>
+ <td class="smheading" align="center" '.OverlibPrintHint('D').'>D</td>
+ <td class="smheading" align="center" '.OverlibPrintHint('S').'>S</td>
+ <td class="smheading" align="center" '.OverlibPrintHint('TK').'>TK</td>
+ <td class="smheading" align="center" '.OverlibPrintHint('EFF').'>Eff.</td>
+ <td class="smheading" align="center" '.OverlibPrintHint('ACC').'>Acc.</td>
+ <td class="smheading" align="center" '.OverlibPrintHint('TTL').'>Avg TTL</td>
+ <td class="smheading" align="center">Matches</td>
+ <td class="smheading" align="center">Hours</td>
+ </tr>';
+
+$sql_plist = "SELECT g.name AS gamename, SUM(p.gamescore) AS gamescore, SUM(p.frags) AS frags, SUM(p.kills) AS kills, SUM(p.deaths) AS deaths,
+SUM(p.suicides) AS suicides, SUM(p.teamkills) AS teamkills, SUM(kills+deaths+suicides+teamkills) AS sumeff, AVG(p.accuracy) AS accuracy, AVG(p.ttl) AS ttl,
+COUNT(p.id) AS games, SUM(p.gametime) as gametime
+FROM uts_player AS p, uts_games AS g WHERE p.gid = g.id AND p.pid = '$pid' GROUP BY p.gid";
+
+$q_plist = mysql_query($sql_plist) or die(mysql_error());
+while ($r_plist = mysql_fetch_array($q_plist)) {
+
+ $gametime = sec2hour($r_plist[gametime]);
+ $eff = get_dp($r_plist[kills]/$r_plist[sumeff]*100);
+ $acc = get_dp($r_plist[accuracy]);
+ $ttl = GetMinutes($r_plist[ttl]);
+
+ echo'<tr>
+ <td class="dark" align="center">'.$r_plist[gamename].'</td>
+ <td class="grey" align="center">'.$r_plist[gamescore].'</td>
+ <td class="grey" align="center">'.$r_plist[frags].'</td>
+ <td class="grey" align="center">'.$r_plist[kills].'</td>
+ <td class="grey" align="center">'.$r_plist[deaths].'</td>
+ <td class="grey" align="center">'.$r_plist[suicides].'</td>
+ <td class="grey" align="center">'.$r_plist[teamkills].'</td>
+ <td class="grey" align="center">'.$eff.'</td>
+ <td class="grey" align="center">'.$acc.'</td>
+ <td class="grey" align="center">'.$ttl.'</td>
+ <td class="grey" align="center">'.$r_plist[games].'</td>
+ <td class="grey" align="center">'.$gametime.'</td>
+ </tr>';
+}
+
+$r_sumplist = small_query("SELECT SUM(gamescore) AS gamescore, SUM(frags) AS frags, SUM(kills) AS kills, SUM(deaths) AS deaths,
+SUM(suicides) AS suicides, SUM(teamkills) AS teamkills, SUM(kills+deaths+suicides+teamkills) AS sumeff,
+AVG(accuracy) AS accuracy, AVG(ttl) AS ttl, COUNT(id) AS games, SUM(gametime) as gametime
+FROM uts_player WHERE pid = '$pid'");
+
+$gametime = sec2hour($r_sumplist[gametime]);
+$eff = get_dp($r_sumplist[kills]/$r_sumplist[sumeff]*100);
+$acc = get_dp($r_sumplist[accuracy]);
+$ttl = GetMinutes($r_sumplist[ttl]);
+
+ echo'
+ <tr>
+ <td class="dark" align="center"><b>Totals</b></td>
+ <td class="darkgrey" align="center">'.$r_sumplist[gamescore].'</td>
+ <td class="darkgrey" align="center">'.$r_sumplist[frags].'</td>
+ <td class="darkgrey" align="center">'.$r_sumplist[kills].'</td>
+ <td class="darkgrey" align="center">'.$r_sumplist[deaths].'</td>
+ <td class="darkgrey" align="center">'.$r_sumplist[suicides].'</td>
+ <td class="darkgrey" align="center">'.$r_sumplist[teamkills].'</td>
+ <td class="darkgrey" align="center">'.$eff.'</td>
+ <td class="darkgrey" align="center">'.$acc.'</td>
+ <td class="darkgrey" align="center">'.$ttl.'</td>
+ <td class="darkgrey" align="center">'.$r_sumplist[games].'</td>
+ <td class="darkgrey" align="center">'.$gametime.'</td>
+ </tr>
+</tbody></table>
+<br>';
+
+$q_assgids = mysql_query("SELECT id FROM uts_games WHERE gamename LIKE '%Assault%';") or die(mysql_error());
+$assgids = array();
+while ($r_assgids = mysql_fetch_array($q_assgids)) {
+ $assgids[] = $r_assgids['id'];
+}
+$assquery = (count($assgids) > 0) ? 'SUM(IF (gid IN ('. implode(',', $assgids) .'), ass_obj, 0)) AS ass_obj' : '0 AS ass_obj';
+ $sql_cdatot = zero_out(small_query("SELECT SUM(dom_cp) AS dom_cp, $assquery, SUM(flag_taken) AS flag_taken,
+SUM(flag_pickedup) AS flag_pickedup, SUM(flag_dropped) AS flag_dropped, SUM(flag_assist) AS flag_assist, SUM(flag_cover) AS flag_cover,
+SUM(flag_seal) AS flag_seal, SUM(flag_capture) AS flag_capture, SUM(flag_kill)as flag_kill,
+SUM(flag_return) AS flag_return FROM uts_player WHERE pid = '$pid'"));
+
+if ($sql_cdatot[ass_obj] || $sql_cdatot[dom_cp] || $sql_cdatot[flag_taken] || $sql_cdatot[flag_pickedup] || $sql_cdatot[flag_dropped] || $sql_cdatot[flag_assist] || $sql_cdatot[flag_cover] || $sql_cdatot[flag_seal] || $sql_cdatot[flag_capture] || $sql_cdatot[flag_kill] || $sql_cdatot[flag_return]) {
+ echo '
+ <table class = "box" border="0" cellpadding="1" cellspacing="2" width="600">
+ <tbody><tr>
+ <td class="heading" colspan="11" align="center">Assault, Domination and CTF Events Summary</td>
+ </tr>
+ <tr>
+ <td class="dark" align="center" rowspan="2">Assault Objectives</td>
+ <td class="dark" align="center" rowspan="2">Control Point Captures</td>
+ <td class="dark" align="center" colspan="9">Capture The Flag</td>
+ </tr>
+ <tr>
+ <td class="dark" align="center">Flag Takes</td>
+ <td class="dark" align="center">Flag Pickups</td>
+ <td class="dark" align="center">Flag Drops</td>
+ <td class="dark" align="center">Flag Assists</td>
+ <td class="dark" align="center">Flag Covers</td>
+ <td class="dark" align="center">Flag Seals</td>
+ <td class="dark" align="center">Flag Captures</td>
+ <td class="dark" align="center">Flag Kills</td>
+ <td class="dark" align="center">Flag Returns</td>
+ </tr>';
+
+ echo'
+ <tr>
+ <td class="grey" align="center">'.$sql_cdatot[ass_obj].'</td>
+ <td class="grey" align="center">'.$sql_cdatot[dom_cp].'</td>
+ <td class="grey" align="center">'.$sql_cdatot[flag_taken].'</td>
+ <td class="grey" align="center">'.$sql_cdatot[flag_pickedup].'</td>
+ <td class="grey" align="center">'.$sql_cdatot[flag_dropped].'</td>
+ <td class="grey" align="center">'.$sql_cdatot[flag_assist].'</td>
+ <td class="grey" align="center">'.$sql_cdatot[flag_cover].'</td>
+ <td class="grey" align="center">'.$sql_cdatot[flag_seal].'</td>
+ <td class="grey" align="center">'.$sql_cdatot[flag_capture].'</td>
+ <td class="grey" align="center">'.$sql_cdatot[flag_kill].'</td>
+ <td class="grey" align="center">'.$sql_cdatot[flag_return].'</td>
+ </tr>
+ </tbody></table>
+ <br>';
+}
+
+$sql_firstblood = zero_out(small_query("SELECT COUNT(id) AS fbcount FROM uts_match WHERE firstblood = '$pid'"));
+$sql_multis = zero_out(small_query("SELECT SUM(spree_double) AS spree_double, SUM(spree_multi) AS spree_multi,
+SUM(spree_ultra) AS spree_ultra, SUM(spree_monster) AS spree_monster,
+SUM(spree_kill) AS spree_kill, SUM(spree_rampage) AS spree_rampage, SUM(spree_dom) AS spree_dom,
+SUM(spree_uns) AS spree_uns, SUM(spree_god) AS spree_god
+FROM uts_player WHERE pid = '$pid'"));
+
+if ($sql_firstblood[fbcount] || $sql_multis[spree_double] || $sql_multis[spree_multi] || $sql_multis[spree_ultra] || $sql_multis[spree_monster] || $sql_multis[spree_kill] || $sql_multis[spree_rampage] || $sql_multis[spree_dom] || $sql_multis[spree_uns] || $sql_multis[spree_god] ) {
+ echo '
+ <table class = "box" border="0" cellpadding="0" cellspacing="2" width="400">
+ <tbody><tr>
+ <td class="heading" colspan="10" align="center">Special Events</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center" rowspan="2" width="40">First Blood</td>
+ <td class="smheading" align="center" colspan="4" width="160" '.OverlibPrintHint('Multis').'>Multis</td>
+ <td class="smheading" align="center" colspan="5" width="200" '.OverlibPrintHint('Sprees').'>Sprees</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center" width="40" '.OverlibPrintHint('DK').'>Dbl</td>
+ <td class="smheading" align="center" width="40" '.OverlibPrintHint('MK').'>Multi</td>
+ <td class="smheading" align="center" width="40" '.OverlibPrintHint('UK').'>Ultra</td>
+ <td class="smheading" align="center" width="40" '.OverlibPrintHint('MOK').'>Mons</td>
+ <td class="smheading" align="center" width="40" '.OverlibPrintHint('KS').'>Kill</td>
+ <td class="smheading" align="center" width="40" '.OverlibPrintHint('RA').'>Ram</td>
+ <td class="smheading" align="center" width="40" '.OverlibPrintHint('DO').'>Dom</td>
+ <td class="smheading" align="center" width="40" '.OverlibPrintHint('US').'>Uns</td>
+ <td class="smheading" align="center" width="40" '.OverlibPrintHint('GL').'>God</td>
+ </tr>';
+
+ echo'
+ <tr>
+ <td class="grey" align="center">'.$sql_firstblood[fbcount].'</td>
+ <td class="grey" align="center">'.$sql_multis[spree_double].'</td>
+ <td class="grey" align="center">'.$sql_multis[spree_multi].'</td>
+ <td class="grey" align="center">'.$sql_multis[spree_ultra].'</td>
+ <td class="grey" align="center">'.$sql_multis[spree_monster].'</td>
+ <td class="grey" align="center">'.$sql_multis[spree_kill].'</td>
+ <td class="grey" align="center">'.$sql_multis[spree_rampage].'</td>
+ <td class="grey" align="center">'.$sql_multis[spree_dom].'</td>
+ <td class="grey" align="center">'.$sql_multis[spree_uns].'</td>
+ <td class="grey" align="center">'.$sql_multis[spree_god].'</td>
+ </tr>
+ </tbody></table>
+ <br>';
+}
+
+$r_pickups = zero_out(small_query("SELECT SUM(pu_pads) AS pu_pads, SUM(pu_armour) AS pu_armour, SUM(pu_keg) AS pu_keg,
+SUM(pu_invis) AS pu_invis, SUM(pu_belt) AS pu_belt, SUM(pu_amp) AS pu_amp
+FROM uts_player WHERE pid = '$pid'"));
+
+if ($r_pickups[pu_pads] || $r_pickups[pu_armour] || $r_pickups[pu_keg] || $r_pickups[pu_invis] || $r_pickups[pu_belt] || $r_pickups[pu_amp] ) {
+ echo '
+ <table class = "box" border="0" cellpadding="0" cellspacing="2" width="480">
+ <tbody><tr>
+ <td class="heading" colspan="6" align="center">Pickups Summary</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center" width="80">Pads</td>
+ <td class="smheading" align="center" width="80">Armour</td>
+ <td class="smheading" align="center" width="80">Keg</td>
+ <td class="smheading" align="center" width="80">Invisibility</td>
+ <td class="smheading" align="center" width="80">Shield Belt</td>
+ <td class="smheading" align="center" width="80">Damage Amp</td>
+ </tr>
+ <tr>
+ <td class="grey" align="center">'.$r_pickups[pu_pads].'</td>
+ <td class="grey" align="center">'.$r_pickups[pu_armour].'</td>
+ <td class="grey" align="center">'.$r_pickups[pu_keg].'</td>
+ <td class="grey" align="center">'.$r_pickups[pu_invis].'</td>
+ <td class="grey" align="center">'.$r_pickups[pu_belt].'</td>
+ <td class="grey" align="center">'.$r_pickups[pu_amp].'</td>
+ </tr>
+ </tbody></table>
+ <br>';
+}
+
+include('includes/weaponstats.php');
+weaponstats(0, $pid);
+
+echo '<br>';
+
+// bt records
+$sql_btrecords = "
+SELECT
+ m.mapfile AS map,
+ e.col3 AS time,
+ e.col4 AS date
+FROM
+ uts_match AS m,
+ uts_events AS e,
+ uts_player AS p
+WHERE
+ p.pid = $pid AND
+ p.playerid = e.playerid AND
+ e.matchid = p.matchid AND
+ m.id = p.matchid AND
+ e.col1 = 'btcap'
+GROUP BY
+ m.mapfile
+ORDER BY
+ m.mapfile,
+ 0 + e.col3 ASC";
+
+$q_btrecords = mysql_query($sql_btrecords) or die (mysql_error());
+if (mysql_num_rows($q_btrecords) > 0) {
+ echo '
+ <table class = "box" border="0" cellpadding="0" cellspacing="2" width="600">
+ <tbody><tr>
+ <td class="heading" colspan="4" align="center">Bunny Track Personal Records</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center" width="200">Map</td>
+ <td class="smheading" align="center" width="80">N°</td>
+ <td class="smheading" align="center" width="80">Time</td>
+ <td class="smheading" align="center" width="200">Date</td>
+ </tr>';
+ while ($r_btrecords = mysql_fetch_array($q_btrecords)) {
+ $map = un_ut($r_btrecords['map']);
+ $myurl = urlencode($map);
+ $maprank = 1 + small_count("SELECT DISTINCT p.pid AS rank FROM uts_player as p, uts_events AS e, uts_match as m WHERE (m.mapfile = '" . addslashes($map) . "' OR m.mapfile = '" . addslashes($map) . ".unr') AND m.id = e.matchid AND e.matchid = p.matchid AND e.playerid = p.playerid AND e.col3 < ".$r_btrecords['time'] . " AND e.col1 = 'btcap'");
+ echo '
+ <tr><td class = "dark"> <a class="darkhuman" href="./?p=minfo&map='.$myurl.'">'.htmlentities($map).'</a></td>
+ <td class = "grey" align = "center">', $maprank, '</td>
+ <td class = "grey" align = "center">', btcaptime($r_btrecords['time']), '</td>
+ <td class = "grey" align = "center">', gmdate('d-m-Y h:i a', $r_btrecords['date']), '</td></tr>';
+ }
+ echo '
+ </tbody></table>
+ <br>';
+}
+
+// Do graph stuff
+$bgwhere = "pid = '$pid'";
+include("pages/graph_pbreakdown.php");
+
+
+// Player's ranks
+echo'<table class = "box" border="0" cellpadding="1" cellspacing="1">
+ <tbody><tr>
+ <td class="heading" colspan="6" align="center">Ranking</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center" width="50">N°</td>
+ <td class="smheading" align="center" width="140">Match Type</td>
+ <td class="smheading" align="center" width="80">Rank</td>
+ <td class="smheading" align="center" width="50">Matches</td>
+ <td class="smheading" align="center" width="50">Explain</td>';
+ if ($pic_enable and basename($_SERVER['PATH_TRANSLATED']) != 'admin.php') echo '<td class="smheading" align="center" width="50">Pics</td>';
+echo '</tr>';
+
+$sql_rank = "SELECT g.name AS gamename, r.rank, r.prevrank, r.matches, r.gid, r.pid FROM uts_rank AS r, uts_games AS g WHERE r.gid = g.id AND r.pid = '$pid';";
+$q_rank = mysql_query($sql_rank) or die(mysql_error());
+while ($r_rank = mysql_fetch_array($q_rank)) {
+ $r_no = small_query("SELECT (COUNT(*) + 1) AS no FROM uts_rank WHERE gid= '${r_rank['gid']}' and rank > ". get_dp($r_rank['rank']) ."9");
+ echo'<tr>
+ <td class="grey" align="center">'.RankImageOrText($r_rank['pid'], $name, $r_no['no'], $r_rank['gid'], $r_rank['gamename'], false, '%IT%').'</td>
+ <td class="grey" align="center">'.$r_rank['gamename'].'</td>
+ <td class="grey" align="center">'.get_dp($r_rank['rank']) .' '. RankMovement($r_rank['rank'] - $r_rank['prevrank']) . '</td>
+ <td class="grey" align="center">'.$r_rank['matches'].'</td>';
+ echo '<td class="grey" align="center"><a class="grey" href="?p=pexplrank&pid='.$pid.'&gid='.$r_rank['gid'].'">(Click)</a></td>';
+ if ($pic_enable and basename($_SERVER['PATH_TRANSLATED']) != 'admin.php') echo '<td class="grey" align="center"><a class="grey" href="?p=pinfo&pid='.$pid.'&gid='.$r_rank['gid'].'&pics=1">(Click)</a></td>';
+ echo '</tr>';
+}
+
+echo '</tbody></table>';
+
+
+$r_pings = small_query("SELECT MIN(lowping * 1) AS lowping, AVG(avgping * 1) AS avgping, MAX(highping * 1) AS highping FROM uts_player WHERE pid = $pid and lowping > 0");
+if ($r_pings and $r_pings['lowping']) {
+echo '
+ <br>
+ <table class = "box" border="0" cellpadding="0" cellspacing="2">
+ <tbody><tr>
+ <td class="heading" colspan="6" align="center">Pings</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center" width="80">Min</td>
+ <td class="smheading" align="center" width="80">Avg</td>
+ <td class="smheading" align="center" width="80">Max</td>
+ </tr>
+ <tr>
+ <td class="grey" align="center">'.ceil($r_pings['lowping']).'</td>
+ <td class="grey" align="center">'.ceil($r_pings['avgping']).'</td>
+ <td class="grey" align="center">'.ceil($r_pings['highping']).'</td>
+ </tr>
+ </tbody></table>';
+}
+
+
+
+
+echo'<br><table class="box" border="0" cellpadding="1" cellspacing="1">
+ <tbody><tr>
+ <td class="heading" colspan="6" align="center">Last 50 Games</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center" width="80">Match ID</td>
+ <td class="smheading" align="center" width="220">Date/Time</td>
+ <td class="smheading" align="center" width="140">Match Type</td>
+ <td class="smheading" align="center">Map</td>';
+ if (isset($is_admin) and $is_admin) echo '<td class="smheading" align="center">IP Used</td>';
+ echo'</tr>';
+
+$sql_recent = "SELECT m.id, m.time, g.name AS gamename, m.mapfile, INET_NTOA(p.ip) AS ip FROM uts_match m, uts_player p, uts_games g
+WHERE p.pid = '$pid' AND m.id = p.matchid AND m.gid = g.id ORDER BY time DESC LIMIT 0,50";
+$q_recent = mysql_query($sql_recent) or die(mysql_error());
+while ($r_recent = mysql_fetch_array($q_recent)) {
+
+ $r_time = mdate($r_recent[time]);
+ $r_mapfile = un_ut($r_recent[mapfile]);
+
+ echo'
+ <tr>
+ <td class="dark" align="center"><a class="darkid" href="./?p=match&mid='.$r_recent[id].'">'.$r_recent[id].'</a></td>
+ <td class="dark" align="center"><a class="darkhuman" href="./?p=match&mid='.$r_recent[id].'">'.$r_time.'</a></td>
+ <td class="grey" align="center">'.$r_recent[gamename].'</td>
+ <td class="grey" align="center">'.$r_mapfile.'</td>';
+ if (isset($is_admin) and $is_admin) echo '<td class="grey" align="center">'. $r_recent[ip].'</td>';
+
+ echo '</tr>';
+}
+
+echo'
+</tbody></table>
+';
+?>
diff --git a/html/pages/players_search.php b/html/pages/players_search.php new file mode 100755 index 0000000..1791393 --- /dev/null +++ b/html/pages/players_search.php @@ -0,0 +1,83 @@ +<?php
+
+function InvertSort($curr_field, $filter, $sort) {
+ if ($curr_field != $filter) return(($curr_field == "name") ? "ASC" : "DESC");
+ if ($sort == 'ASC') return('DESC');
+ return('ASC');
+}
+
+function SortPic($curr_field, $filter, $sort) {
+ if ($curr_field != $filter) return;
+ $fname = 'images/s_'. strtolower($sort) .'.png';
+ if (!file_exists($fname)) return;
+ return(' <img src="'. $fname .'" border="0" width="11" height="9" alt="" title="('.strtolower($sort).'ending)">');
+}
+
+// Get filter and set sorting
+$playername = my_stripslashes($_REQUEST[name]);
+$playersearch = my_addslashes($_REQUEST[name]);
+$filter = my_addslashes($_GET[filter]);
+$sort = my_addslashes($_GET[sort]);
+
+IF (empty($filter) or (!in_array(strtolower($filter), array("name", "games", "gamescore", "frags", "kills", "deaths", "suicides", "eff", "accuracy", "ttl", "gametime")))) {
+ $filter = "name";
+}
+
+if (empty($sort) or ($sort != 'ASC' and $sort != 'DESC')) $sort = ($filter == "name") ? "ASC" : "DESC";
+
+echo'
+<form NAME="playersearch" METHOD="post" ACTION="./?p=psearch">
+<div class="opnote">* Click headings to change Sorting *</div>
+<table class="box" border="0" cellpadding="1" cellspacing="1">
+ <tbody><tr>
+ <td class="heading" colspan="11" align="center">Player Search List</td>
+ </tr>
+ <tr>
+ <td class = "smheading" colspan = "12" ALIGN="center">Name Search:
+ <input TYPE="text" NAME="name" MAXLENGTH="35" SIZE="20" CLASS="searchform" VALUE="'.htmlentities($playername).'">
+ <input TYPE="submit" NAME="Default" VALUE="Search" CLASS="searchformb"></td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center" width="150"><a class="smheading" href="./?p=psearch&name='.urlencode($playername).'&filter=name&sort='.InvertSort('name', $filter, $sort).'">Player Name</a>'.SortPic('name', $filter, $sort).'</td>
+ <td class="smheading" align="center" width="45"><a class="smheading" href="./?p=psearch&name='.urlencode($playername).'&filter=games&sort='.InvertSort('games', $filter, $sort).'">Matches</a>'.SortPic('games', $filter, $sort).'</td>
+ <td class="smheading" align="center" width="50"><a class="smheading" href="./?p=psearch&name='.urlencode($playername).'&filter=gamescore&sort='.InvertSort('gamescore', $filter, $sort).'">Score</a>'.SortPic('gamescore', $filter, $sort).'</td>
+ <td class="smheading" align="center" width="50"><a class="smheading" href="./?p=psearch&name='.urlencode($playername).'&filter=frags&sort='.InvertSort('frags', $filter, $sort).'">Frags</a>'.SortPic('frags', $filter, $sort).'</td>
+ <td class="smheading" align="center" width="50"><a class="smheading" href="./?p=psearch&name='.urlencode($playername).'&filter=kills&sort='.InvertSort('kills', $filter, $sort).'">Kills</a>'.SortPic('kills', $filter, $sort).'</td>
+ <td class="smheading" align="center" width="50"><a class="smheading" href="./?p=psearch&name='.urlencode($playername).'&filter=deaths&sort='.InvertSort('deaths', $filter, $sort).'">Deaths</a>'.SortPic('deaths', $filter, $sort).'</td>
+ <td class="smheading" align="center" width="50"><a class="smheading" href="./?p=psearch&name='.urlencode($playername).'&filter=suicides&sort='.InvertSort('suicides', $filter, $sort).'">Suicides</a>'.SortPic('suicides', $filter, $sort).'</td>
+ <td class="smheading" align="center" width="45"><a class="smheading" href="./?p=psearch&name='.urlencode($playername).'&filter=eff&sort='.InvertSort('eff', $filter, $sort).'">Eff.</a>'.SortPic('eff', $filter, $sort).'</td>
+ <td class="smheading" align="center" width="45"><a class="smheading" href="./?p=psearch&name='.urlencode($playername).'&filter=accuracy&sort='.InvertSort('accuracy', $filter, $sort).'">Acc.</a>'.SortPic('accuracy', $filter, $sort).'</td>
+ <td class="smheading" align="center" width="45"><a class="smheading" href="./?p=psearch&name='.urlencode($playername).'&filter=ttl&sort='.InvertSort('ttl', $filter, $sort).'">TTL</a>'.SortPic('ttl', $filter, $sort).'</td>
+ <td class="smheading" align="center" width="45"><a class="smheading" href="./?p=psearch&name='.urlencode($playername).'&filter=gametime&sort='.InvertSort('gametime', $filter, $sort).'">Hours</a>'.SortPic('gametime', $filter, $sort).'</td>
+ </tr>';
+
+$sql_plist = "SELECT pi.name AS name, pi.country AS country, p.pid, COUNT(p.id) AS games, SUM(p.gamescore) as gamescore, SUM(p.frags) AS frags, SUM(p.kills) AS kills,
+SUM(p.deaths) AS deaths, SUM(p.suicides) as suicides, AVG(p.eff) AS eff, AVG(p.accuracy) AS accuracy, AVG(p.ttl) AS ttl, SUM(gametime) as gametime
+FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND pi.name LIKE '%".$playersearch."%' AND pi.banned <> 'Y' GROUP BY name ORDER BY $filter $sort";
+
+$q_plist = mysql_query($sql_plist) or die(mysql_error());
+while ($r_plist = mysql_fetch_array($q_plist)) {
+
+ $gametime = sec2hour($r_plist[gametime]);
+ $eff = get_dp($r_plist[eff]);
+ $acc = get_dp($r_plist[accuracy]);
+ $ttl = GetMinutes($r_plist[ttl]);
+
+ echo'
+ <tr>
+ <td nowrap class="dark" align="left"><a class="darkhuman" href="./?p=pinfo&pid='.$r_plist['pid'].'">'.FormatPlayerName($r_plist[country], $r_plist['pid'], $r_plist[name]).'</a></td>
+ <td class="grey" align="center">'.$r_plist[games].'</td>
+ <td class="grey" align="center">'.$r_plist[gamescore].'</td>
+ <td class="grey" align="center">'.$r_plist[frags].'</td>
+ <td class="grey" align="center">'.$r_plist[kills].'</td>
+ <td class="grey" align="center">'.$r_plist[deaths].'</td>
+ <td class="grey" align="center">'.$r_plist[suicides].'</td>
+ <td class="grey" align="center">'.$eff.'</td>
+ <td class="grey" align="center">'.$acc.'</td>
+ <td class="grey" align="center">'.$ttl.'</td>
+ <td class="grey" align="center">'.$gametime.'</td>
+ </tr>';
+}
+echo'
+</tbody></table></form>';
+?>
\ No newline at end of file diff --git a/html/pages/rank.php b/html/pages/rank.php new file mode 100755 index 0000000..6eacca0 --- /dev/null +++ b/html/pages/rank.php @@ -0,0 +1,56 @@ +<?php
+$sql_rgame = "SELECT DISTINCT(p.gid), g.name FROM uts_player AS p, uts_games AS g WHERE p.gid = g.id ORDER BY g.name ASC";
+$q_rgame = mysql_query($sql_rgame) or die(mysql_error());
+while ($r_rgame = mysql_fetch_array($q_rgame)) {
+
+ echo'
+ <table class="box" border="0" cellpadding="1" cellspacing="1">
+ <tbody>
+ <tr>
+ <td class="heading" colspan="4" align="center">Top 10 '.$r_rgame['name'].' Players</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center" width="75">N°</td>
+ <td class="smheading" align="center" width="150">Player Name</td>
+ <td class="smheading" align="center" width="75">Rank</td>
+ <td class="smheadingx" align="center" width="75">Matches</td>
+ </tr>
+ ';
+
+ $ranking = 0;
+
+ $sql_rplayer = "SELECT pi.id AS pid, pi.name, pi.country, r.rank, r.prevrank, r.matches FROM uts_rank AS r, uts_pinfo AS pi WHERE r.pid = pi.id AND r.gid = '$r_rgame[gid]' AND pi.banned <> 'Y' ORDER BY r.rank DESC LIMIT 0,10";
+ $q_rplayer = mysql_query($sql_rplayer) or die(mysql_error());
+ if (mysql_num_rows($q_rplayer) == 0) {
+ echo '
+ <tr>
+ <td class="grey" align="center" colspan = "4">No players entered the rankings yet.</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center" colspan="4"> </td>
+ </tr>
+ </tbody></table><br>';
+
+ }
+ else {
+ while ($r_rplayer = mysql_fetch_array($q_rplayer)) {
+
+ $ranking++;
+ $myurl = urlencode($r_rplayer[name]);
+
+ echo'
+ <tr>
+ <td class="grey" align="center">'.$ranking.'</td>
+ <td nowrap class="dark" align="left"><a class="darkhuman" href="./?p=pinfo&pid='.$r_rplayer[pid].'">'.FlagImage($r_rplayer[country]).' '.htmlspecialchars($r_rplayer[name], ENT_QUOTES) .' '. RankMovement($r_rplayer['rank'] - $r_rplayer['prevrank']).'</a></td>
+ <td class="dark" align="center">'.get_dp($r_rplayer[rank]).'</td>
+ <td class="grey" align="center">'.$r_rplayer[matches].'</td>
+ </tr>';
+ }
+ echo'
+ <tr>
+ <td class="smheading" align="center" colspan="4"><a href="./?p=ext_rank&gid='.$r_rgame[gid].'">Click Here To See All The Rankings</a></td>
+ </tr>
+ </tbody></table><br>';
+ }
+}
+?>
\ No newline at end of file diff --git a/html/pages/rank_extended.php b/html/pages/rank_extended.php new file mode 100755 index 0000000..b41baf2 --- /dev/null +++ b/html/pages/rank_extended.php @@ -0,0 +1,75 @@ +<?php
+$gid = my_addslashes($_GET['gid']);
+
+$r_gamename = small_query("SELECT name FROM uts_games WHERE id = '$gid'");
+$gamename = $r_gamename['name'];
+
+$r_pcount = small_query("SELECT COUNT(*) as pcount FROM uts_rank WHERE gid= '$gid'");
+$pcount = $r_pcount['pcount'];
+
+$ecount = $pcount/25;
+$ecount2 = number_format($ecount, 0, '.', '');
+
+IF($ecount > $ecount2) {
+ $ecount2 = $ecount2+1;
+}
+
+$fpage = 0;
+IF($ecount < 1) { $lpage = 0; }
+else { $lpage = $ecount2-1; }
+
+$cpage = $_GET["page"];
+IF ($cpage == "") { $cpage = "0"; }
+$qpage = $cpage*25;
+
+$tfpage = $cpage+1;
+$tlpage = $lpage+1;
+
+$ppage = $cpage-1;
+$ppageurl = "<a class=\"pages\" href=\"./?p=ext_rank&gid=$gid&page=$ppage\">[Previous]</a>";
+IF ($ppage < "0") { $ppageurl = "[Previous]"; }
+
+$npage = $cpage+1;
+$npageurl = "<a class=\"pages\" href=\"./?p=ext_rank&gid=$gid&page=$npage\">[Next]</a>";
+IF ($npage >= "$ecount") { $npageurl = "[Next]"; }
+
+$fpageurl = "<a class=\"pages\" href=\"./?p=ext_rank&gid=$gid&page=$fpage\">[First]</a>";
+IF ($cpage == "0") { $fpageurl = "[First]"; }
+
+$lpageurl = "<a class=\"pages\" href=\"./?p=ext_rank&gid=$gid&page=$lpage\">[Last]</a>";
+IF ($cpage == "$lpage") { $lpageurl = "[Last]"; }
+
+echo'
+<div class="pages"><b>Page ['.$tfpage.'/'.$tlpage.'] Selection: '.$fpageurl.' / '.$ppageurl.' / '.$npageurl.' / '.$lpageurl.'</b></div>
+<table class="box" border="0" cellpadding="1" cellspacing="1">
+ <tbody>
+ <tr>
+ <td class="heading" colspan="4" align="center">'.$gamename.' Ranking Players</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center" width="75">N°</td>
+ <td class="smheading" align="center" width="150">Player Name</td>
+ <td class="smheading" align="center" width="75">Rank</td>
+ <td class="smheadingx" align="center" width="75">Matches</td>
+ </tr>';
+
+ $ranking = $qpage;
+
+ $sql_rplayer = "SELECT pi.name, pi.country, r.rank, r.prevrank, r.matches, r.pid FROM uts_rank AS r, uts_pinfo AS pi WHERE r.pid = pi.id AND r.gid = '$gid' AND pi.banned <> 'Y' ORDER BY rank DESC LIMIT $qpage,25";
+ $q_rplayer = mysql_query($sql_rplayer) or die(mysql_error());
+ while ($r_rplayer = mysql_fetch_array($q_rplayer)) {
+
+ $ranking++;
+ echo'
+ <tr>
+ <td class="grey" align="center">'.$ranking.'</td>
+ <td nowrap class="dark" align="left"><a class="darkhuman" href="./?p=pinfo&pid='.$r_rplayer['pid'].'">'.FlagImage($r_rplayer[country]).' '.htmlspecialchars($r_rplayer[name]) .' '. RankMovement($r_rplayer['rank'] - $r_rplayer['prevrank']) .'</a></td>
+ <td class="dark" align="center">'.get_dp($r_rplayer[rank]).'</td>
+ <td class="grey" align="center">'.$r_rplayer[matches].'</td>
+ </tr>';
+
+}
+echo'
+</tbody></table>
+<div class="pages"><b>Page ['.$tfpage.'/'.$tlpage.'] Selection: '.$fpageurl.' / '.$ppageurl.' / '.$npageurl.' / '.$lpageurl.'</b></div>';
+?>
\ No newline at end of file diff --git a/html/pages/recent.php b/html/pages/recent.php new file mode 100755 index 0000000..92fafb7 --- /dev/null +++ b/html/pages/recent.php @@ -0,0 +1,137 @@ +<?php
+// Firstly we need to work out First Last Next Prev pages
+$where = ' ';
+$year = !empty($_REQUEST['year']) ? my_addslashes(sprintf("%04d", $_REQUEST['year'])) : 0;
+$month = !empty($_REQUEST['month']) ? my_addslashes(sprintf("%02d", $_REQUEST['month'])) : 0;
+$day = !empty($_REQUEST['day']) ? my_addslashes(sprintf("%02d", $_REQUEST['day'])) : 0;
+$gid = !empty($_REQUEST['gid']) ? my_addslashes($_REQUEST['gid']) : 0;
+
+if (!empty($year) and empty($month) and empty($day)) $where .= " AND m.time LIKE '$year%'";
+if (!empty($year) and !empty($month) and empty($day)) $where .= " AND m.time LIKE '$year$month%'";
+if (!empty($year) and !empty($month) and !empty($day)) $where .= " AND m.time LIKE '$year$month$day%'";
+if (!empty($gid)) $where .= " AND m.gid = '$gid'";
+$r_mcount = small_query("SELECT COUNT(*) AS result FROM uts_match m WHERE 1 $where");
+$mcount = $r_mcount['result'];
+
+$ecount = $mcount/25;
+$ecount2 = number_format($ecount, 0, '.', '');
+
+IF($ecount > $ecount2) {
+ $ecount2 = $ecount2+1;
+}
+
+$fpage = 0;
+IF($ecount < 1) { $lpage = 0; }
+else { $lpage = $ecount2-1; }
+
+$cpage = preg_replace('/\D/', '', $_REQUEST["page"]);
+IF ($cpage == "") { $cpage = "0"; }
+$qpage = $cpage*25;
+
+$tfpage = $cpage+1;
+$tlpage = $lpage+1;
+
+$ppage = $cpage-1;
+$ppageurl = "<a class=\"pages\" href=\"./?p=recent&year=$year&month=$month&day=$day&gid=$gid&page=$ppage\">[Previous]</a>";
+IF ($ppage < "0") { $ppageurl = "[Previous]"; }
+
+$npage = $cpage+1;
+$npageurl = "<a class=\"pages\" href=\"./?p=recent&year=$year&month=$month&day=$day&gid=$gid&page=$npage\">[Next]</a>";
+IF ($npage >= "$ecount") { $npageurl = "[Next]"; }
+
+$fpageurl = "<a class=\"pages\" href=\"./?p=recent&year=$year&month=$month&day=$day&gid=$gid&page=$fpage\">[First]</a>";
+IF ($cpage == "0") { $fpageurl = "[First]"; }
+
+$lpageurl = "<a class=\"pages\" href=\"./?p=recent&year=$year&month=$month&day=$day&gid=$gid&page=$lpage\">[Last]</a>";
+IF ($cpage == "$lpage") { $lpageurl = "[Last]"; }
+
+echo '
+<form action="'.$_SERVER['PHP_SELF'].'" method="GET">
+<div class="pages"><b>Page ['.$tfpage.'/'.$tlpage.'] Selection: '.$fpageurl.' / '.$ppageurl.' / '.$npageurl.' / '.$lpageurl.'</b></div>
+<table width="720" class="box" border="0" cellpadding="1" cellspacing="1">
+ <tbody><tr>
+ <td class="heading" colspan="7" align="center">Unreal Tournament Match List</td>
+ </tr>';
+
+echo '
+ <tr>
+ <td class = "smheading" colspan = "7" align = "center">';
+echo '<input type="hidden" name="p" value="'.$_REQUEST['p'].'">';
+echo '<table width="700" class="searchform" border="0" cellpadding="1" cellspacing="1">';
+echo '<tr><td><strong>Filter:</strong></td>';
+//echo '<td>Date:</td>';
+echo '<td><select class="searchform" name="year">';
+echo '<option value="0">*</option>';
+for($i = date('Y');$i >= date("Y") - 5; $i--) {
+ $selected = ($year == $i) ? 'selected' : '';
+ echo '<option '.$selected.' value="'.$i.'">'.$i.'</option>';
+}
+echo '</select>';
+echo ' ';
+echo '<select class="searchform" name="month">';
+echo '<option value="0">*</option>';
+$monthname = array('', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
+for($i = 1;$i <= 12; $i++) {
+ $selected = ($month == $i) ? 'selected' : '';
+ echo '<option '.$selected.' value="'.$i.'">'.$monthname[$i].'</option>';
+}
+echo '</select>';
+echo ' ';
+echo '<select class="searchform" name="day">';
+echo '<option value="0">*</option>';
+for($i = 1;$i <= 31; $i++) {
+ $selected = ($day == $i) ? 'selected' : '';
+ echo '<option '.$selected.' value="'.$i.'">'.$i.'</option>';
+}
+echo '</select></td>';
+
+echo '<td>Gametype:</td>';
+echo '<td><select class="searchform" name="gid">';
+echo '<option value="0">*</option>';
+$sql_game = "SELECT DISTINCT(p.gid), g.name FROM uts_player AS p, uts_games AS g WHERE p.gid = g.id ORDER BY g.name ASC";
+$q_game = mysql_query($sql_game) or die(mysql_error());
+while ($r_game = mysql_fetch_array($q_game)) {
+ $selected = ($r_game['gid'] == $gid) ? 'selected' : '';
+ echo '<option '.$selected.' value="'.$r_game['gid'].'">'. $r_game['name'] .'</option>';
+}
+echo '</select></td>';
+echo '<td><input class="searchform" type="Submit" name="filter" value="Apply"></td>';
+echo '</tr></table>';
+echo '</td></tr>';
+
+echo '
+ <tr>
+ <td class="smheading" align="center" width="80">Match ID</td>
+ <td class="smheading" align="center" width="220">Date/Time</td>
+ <td class="smheading" align="center" width="140">Match Type</td>
+ <td class="smheading" align="center">Map</td>
+ <td class="smheading" align="center" width="60">Time</td>
+ <td class="smheading" align="center" width="60">Players</td>
+ </tr>';
+
+$sql_recent = "SELECT m.id, m.time, g.name AS gamename, m.mapfile, m.gametime, (SELECT count(p.id) FROM uts_player AS p WHERE m.id = p.matchid) as players FROM uts_match AS m, uts_games AS g WHERE g.id = m.gid $where ORDER BY m.time DESC LIMIT $qpage,25";
+$q_recent = mysql_query($sql_recent) or die(mysql_error());
+while ($r_recent = mysql_fetch_array($q_recent)) {
+
+ $r_time = mdate($r_recent[time]);
+ $r_mapfile = un_ut($r_recent[mapfile]);
+ $r_gametime = GetMinutes($r_recent[gametime]);
+
+ echo'
+ <tr>
+ <td class="dark" align="center"><a class="darkid" href="./?p=match&mid='.$r_recent[id].'">'.$r_recent[id].'</a></td>
+ <td nowrap class="dark" align="center"><a class="darkhuman" href="./?p=match&mid='.$r_recent[id].'">'.$r_time.'</a></td>
+ <td nowrap class="grey" align="center">'.$r_recent[gamename].'</td>
+ <td class="grey" align="center">'.$r_mapfile.'</td>
+ <td class="grey" align="center">'.$r_gametime.'</td>
+ <td class="grey" align="center">'.$r_recent[players].'</td>
+ </tr>';
+}
+
+
+
+echo '
+</tbody></table>
+<div class="pages"><b>Page ['.$tfpage.'/'.$tlpage.'] Selection: '.$fpageurl.' / '.$ppageurl.' / '.$npageurl.' / '.$lpageurl.'</b></div>
+</form>';
+?>
\ No newline at end of file diff --git a/html/pages/report.php b/html/pages/report.php new file mode 100755 index 0000000..946b847 --- /dev/null +++ b/html/pages/report.php @@ -0,0 +1,24 @@ +<?php
+$id = preg_replace('/\D/', '', $_GET["id"]);
+$wid = preg_replace('/\D/', '', $_GET["wid"]);
+$stage = my_addslashes($_GET["stage"]);
+$oururl = $_SERVER["HTTP_HOST"].$_SERVER["PHP_SELF"];
+$oururl = str_replace("index.php", "", $oururl);
+$rtype = my_addslashes($_GET["rtype"]);
+
+if (empty($id)) {
+ die("No ID given");
+}
+
+IF ($rtype == "clanbase") {
+ include("pages/report_cb.php");
+}
+
+IF ($rtype == "bbcode") {
+ include("pages/report/bbcode.php");
+}
+
+IF ($rtype == "clanbase" && $stage == "generate") {
+ include("pages/report/clanbase.php");
+}
+?>
\ No newline at end of file diff --git a/html/pages/report/bbcode.php b/html/pages/report/bbcode.php new file mode 100755 index 0000000..e07aa91 --- /dev/null +++ b/html/pages/report/bbcode.php @@ -0,0 +1,424 @@ +<?php
+echo'<textarea rows="50" name="cbrep" cols="75">';
+
+$id = preg_replace('/\D/', '', $_GET[id]);
+
+if (empty($id)) {
+ die("No ID given");
+}
+
+$sql_s = small_query("SELECT mapfile, gametime FROM uts_match WHERE id = '$id'");
+
+$map = str_replace(".unr", "", "$sql_s[mapfile]");
+$mappic = strtolower("images/maps/".$map.".jpg");
+$actgamelength = $sql_s[gametime];
+
+// Lets work out what kind of game this was from the scores
+
+$q_score = small_query("SELECT t0score, t1score FROM uts_match WHERE id = $id");
+$t0score = $q_score[t0score];
+$t1score = $q_score[t1score];
+
+$teama = "Red Team";
+$teamb = "Blue Team";
+
+IF ($t0score > $t1score) {
+
+ $twin = 0;
+ $twin_team = $teama;
+ $twin_score = $t0score;
+
+ $tlose = 1;
+ $tlose_team = $teamb;
+ $tdraw = "0";
+
+ $tdiff = $t0score+$t1score;
+
+ IF ($tdiff <= 3) {
+ $reptype = "low";
+ } elseIF ($tdiff >= 9) {
+ $reptype = "high";
+ } else {
+ $reptype = "medium";
+ }
+
+} elseIF ($t0score < $t1score) {
+ $twin = 1;
+ $twin_team = $teamb;
+ $twin_score = $t1score;
+
+ $tlose = 0;
+ $tlose_team = $teama;
+ $tdraw = "0";
+
+ $tdiff = $t1score+$t0score;
+
+ IF ($tdiff <= 2) {
+ $reptype = "low";
+ } elseIF ($tdiff >= 9) {
+ $reptype = "high";
+ } else {
+ $reptype = "medium";
+ }
+
+} else {
+ $twin = "0";
+ $tlose = "1";
+ $tdraw = "1";
+
+ $tdiff = $t1score+$t0score;
+ $twin_team = $teama;;
+ $tlose_team = $teamb;
+
+ IF ($tdiff <= 4) {
+ $reptype = "low";
+ } elseIF ($tdiff >= 10) {
+ $reptype = "high";
+ } else {
+ $reptype = "medium";
+ }
+}
+
+// Queries used within the report
+
+// First blood
+$q_fblood = small_query("SELECT firstblood FROM uts_match WHERE id = $id");
+
+// Player id of first blood
+$t_fblood = small_query("SELECT name FROM uts_pinfo WHERE id = '".$q_fblood[firstblood]."'");
+$t_fbloodid = small_query("SELECT id FROM uts_player WHERE pid = '".$q_fblood[firstblood]."' AND matchid = $id");
+$r_fbloodid = $t_fbloodid[id];
+$r_fbloodname = $t_fblood[name];
+
+// Belt count
+$q_t0bcount = small_query("SELECT SUM(pu_belt) AS bcount FROM uts_player WHERE matchid = $id AND team = 0 AND pu_belt >0");
+$q_t1bcount = small_query("SELECT SUM(pu_belt) AS bcount FROM uts_player WHERE matchid = $id AND team = 1 AND pu_belt >0");
+
+// Amp count
+$q_t0acount = small_query("SELECT SUM(pu_amp) AS acount FROM uts_player WHERE matchid = $id AND team = 0 AND pu_amp >0");
+$q_t1acount = small_query("SELECT SUM(pu_amp) AS acount FROM uts_player WHERE matchid = $id AND team = 1 AND pu_amp >0");
+
+// Cap count
+$q_capsa = small_query("SELECT pi.name, SUM(p.flag_capture) AS flag_caps FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id AND team = 0 AND flag_capture >= 1 GROUP BY name");
+$q_capsb = small_query("SELECT pi.name, SUM(p.flag_capture) AS flag_caps FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id AND team = 1 AND flag_capture >= 1 GROUP BY name");
+
+// Most Flag Grabs (W)
+$q_topgrab = small_query("SELECT p.id, pi.name, p.flag_taken FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id AND team = $twin ORDER BY flag_taken DESC LIMIT 0,1");
+$r_topgrabid = $q_topgrab[id];
+$r_topgrabname = $q_topgrab[name];
+
+// Most Flag Grabs (L)
+$q_topgrabl = small_query("SELECT p.id, pi.name, p.flag_taken FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id AND team = $tlose ORDER BY flag_taken DESC LIMIT 0,1");
+$r_topgrabidl = $q_topgrabl[id];
+$r_topgrabnamel = $q_topgrabl[name];
+
+// Most Flag Grabs (D)
+$q_topgrabd = small_query("SELECT p.id, pi.name, p.flag_taken, team FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id ORDER BY flag_taken DESC LIMIT 0,1");
+$r_topgrabidd = $q_topgrabd[id];
+$r_topgrabnamed = $q_topgrabd[name];
+
+IF ($redteam == $q_topgrabd[team]) {
+ $r_topgrabteamd = $warinfo[0][2];
+ $r_topgrabteamdid = $warinfo[0][1];
+} else {
+ $r_topgrabteamd = $warinfo[1][2];
+ $r_topgrabteamdid = $warinfo[1][1];
+}
+
+
+// Most Flag Covers (W)
+$q_topcover = small_query("SELECT p.id, pi.name, p.flag_cover FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id AND team = $twin ORDER BY flag_cover DESC LIMIT 0,1");
+$r_topcoverid = $q_topcover[id];
+$r_topcovername = $q_topcover[name];
+
+// Most Flag Covers (L)
+$q_topcoverl = small_query("SELECT p.id, pi.name, p.flag_cover FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id AND team = $tlose ORDER BY flag_cover DESC LIMIT 0,1");
+$r_topcoverlid = $q_topcoverl[id];
+$r_topcoverlname = $q_topcoverl[name];
+
+// Most Flag Covers (R)
+$q_topcoverr = small_query("SELECT p.id, pi.name, p.flag_cover FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id AND team = 0 ORDER BY flag_cover DESC LIMIT 0,1");
+$r_topcoverrid = $q_topcoverr[id];
+$r_topcoverrname = $q_topcoverr[name];
+
+// Most Flag Covers (B)
+$q_topcoverb = small_query("SELECT p.id, pi.name, p.flag_cover FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id AND team = 1 ORDER BY flag_cover DESC LIMIT 0,1");
+$r_topcoverbid = $q_topcoverb[id];
+$r_topcoverbname = $q_topcoverb[name];
+
+// Most Flag Assists (D)
+$q_topassistd = small_query("SELECT p.id, pi.name, p.flag_assist, team FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id ORDER BY flag_cover DESC LIMIT 0,1");
+$r_topassistdid = $q_topassistd[id];
+$r_topassistdname = $q_topassistd[name];
+
+IF ($q_topassistd[team] == $redteam) {
+ $r_topassistdteam = $teamb;
+} else {
+ $r_topassistdteam = $teama;
+}
+
+// Most Flag Seals (W)
+$q_topseal = small_query("SELECT p.id, pi.name, p.flag_seal FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id AND team = $twin ORDER BY flag_seal DESC LIMIT 0,1");
+$r_topsealid = $q_topseal[id];
+$r_topsealname = $q_topseal[name];
+
+// Most Flag Seals (L)
+$q_topseall = small_query("SELECT p.id, pi.name, p.flag_seal FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id AND team = $tlose ORDER BY flag_seal DESC LIMIT 0,1");
+$r_topseallid = $q_topseall[id];
+$r_topseallname = $q_topseall[name];
+
+// Top Capper (W)
+$q_topcap = small_query("SELECT p.id, pi.name, p.flag_capture FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id AND team = $twin ORDER BY flag_capture DESC LIMIT 0,1");
+$r_topcapid = $q_topcap[id];
+$r_topcapname = $q_topcap[name];
+
+// Top Capper (D)
+$q_topcapd = small_query("SELECT p.id, pi.name, p.flag_capture FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id ORDER BY flag_capture DESC LIMIT 0,1");
+$r_topcapdid = $q_topcap[id];
+$r_topcapdname = $q_topcap[name];
+
+// Most Flag Kills (L)
+$q_topdefl = small_query("SELECT p.id, pi.name, p.flag_kill FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id AND team = $tlose ORDER BY flag_kill DESC LIMIT 0,1");
+$r_topdeflid = $q_topdefl[id];
+$r_topdeflname = $q_topdefl[name];
+
+// Most Flag Kills (W)
+$q_topfkill = small_query("SELECT p.id, pi.name, p.flag_kill FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id AND team = $twin ORDER BY flag_kill DESC LIMIT 0,1");
+$r_topfkillid = $q_topfkill[id];
+$r_topfkillname = $q_topfkill[name];
+
+// 2nd Most Flag Kills (W)
+$q_topfkill2 = small_query("SELECT p.id, pi.name, p.flag_kill FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id AND team = $twin ORDER BY flag_kill DESC LIMIT 1,1");
+$r_topfkillid2 = $q_topfkill2[id];
+$r_topfkillname2 = $q_topfkill2[name];
+
+// Most Frags (D)
+$q_topfrag = small_query("SELECT p.id, pi.name, p.frags FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id ORDER BY frags DESC LIMIT 0,1");
+$r_topfragid = $q_topfrag[id];
+$r_topfragname = $q_topfrag[name];
+
+// Most Frags (W)
+$q_topfragw = small_query("SELECT p.id, pi.name, p.frags FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id AND team = $twin ORDER BY frags DESC LIMIT 0,1");
+$r_topfragwid = $q_topfkill2[id];
+$r_topfragwname = $q_topfkill2[name];
+
+// Most Deaths (L)
+$q_topdeath = small_query("SELECT p.id, pi.name, p.deaths FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id AND team = $tlose ORDER BY deaths DESC LIMIT 0,1");
+$r_topdeathid = $q_topdeath[id];
+$r_topdeathname = $q_topdeath[name];
+
+// Player of the Match
+$q_topstats = small_query("SELECT p.id, pi.name, p.rank AS prank FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id GROUP BY id, name ORDER BY prank DESC LIMIT 0,1");
+$r_topstatsid = $q_topstats[id];
+$r_topstatsname = $q_topstats[name];
+
+
+// Write the top of the report (non game specific)
+
+//Player List for Red Team
+echo'[b]'.$teama.' Lineup[/b]
+';
+
+$sql_rplayer = "SELECT p.id, pi.name FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id AND team = 0 ORDER BY pi.name ASC";
+$q_rplayer = mysql_query($sql_rplayer);
+while ($r_rplayer = mysql_fetch_array($q_rplayer)) {
+
+ echo''.$r_rplayer[name].'
+';
+}
+
+//Player List for Blue Team
+
+echo'
+[b]'.$teamb.' Lineup[/b]
+';
+
+$sql_bplayer = "SELECT p.id, pi.name FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id AND team = 1 ORDER BY pi.name ASC";
+$q_bplayer = mysql_query($sql_bplayer);
+while ($r_bplayer = mysql_fetch_array($q_bplayer)) {
+
+ echo''.$r_bplayer[name].'
+';
+}
+
+// Firstblood and Pickup stats
+
+echo '
+[b]Statistics[/b]
+First Blood: '.$r_fbloodname.'
+'.$teama.' Belts: '.$q_t0bcount[bcount].'
+'.$teamb.' Belts: '.$q_t1bcount[bcount].'
+'.$teama.' Amps: '.$q_t0acount[acount].'
+'.$teamb.' Amps: '.$q_t1acount[acount].'
+
+[b]Match Report[/b]
+';
+
+
+// Low Scores and a Draw
+IF ($reptype == "low" && $tdraw == 1) {
+echo'Neither team were better this map, scorline is proof of this.
+[cl]'.$r_topgrabteamdid.','.$r_topgrabteamd.'[/cl] had the most chances to cap with '.$r_topgrabnamed.' taking the flag '.$q_topgrabd[flag_taken].' times, but unfortuantely couldnt cap as many as he took.
+
+Big credit to both teams defences; ';
+
+IF ($q_topdefl[flag_kill] >= $q_topfkill[flag_kill]) {
+ echo ''.$r_topdeflname.' defended the flag and got '.$q_topdefl[flag_kill].' flagkills while '.$r_topfkillname.' also had a pretty nice defensive game killing '.$q_topfkill[flag_kill].' flag carriers.
+ ';
+} else {
+ echo ''.$r_topfkillname.' defended the flag and got '.$q_topfkill[flag_kill].' flagkills while '.$r_topdeflname.' also had a pretty nice defensive game killing '.$q_topdefl[flag_kill].' flag carriers.
+ ';
+}
+
+echo'Seems the attackers had a frustrating game on this map, credit to ';
+
+IF ($q_topcover[flag_cover] >= $q_topcoverl[flag_cover]) {
+ echo ''.$r_topcovername.' for covering his flag carrier '.$q_topcover[flag_cover].' times and also '.$r_topcoverlname.' for covering '.$q_topcoverl[flag_cover].' times.
+ ';
+} else {
+ echo ''.$r_topcoverlname.' for covering his flag carrier '.$q_topcoverl[flag_cover].' times and also '.$r_topcovername.' for covering '.$q_topcover[flag_cover].' times.
+ ';
+}
+
+echo'Well done '.$r_topfragname.' for ensuring a tight scoreline with '.$q_topfrag[frags].' frags.
+If this map would be played again between these two clans, we might see a change of strategy in the attacking play, but the defenders were strong on both sides this time.
+
+Good game.
+Stats player of the map was '.$r_topstatsname.' with '.$q_topstats[prank].' stat points.
+Well played both teams.';
+}
+
+// Medium Scores and a Draw
+IF ($reptype == "medium" && $tdraw == 1) {
+echo'An excitingly close game with neither side having the upper hand.
+Both clans teamplay was about even and the result shows that it could have easily gone either way.
+
+Capping opportunities came along time after time, with [cl]'.$r_topgrabid.','.$r_topgrabname.'[/cl] taking the flag '.$q_topgrab[flag_taken].' times and at the other end [cl]'.$r_topgrabidl.','.$r_topgrabnamel.'[/cl] taking the flag '.$q_topgrabl[flag_taken].' times.
+
+Help was at hand for the flag runners with '.$teama.'\'s '.$r_topcoverrname.' covering '.$q_topcoverr[flag_cover].' times and '.$r_topcoverbname.' covering '.$q_topcoverb[flag_cover].' times for '.$teamb.'.
+
+Big credit to both teams defences; ';
+
+IF ($q_topdefl[flag_kill] >= $q_topfkill[flag_kill]) {
+ echo ''.$r_topdeflname.' defended the flag and got '.$q_topdefl[flag_kill].' flagkills while '.$r_topfkillname.' also had a pretty nice defensive game killing '.$q_topfkill[flag_kill].' flag carriers.
+ ';
+} else {
+ echo ''.$r_topfkillname.' defended the flag and got '.$q_topfkill[flag_kill].' flagkills while '.$r_topdeflname.' also had a pretty nice defensive game killing '.$q_topdefl[flag_kill].' flag carriers.
+ ';
+}
+
+echo'Both teams showed great teamplay and skill and the scoreline represents this.
+Two even lineups for this map.
+
+Well done '.$r_topfragname.' who had '.$q_topfrag[frags].' frags.
+
+Good game.
+Stats player of the map was '.$r_topstatsname.' with '.$q_topstats[prank].' stat points.
+Well played both teams.';
+}
+
+// High Scores and a Draw
+IF ($reptype == "high" && $tdraw == 1) {
+echo'A very very exciting, close CTF game Im sure both clans will agree.
+This high scoring draw proves that '.$teama.' and '.$teamb.' were evenly matched on this map.
+Teamplay and strategy enabled both teams to cap quite a few times.
+Well done to both teams attackers especially '.$r_topcapdname.' who capped '.$q_topcapd[flag_capture].' times.
+
+Capping opportunities came along time after time, with [cl]'.$r_topgrabid.','.$r_topgrabname.'[/cl] taking the flag '.$q_topgrab[flag_taken].' times and at the other end [cl]'.$r_topgrabidl.','.$r_topgrabnamel.'[/cl] taking the flag '.$q_topgrabl[flag_taken].' times.
+
+Help was at hand for the flag runners with '.$teama.'\'s '.$r_topcoverrname.' covering '.$q_topcoverr[flag_cover].' times and '.$r_topcoverbname.' covering '.$q_topcoverb[flag_cover].' times for '.$teamb.'.
+
+Although the defenders probably didnt have as good a game as the attackers on this map, credit should be awarded to ';
+
+IF ($q_topdefl[flag_kill] >= $q_topfkill[flag_kill]) {
+ echo ''.$r_topdeflname.' for killing '.$q_topdefl[flag_kill].' flag carriers and also to ';
+} else {
+ echo ''.$r_topfkillname.' for killing '.$q_topfkill[flag_kill].' flag carriers and also to ';
+}
+
+IF ($q_topseall[flag_seal] >= $q_topseal[flag_seal]) {
+ echo ''.$r_topseallname.' for sealing the base '.$q_topseall[flag_seal].' times for his flag carrier to cap.
+ <br >';
+} else {
+ echo ''.$r_topsealname.' for sealing the base '.$q_topseal[flag_seal].' times for his flag carrier to cap.
+ <br >';
+}
+
+echo' '.$r_topassistdname.' helped '.$r_topassistdteam.' get as many caps as they did by assisting '.$q_topassistd[flag_assist].' times in their caps.
+This shows great teamplay and cover, well played.
+
+Both teams showed great teamplay and skill and the scoreline represents this.
+Well done '.$r_topfragname.' who had '.$q_topfrag[frags].' frags.
+
+Good game.
+Stats player of the map was '.$r_topstatsname.' with '.$q_topstats[prank].' stat points.
+Well played both teams.';
+}
+
+// Low Scores and not a Draw
+IF ($reptype == "low" && $tdraw == 0) {
+echo 'Not very many caps in this close game, but '.$twin_team.' emerge victorious.
+
+Big credit to both teams defences; ';
+
+IF ($q_topdefl[flag_kill] >= $q_topfkill[flag_kill]) {
+ echo ''.$r_topdeflname.' defended the flag and got '.$q_topdefl[flag_kill].' flagkills while '.$r_topfkillname.' also had a pretty nice defensive game killing '.$q_topfkill[flag_kill].' flag carriers.
+ ';
+} else {
+ echo ''.$r_topfkillname.' defended the flag and got '.$q_topfkill[flag_kill].' flagkills while '.$r_topdeflname.' also had a pretty nice defensive game killing '.$q_topdefl[flag_kill].' flag carriers.
+ ';
+}
+
+echo 'Seems the attackers had a frustrating game on this map, especially [cl]'.$r_topgrabidl.','.$r_topgrabnamel.'[/cl] who took the flag '.$q_topgrabl[flag_taken].' and still lost the game :(
+
+Suportive play was made by '.$r_topcoverlname.' having '.$q_topcoverl[flag_cover].' covers, but even with covering play, the majority of the flags got returned and the game ended with '.$tlose_team.' losing out.
+
+Well done to '.$r_topcapname.' for capping '.$q_topcap[flag_capture].'.
+On other days the outcome could have been different.
+
+Good game and congratulations '.$twin_team.'.
+Stats player of the map was '.$r_topstatsname.' with '.$q_topstats[prank].' stat points.
+Well played both teams.';
+}
+
+// Medium Scores and not a Draw
+IF ($reptype == "medium" && $tdraw == 0) {
+echo 'A nice game of Capture the Flag took place this map with both teams trying hard to get flags back but only occasionally succeeding.
+
+'.$twin_team.' however managed to succesfully cap more than '.$tlose_team.' with big help from '.$r_topcapname.' who capped '.$q_topcap[flag_capture].'.
+'.$r_topgrabname.' made it hard for the '.$tlose_team.' defenders taking the flag a total of '.$q_topgrab[flag_taken].' times.
+Not to say that the defence was bad at all, '.$r_topdeflname.' got '.$q_topdefl[flag_kill].' flag kills and this made attacking hard work for '.$twin_team.'.
+
+Sealing off the base for '.$twin_team.' was some nice defence including '.$r_topsealname.' who sealed the base '.$q_topseal[flag_seal].' times.
+Covering the flag carrier for '.$twin_team.' mostly was '.$r_topcovername.' with '.$q_topcover[flag_cover].' covers.
+
+Attacking in vain at the other end of the map was '.$r_topgrabnamel.' who managed to take the '.$twin_team.' flag '.$q_topgrabl[flag_taken].' times, but unfortunately was unable to match the '.$twin_score.' caps made by '.$twin_team.'.
+'.$r_topgrabnamel.' was also up against some heavy defence including '.$r_topfkillname.' with '.$q_topfkill[flag_kill].' flag kills and '.$r_topfkillname2.' with '.$q_topfkill2[flag_kill].' flag kills.
+
+Good game and congratulations '.$twin_team.'.
+Stats player of the map was '.$r_topstatsname.' with '.$q_topstats[prank].' stat points.
+Well played both teams.';
+}
+
+// High Scores and not a Draw
+IF ($reptype == "high" && $tdraw == 0) {
+echo ''.$twin_team.' were victorious thanks to some nice capping by '.$r_topcapname.' who capped '.$q_topcap[flag_capture].' and '.$r_topgrabname.' who took the flag'.$q_topgrab[flag_taken].' times.
+
+'.$r_topcapname.' probably could not have done it without the help of '.$r_topcovername.' who had '.$q_topcover[flag_cover].' covers and '.$r_topsealname.' for sealing the base off '.$q_topseal[flag_seal].' times.
+
+Although the '.$tlose_team.' defenders played well, the '.$q_topdefl[flag_kill].' flag kills by '.$r_topdeflname.' was just not enough to stop the '.$twin_team.' attackers succeeding.
+Extra Credit should be given to '.$r_topfragwname.' for getting '.$q_topwfrag[frags].' frags.
+Some sympathy should be given to '.$r_topdeathname.' who died a whopping '.$q_topdeath[deaths].' times - unlucky!.
+
+All in all, this was a great attacking game for '.$twin_team.', but all players deserve credit for playing well.
+
+Good game and congratulations '.$twin_team.'.
+Stats player of the map was '.$r_topstatsname.' with '.$q_topstats[prank].' stat points.';
+}
+
+echo'
+
+This report was created with UTStats from the following game:
+[url]http://'.$oururl.'?p=match&mid='.$id.'[/url]
+</textarea>';
+?>
\ No newline at end of file diff --git a/html/pages/report/clanbase.php b/html/pages/report/clanbase.php new file mode 100755 index 0000000..6b7d412 --- /dev/null +++ b/html/pages/report/clanbase.php @@ -0,0 +1,530 @@ +<?php
+echo'<textarea rows="50" name="cbrep" cols="75">';
+
+$id = preg_replace('/\D/', '', $_GET[id]);
+
+if (empty($id)) {
+ die("No ID given");
+}
+
+function get_cbid($pid) {
+ $cbid = preg_replace('/\D/', '', $_GET[$pid]);
+ return $cbid;
+}
+$cbid = get_cbid;
+
+function get_cbnick($badtext) {
+ $badstuff = array("[","]");
+ $goodtext = str_replace($badstuff, " ", $badtext);
+ return $goodtext;
+}
+$cbnick = get_cbnick;
+
+$warinfo = get_clans($wid);
+
+$redteam = $_GET["red"];
+
+IF($redteam == $warinfo[0][1]) {
+ $teamaid = $warinfo[0][1];
+ $teambid = $warinfo[1][1];
+ $cbteama = $warinfo[0][2];
+ $cbteamb = $warinfo[1][2];
+ $redteam = 0;
+ $blueteam = 1;
+
+} else {
+ $teamaid = $warinfo[1][1];
+ $teambid = $warinfo[0][1];
+ $cbteama = $warinfo[1][2];
+ $cbteamb = $warinfo[0][2];
+ $redteam = 1;
+ $blueteam = 0;
+}
+
+$teama = str_replace("<img src=", "", $cbteama);
+$teamb = str_replace("<img src=", "", $cbteamb);
+
+list($teama, $teamacup) = split("'", $teama, 3);
+list($teamb, $teambcup) = split("'", $teamb, 3);
+
+$teama = '[cl]'.$teamaid.','.$teama.'[/cl]';
+$teamb = '[cl]'.$teambid.','.$teamb.'[/cl]';
+
+$sql_s = small_query("SELECT mapfile, gametime FROM uts_match WHERE id = '$id'");
+
+$map = str_replace(".unr", "", "$sql_s[mapfile]");
+$mappic = strtolower("images/maps/".$map.".jpg");
+$actgamelength = $sql_s[gametime];
+
+// Lets work out what kind of game this was from the scores
+
+$q_score = small_query("SELECT t0score, t1score FROM uts_match WHERE id = $id");
+$t0score = $q_score[t0score];
+$t1score = $q_score[t1score];
+
+IF ($t0score > $t1score) {
+
+ $twin = 0;
+ $twin_team = $teama;
+ $twin_score = $t0score;
+
+ $tlose = 1;
+ $tlose_team = $teamb;
+ $tdraw = "0";
+
+ $tdiff = $t0score+$t1score;
+
+ IF ($tdiff <= 3) {
+ $reptype = "low";
+ } elseIF ($tdiff >= 9) {
+ $reptype = "high";
+ } else {
+ $reptype = "medium";
+ }
+
+} elseIF ($t0score < $t1score) {
+ $twin = 1;
+ $twin_team = $teamb;
+ $twin_score = $t1score;
+
+ $tlose = 0;
+ $tlose_team = $teama;
+ $tdraw = "0";
+
+ $tdiff = $t1score+$t0score;
+
+ IF ($tdiff <= 2) {
+ $reptype = "low";
+ } elseIF ($tdiff >= 9) {
+ $reptype = "high";
+ } else {
+ $reptype = "medium";
+ }
+
+} else {
+ $twin = "0";
+ $tlose = "1";
+ $tdraw = "1";
+
+ $tdiff = $t1score+$t0score;
+ $twin_team = $teama;
+ $tlose_team = $teamb;
+
+ IF ($tdiff <= 4) {
+ $reptype = "low";
+ } elseIF ($tdiff >= 10) {
+ $reptype = "high";
+ } else {
+ $reptype = "medium";
+ }
+}
+
+// Queries used within the report
+
+// First blood
+$q_fblood = small_query("SELECT firstblood FROM uts_match WHERE id = $id");
+
+// Player id of first blood
+$t_fblood = small_query("SELECT name FROM uts_pinfo WHERE id = '".$q_fblood[firstblood]."'");
+$t_fbloodid = small_query("SELECT id FROM uts_player WHERE pid = '".$q_fblood[firstblood]."' AND matchid = $id");
+$r_fbloodid = $cbid($t_fbloodid[id]);
+$r_fbloodname = $cbnick($t_fblood[name]);
+
+// Belt count
+$q_t0bcount = small_query("SELECT SUM(pu_belt) AS bcount FROM uts_player WHERE matchid = $id AND team = 0 AND pu_belt >0");
+$q_t1bcount = small_query("SELECT SUM(pu_belt) AS bcount FROM uts_player WHERE matchid = $id AND team = 1 AND pu_belt >0");
+
+// Amp count
+$q_t0acount = small_query("SELECT SUM(pu_amp) AS acount FROM uts_player WHERE matchid = $id AND team = 0 AND pu_amp >0");
+$q_t1acount = small_query("SELECT SUM(pu_amp) AS acount FROM uts_player WHERE matchid = $id AND team = 1 AND pu_amp >0");
+
+// Cap count
+$q_capsa = small_query("SELECT pi.name, SUM(p.flag_capture) AS flag_caps FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id AND team = 0 AND flag_capture >= 1 GROUP BY name");
+$q_capsb = small_query("SELECT pi.name, SUM(p.flag_capture) AS flag_caps FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id AND team = 1 AND flag_capture >= 1 GROUP BY name");
+
+// Most Flag Grabs (W)
+$q_topgrab = small_query("SELECT p.id, pi.name, p.flag_taken FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id AND team = $twin ORDER BY flag_taken DESC LIMIT 0,1");
+$r_topgrabid = $cbid($q_topgrab[id]);
+$r_topgrabname = $cbnick($q_topgrab[name]);
+
+// Most Flag Grabs (L)
+$q_topgrabl = small_query("SELECT p.id, pi.name, p.flag_taken FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id AND team = $tlose ORDER BY flag_taken DESC LIMIT 0,1");
+$r_topgrabidl = $cbid($q_topgrabl[id]);
+$r_topgrabnamel = $cbnick($q_topgrabl[name]);
+
+// Most Flag Grabs (D)
+$q_topgrabd = small_query("SELECT p.id, pi.name, p.flag_taken, team FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id ORDER BY flag_taken DESC LIMIT 0,1");
+$r_topgrabidd = $cbid($q_topgrabd[id]);
+$r_topgrabnamed = $cbnick($q_topgrabd[name]);
+
+IF ($redteam == $q_topgrabd[team]) {
+ $r_topgrabteamd = $warinfo[0][2];
+ $r_topgrabteamdid = $warinfo[0][1];
+} else {
+ $r_topgrabteamd = $warinfo[1][2];
+ $r_topgrabteamdid = $warinfo[1][1];
+}
+
+
+// Most Flag Covers (W)
+$q_topcover = small_query("SELECT p.id, pi.name, p.flag_cover FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id AND team = $twin ORDER BY flag_cover DESC LIMIT 0,1");
+$r_topcoverid = $cbid($q_topcover[id]);
+$r_topcovername = $cbnick($q_topcover[name]);
+
+// Most Flag Covers (L)
+$q_topcoverl = small_query("SELECT p.id, pi.name, p.flag_cover FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id AND team = $tlose ORDER BY flag_cover DESC LIMIT 0,1");
+$r_topcoverlid = $cbid($q_topcoverl[id]);
+$r_topcoverlname = $cbnick($q_topcoverl[name]);
+
+// Most Flag Covers (R)
+$q_topcoverr = small_query("SELECT p.id, pi.name, p.flag_cover FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id AND team = 0 ORDER BY flag_cover DESC LIMIT 0,1");
+$r_topcoverrid = $cbid($q_topcoverr[id]);
+$r_topcoverrname = $cbnick($q_topcoverr[name]);
+
+// Most Flag Covers (B)
+$q_topcoverb = small_query("SELECT p.id, pi.name, p.flag_cover FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id AND team = 1 ORDER BY flag_cover DESC LIMIT 0,1");
+$r_topcoverbid = $cbid($q_topcoverb[id]);
+$r_topcoverbname = $cbnick($q_topcoverb[name]);
+
+// Most Flag Assists (D)
+$q_topassistd = small_query("SELECT p.id, pi.name, p.flag_assist, team FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id ORDER BY flag_cover DESC LIMIT 0,1");
+$r_topassistdid = $cbid($q_topassistd[id]);
+$r_topassistdname = $cbnick($q_topassistd[name]);
+
+IF ($q_topassistd[team] == $redteam) {
+ $r_topassistdteam = $teamb;
+} else {
+ $r_topassistdteam = $teama;
+}
+
+// Most Flag Seals (W)
+$q_topseal = small_query("SELECT p.id, pi.name, p.flag_seal FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id AND team = $twin ORDER BY flag_seal DESC LIMIT 0,1");
+$r_topsealid = $cbid($q_topseal[id]);
+$r_topsealname = $cbnick($q_topseal[name]);
+
+// Most Flag Seals (L)
+$q_topseall = small_query("SELECT p.id, pi.name, p.flag_seal FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id AND team = $tlose ORDER BY flag_seal DESC LIMIT 0,1");
+$r_topseallid = $cbid($q_topseall[id]);
+$r_topseallname = $cbnick($q_topseall[name]);
+
+// Top Capper (W)
+$q_topcap = small_query("SELECT p.id, pi.name, p.flag_capture FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id AND team = $twin ORDER BY flag_capture DESC LIMIT 0,1");
+$r_topcapid = $cbid($q_topcap[id]);
+$r_topcapname = $cbnick($q_topcap[name]);
+
+// Top Capper (D)
+$q_topcapd = small_query("SELECT p.id, pi.name, p.flag_capture FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id ORDER BY flag_capture DESC LIMIT 0,1");
+$r_topcapdid = $cbid($q_topcap[id]);
+$r_topcapdname = $cbnick($q_topcap[name]);
+
+// Most Flag Kills (L)
+$q_topdefl = small_query("SELECT p.id, pi.name, p.flag_kill FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id AND team = $tlose ORDER BY flag_kill DESC LIMIT 0,1");
+$r_topdeflid = $cbid($q_topdefl[id]);
+$r_topdeflname = $cbnick($q_topdefl[name]);
+
+// Most Flag Kills (W)
+$q_topfkill = small_query("SELECT p.id, pi.name, p.flag_kill FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id AND team = $twin ORDER BY flag_kill DESC LIMIT 0,1");
+$r_topfkillid = $cbid($q_topfkill[id]);
+$r_topfkillname = $cbnick($q_topfkill[name]);
+
+// 2nd Most Flag Kills (W)
+$q_topfkill2 = small_query("SELECT p.id, pi.name, p.flag_kill FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id AND team = $twin ORDER BY flag_kill DESC LIMIT 1,1");
+$r_topfkillid2 = $cbid($q_topfkill2[id]);
+$r_topfkillname2 = $cbnick($q_topfkill2[name]);
+
+// Most Frags (D)
+$q_topfrag = small_query("SELECT p.id, pi.name, p.frags FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id ORDER BY frags DESC LIMIT 0,1");
+$r_topfragid = $cbid($q_topfrag[id]);
+$r_topfragname = $cbnick($q_topfrag[name]);
+
+// Most Frags (W)
+$q_topfragw = small_query("SELECT p.id, pi.name, p.frags FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id AND team = $twin ORDER BY frags DESC LIMIT 0,1");
+$r_topfragwid = $cbid($q_topfkill2[id]);
+$r_topfragwname = $cbnick($q_topfkill2[name]);
+
+// Most Deaths (L)
+$q_topdeath = small_query("SELECT p.id, pi.name, p.deaths FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id AND team = $tlose ORDER BY deaths DESC LIMIT 0,1");
+$r_topdeathid = $cbid($q_topdeath[id]);
+$r_topdeathname = $cbnick($q_topdeath[name]);
+
+// Player of the Match
+$q_topstats = small_query("SELECT p.id, pi.name, p.rank AS prank FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id GROUP BY id, name ORDER BY prank DESC LIMIT 0,1");
+$r_topstatsid = $cbid($q_topstats[id]);
+$r_topstatsname = $cbnick($q_topstats[name]);
+
+
+// Write the top of the report (non game specific)
+
+//Player List for Red Team
+echo'_______________________________________________________________________<br />
+'.$teama.' Lineup: <br />
+';
+
+$sql_rplayer = "SELECT p.id, pi.name FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id AND team = 0 ORDER BY pi.name ASC";
+$q_rplayer = mysql_query($sql_rplayer);
+while ($r_rplayer = mysql_fetch_array($q_rplayer)) {
+
+ echo'[pl]'.$cbid($r_rplayer[id]).','.$cbnick($r_rplayer[name]).'[/pl] ';
+}
+
+//Player List for Blue Team
+
+echo'<br />_______________________________________________________________________<br />
+'.$teamb.' Lineup: <br />
+';
+
+$sql_bplayer = "SELECT p.id, pi.name FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id AND team = 1 ORDER BY pi.name ASC";
+$q_bplayer = mysql_query($sql_bplayer);
+while ($r_bplayer = mysql_fetch_array($q_bplayer)) {
+
+ echo'[pl]'.$cbid($r_bplayer[id]).','.$cbnick($r_bplayer[name]).'[/pl] ';
+}
+echo '_______________________________________________________________________<br />
+<br />';
+
+// Firstblood and Pickup stats
+
+echo 'First Blood: [pl]'.$r_fbloodid.','.$r_fbloodname.'[/pl]<br />
+'.$teama.' Belts: '.$q_t0bcount[bcount].'<br />
+'.$teamb.' Belts: '.$q_t1bcount[bcount].'<br />
+'.$teama.' Amps: '.$q_t0acount[acount].'<br />
+'.$teamb.' Amps: '.$q_t1acount[acount].'<br />
+';
+
+echo '_______________________________________________________________________<br />
+<br />
+';
+
+// Low Scores and a Draw
+IF ($reptype == "low" && $tdraw == 1) {
+ echo'Neither team were better this map, scorline is proof of this. <br />
+ [cl]'.$r_topgrabteamdid.','.$r_topgrabteamd.'[/cl] had the most chances to cap with [pl]'.$r_topgrabidd.','.$r_topgrabnamed.'[/pl]
+ taking the flag '.$q_topgrabd[flag_taken].' times, but unfortuantely couldnt cap as many as he took.<br />
+ <br />
+ Big credit to both teams defences; ';
+
+ IF ($q_topdefl[flag_kill] >= $q_topfkill[flag_kill]) {
+ echo '[pl]'.$r_topdeflid.','.$r_topdeflname.'[/pl] defended the flag
+ and got '.$q_topdefl[flag_kill].' flagkills while [pl]'.$r_topfkillid.','.$r_topfkillname.'[/pl]
+ also had a pretty nice defensive game killing '.$q_topfkill[flag_kill].' flag carriers.<br />
+ <br />';
+ } else {
+ echo '[pl]'.$r_topfkillid.','.$r_topfkillname.'[/pl] defended the flag
+ and got '.$q_topfkill[flag_kill].' flagkills while [pl]'.$r_topdeflid.','.$r_topdeflname.'[/pl]
+ also had a pretty nice defensive game killing '.$q_topdefl[flag_kill].' flag carriers.<br />
+ <br />';
+ }
+
+ echo'Seems the attackers had a frustrating game on this map, credit to ';
+
+ IF ($q_topcover[flag_cover] >= $q_topcoverl[flag_cover]) {
+ echo '[pl]'.$r_topcoverid.','.$r_topcovername.'[/pl] for covering his flag carrier
+ '.$q_topcover[flag_cover].' times and also [pl]'.$r_topcoverlid.','.$r_topcoverlname.'[/pl]
+ for covering '.$q_topcoverl[flag_cover].' times. <br />
+ <br />';
+ } else {
+ echo '[pl]'.$r_topcoverlid.','.$r_topcoverlname.'[/pl] for covering his flag carrier
+ '.$q_topcoverl[flag_cover].' times and also [pl]'.$r_topcoverid.','.$r_topcovername.'[/pl]
+ for covering '.$q_topcover[flag_cover].' times. <br />
+ <br />';
+ }
+
+ echo'Well done [pl]'.$r_topfragid.','.$r_topfragname.'[/pl] for ensuring a tight scoreline with
+ '.$q_topfrag[frags].' frags.<br />
+ <br />
+ If this map would be played again between these two clans, we might see a change of strategy
+ in the attacking play, but the defenders were strong on both sides this time.<br />
+ <br />
+ Good game.<br />
+ Stats player of the map was [pl]'.$r_topstatsid.','.$r_topstatsname.'[/pl] with '.$q_topstats[prank].'
+ stat points.<br />
+ Well played both teams.';
+}
+
+// Medium Scores and a Draw
+IF ($reptype == "medium" && $tdraw == 1) {
+ echo'An excitingly close game with neither side having the upper hand.<br />
+ Both clans teamplay was about even and the result shows that it could have easily gone either way.<br />
+ <br />
+ Capping opportunities came along time after time, with [cl]'.$r_topgrabid.','.$r_topgrabname.'[/cl]
+ taking the flag '.$q_topgrab[flag_taken].' times and at the other end [cl]'.$r_topgrabidl.','.$r_topgrabnamel.'[/cl]
+ taking the flag '.$q_topgrabl[flag_taken].' times.
+
+ Help was at hand for the flag runners with '.$teama.'\'s [pl]'.$r_topcoverrid.','.$r_topcoverrname.'[/pl]
+ covering '.$q_topcoverr[flag_cover].' times and [pl]'.$r_topcoverbid.','.$r_topcoverbname.'[/pl]
+ covering '.$q_topcoverb[flag_cover].' times for '.$teamb.'.<br />
+ <br />
+ Big credit to both teams defences; ';
+
+ IF ($q_topdefl[flag_kill] >= $q_topfkill[flag_kill]) {
+ echo '[pl]'.$r_topdeflid.','.$r_topdeflname.'[/pl] defended the flag
+ and got '.$q_topdefl[flag_kill].' flagkills while [pl]'.$r_topfkillid.','.$r_topfkillname.'[/pl]
+ also had a pretty nice defensive game killing '.$q_topfkill[flag_kill].' flag carriers.<br />
+ <br />';
+ } else {
+ echo '[pl]'.$r_topfkillid.','.$r_topfkillname.'[/pl] defended the flag
+ and got '.$q_topfkill[flag_kill].' flagkills while [pl]'.$r_topdeflid.','.$r_topdeflname.'[/pl]
+ also had a pretty nice defensive game killing '.$q_topdefl[flag_kill].' flag carriers.<br />
+ <br />';
+ }
+
+ echo'Both teams showed great teamplay and skill and the scoreline represents this.
+ Two even lineups for this map.<br />
+ <br />
+ Well done [pl]'.$r_topfragid.','.$r_topfragname.'[/pl] who had '.$q_topfrag[frags].' frags.<br />
+ <br />
+ Good game.<br />
+ Stats player of the map was [pl]'.$r_topstatsid.','.$r_topstatsname.'[/pl] with '.$q_topstats[prank].'
+ stat points.<br />
+ Well played both teams.';
+}
+
+// High Scores and a Draw
+IF ($reptype == "high" && $tdraw == 1) {
+echo' A very very exciting, close CTF game Im sure both clans will agree.<br />
+This high scoring draw proves that '.$teama.' and '.$teamb.' were evenly matched on this map.<br />
+Teamplay and strategy enabled both teams to cap quite a few times.<br />
+Well done to both teams attackers especially [pl]'.$r_topcapdid.','.$r_topcapdname.'[/pl]
+who capped '.$q_topcapd[flag_capture].' times.<br />
+<br />
+ Capping opportunities came along time after time, with [cl]'.$r_topgrabid.','.$r_topgrabname.'[/cl]
+ taking the flag '.$q_topgrab[flag_taken].' times and at the other end [cl]'.$r_topgrabidl.','.$r_topgrabnamel.'[/cl]
+ taking the flag '.$q_topgrabl[flag_taken].' times.<br />
+ <br />
+ Help was at hand for the flag runners with '.$teama.'\'s [pl]'.$r_topcoverrid.','.$r_topcoverrname.'[/pl]
+ covering '.$q_topcoverr[flag_cover].' times and [pl]'.$r_topcoverbid.','.$r_topcoverbname.'[/pl]
+ covering '.$q_topcoverb[flag_cover].' times for '.$teamb.'.<br />
+ <br />
+ Although the defenders probably didnt have as good a game as the attackers on this map,
+ credit should be awarded to ';
+
+ IF ($q_topdefl[flag_kill] >= $q_topfkill[flag_kill]) {
+ echo '[pl]'.$r_topdeflid.','.$r_topdeflname.'[/pl] for killing '.$q_topdefl[flag_kill].'
+ flag carriers and also to ';
+ } else {
+ echo '[pl]'.$r_topfkillid.','.$r_topfkillname.'[/pl] for killing '.$q_topfkill[flag_kill].'
+ flag carriers and also to ';
+ }
+
+ IF ($q_topseall[flag_seal] >= $q_topseal[flag_seal]) {
+ echo '[pl]'.$r_topseallid.','.$r_topseallname.'[/pl] for sealing the base '.$q_topseall[flag_seal].'
+ times for his flag carrier to cap.<br />
+ <br >';
+ } else {
+ echo '[pl]'.$r_topsealid.','.$r_topsealname.'[/pl] for sealing the base '.$q_topseal[flag_seal].'
+ times for his flag carrier to cap.<br />
+ <br >';
+ }
+
+ echo' [pl]'.$r_topassistdid.','.$r_topassistdname.'[/pl] helped '.$r_topassistdteam.' get as many
+ caps as they did by assisting '.$q_topassistd[flag_assist].' times in their caps.<br />
+ This shows great teamplay and cover, well played.<br />
+ <br />
+ Both teams showed great teamplay and skill and the scoreline represents this.<br />
+ <br />
+ Well done [pl]'.$r_topfragid.','.$r_topfragname.'[/pl] who had '.$q_topfrag[frags].' frags.<br />
+ <br />
+ Good game.<br />
+ Stats player of the map was [pl]'.$r_topstatsid.','.$r_topstatsname.'[/pl] with '.$q_topstats[prank].'
+ stat points.<br />
+ Well played both teams.';
+}
+
+// Low Scores and not a Draw
+IF ($reptype == "low" && $tdraw == 0) {
+ echo 'Not very many caps in this close game, but '.$twin_team.' emerge victorious.<br />
+ <br />
+ Big credit to both teams defences; ';
+
+ IF ($q_topdefl[flag_kill] >= $q_topfkill[flag_kill]) {
+ echo '[pl]'.$r_topdeflid.','.$r_topdeflname.'[/pl] defended the flag
+ and got '.$q_topdefl[flag_kill].' flagkills while [pl]'.$r_topfkillid.','.$r_topfkillname.'[/pl]
+ also had a pretty nice defensive game killing '.$q_topfkill[flag_kill].' flag carriers.<br />
+ <br />';
+ } else {
+ echo '[pl]'.$r_topfkillid.','.$r_topfkillname.'[/pl] defended the flag
+ and got '.$q_topfkill[flag_kill].' flagkills while [pl]'.$r_topdeflid.','.$r_topdeflname.'[/pl]
+ also had a pretty nice defensive game killing '.$q_topdefl[flag_kill].' flag carriers.<br />
+ <br />';
+ }
+
+ echo 'Seems the attackers had a frustrating game on this map,
+ especially [cl]'.$r_topgrabidl.','.$r_topgrabnamel.'[/cl] who took the flag '.$q_topgrabl[flag_taken].'
+ and still lost the game :(<br />
+ <br />
+ Suportive play was made by [pl]'.$r_topcoverlid.','.$r_topcoverlname.'[/pl] having
+ '.$q_topcoverl[flag_cover].' covers, but even with covering play,
+ the majority of the flags got returned and the game ended with '.$tlose_team.' losing out.<br />
+ <br />
+ Well done to [pl]'.$r_topcapid.','.$r_topcapname.'[/pl] for capping '.$q_topcap[flag_capture].'.<br />
+ On other days the outcome could have been different.<br />
+ <br />
+ Good game and congratualtions '.$twin_team.'.<br />
+ Stats player of the map was [pl]'.$r_topstatsid.','.$r_topstatsname.'[/pl] with '.$q_topstats[prank].'
+ stat points.<br />
+ Well played both teams.';
+}
+
+// Medium Scores and not a Draw
+IF ($reptype == "medium" && $tdraw == 0) {
+ echo 'A nice game of Capture the Flag took place this map with both teams trying
+ hard to get flags back but only occasionally succeeding.<br />
+ <br />
+ '.$twin_team.' however managed to succesfully cap more than '.$tlose_team.' with big help
+ from [pl]'.$r_topcapid.','.$r_topcapname.'[/pl] who capped '.$q_topcap[flag_capture].'.
+ [pl]'.$r_topgrabid.','.$r_topgrabname.'[/pl] made it hard for the '.$tlose_team.' defenders taking the
+ flag a total of '.$q_topgrab[flag_taken].' times.<br />
+ Not to say that the defence was bad at all, [pl]'.$r_topdeflid.','.$r_topdeflname.'[/pl]
+ got '.$q_topdefl[flag_kill].' flag kills and this made attacking hard work for '.$twin_team.'. <br />
+ <br />
+ Sealing off the base for '.$twin_team.' was some nice defence including
+ [pl]'.$r_topsealid.','.$r_topsealname.'[/pl] who sealed the base '.$q_topseal[flag_seal].' times.<br />
+ Covering the flag carrier for '.$twin_team.' mostly was [pl]'.$r_topcoverid.','.$r_topcovername.'[/pl]
+ with '.$q_topcover[flag_cover].' covers.<br />
+ <br />
+ Attacking in vain at the other end of the map was [pl]'.$r_topgrabidl.','.$r_topgrabnamel.'[/pl]
+ who managed to take the '.$twin_team.' flag '.$q_topgrabl[flag_taken].' times,
+ but unfortunately was unable to match the '.$twin_score.' caps made by '.$twin_team.'.<br />
+ [pl]'.$r_topgrabidl.','.$r_topgrabnamel.'[/pl] was also up against some heavy defence including
+ [pl]'.$r_topfkillid.','.$r_topfkillname.'[/pl] with '.$q_topfkill[flag_kill].' flag kills and
+ [pl]'.$r_topfkillid2.','.$r_topfkillname2.'[/pl] with '.$q_topfkill2[flag_kill].' flag kills.<br />
+ <br />
+ Good game and congratualtions '.$twin_team.'.<br />
+ Stats player of the map was [pl]'.$r_topstatsid.','.$r_topstatsname.'[/pl] with '.$q_topstats[prank].'
+ stat points.<br />
+ Well played both teams.';
+}
+
+// High Scores and not a Draw
+IF ($reptype == "high" && $tdraw == 0) {
+ echo ''.$twin_team.' were victorious thanks to some nice capping by
+ [pl]'.$r_topcapid.','.$r_topcapname.'[/pl] who capped '.$q_topcap[flag_capture].' and
+ [pl]'.$r_topgrabid.','.$r_topgrabname.'[/pl] who took the flag'.$q_topgrab[flag_taken].' times.<br />
+ <br />
+ [pl]'.$r_topcapid.','.$r_topcapname.'[/pl] probably could not have done it without the help of
+ [pl]'.$r_topcoverid.','.$r_topcovername.'[/pl] who had '.$q_topcover[flag_cover].' covers and
+ [pl]'.$r_topsealid.','.$r_topsealname.'[/pl] for sealing the base off
+ '.$q_topseal[flag_seal].' times.<br />
+ <br />
+ Although the '.$tlose_team.' defenders played well, the '.$q_topdefl[flag_kill].' flag kills by
+ [pl]'.$r_topdeflid.','.$r_topdeflname.'[/pl] was just not enough to stop the
+ '.$twin_team.' attackers succeeding. Extra Credit should be given to
+ [pl]'.$r_topfragwid.','.$r_topfragwname.'[/pl] for getting '.$q_topwfrag[frags].' frags.<br />
+ Some sympathy should be given to [pl]'.$r_topdeathid.','.$r_topdeathname.'[/pl]
+ who died a whopping '.$q_topdeath[deaths].' times - unlucky!.<br />
+ <br />
+ All in all, this was a great attacking game for '.$twin_team.', but all players deserve credit for
+ playing well.<br />
+ <br />
+ Good game and congratualtions '.$twin_team.'.<br />
+ Stats player of the map was [pl]'.$r_topstatsid.','.$r_topstatsname.'[/pl] with '.$q_topstats[prank].'
+ stat points.';
+
+}
+
+echo'<br />
+ <br />
+ This report was created with UTStats from the following game:<br />
+ [el]http://'.$oururl.'?p=match&mid='.$id.',http://'.$oururl.'?p=match&mid='.$id.'[/el]
+ </textarea>';
+?>
\ No newline at end of file diff --git a/html/pages/report/index.htm b/html/pages/report/index.htm new file mode 100755 index 0000000..e69de29 --- /dev/null +++ b/html/pages/report/index.htm diff --git a/html/pages/report_cb.php b/html/pages/report_cb.php new file mode 100755 index 0000000..ebde5a6 --- /dev/null +++ b/html/pages/report_cb.php @@ -0,0 +1,168 @@ +<?php
+echo'<form NAME="report" METHOD="get" ACTION="./?p=report">
+ <input type="hidden" name="p" value="report" size="0">
+ <input type="hidden" name="rtype" value="clanbase" size="0">
+ <input type="hidden" name="id" value="'.$id.'" size="0">
+ <input type="hidden" name="stage" value="1" size="0">
+ <table CLASS="searchformb">
+ <tr>
+ <td class="heading" colspan="2" ALIGN="center" width="480">Enter the Clanbase WarID</td>
+ </tr>
+ <tr>
+ <td ALIGN="left" class="grey">
+ <input TYPE="text" NAME="wid" MAXLENGTH="20" SIZE="20" value="'.(preg_replace('/\D/', '', $_GET['wid'])).'" CLASS="searchform">
+ <input TYPE="submit" VALUE="Submit" CLASS="searchformb"></td>
+ </tr>
+ </table>
+</form>';
+
+echo'<table>
+<tr>
+ <td width="480" align="center" class="heading" colspan="2">
+ <b>Team BreakDown of Match</b></td>
+</tr>
+<tr>
+<td width="240" align="center" class="smheading">Red Team</td>
+<td width="240" align="center" class="smheading">Blue Team</td>
+<tr>
+ <td width="50%" class="grey">';
+
+$sql_rteam = "SELECT p.id, pi.name FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id AND team = 0 ORDER BY pi.name ASC";
+$q_rteam = mysql_query($sql_rteam);
+while ($r_rteam = mysql_fetch_array($q_rteam)) {
+ echo''.$r_rteam[name].'<br />';
+ }
+echo'</td>
+<td width="50%" class="grey">';
+
+$sql_bteam = "SELECT p.id, pi.name FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id AND team = 1 ORDER BY pi.name ASC";
+$q_bteam = mysql_query($sql_bteam);
+while ($r_bteam = mysql_fetch_array($q_bteam)) {
+ echo''.$r_bteam[name].'<br />';
+ }
+echo'</td></tr></table><br>';
+
+IF ($wid == "") {
+}
+
+IF ($stage >= "1") {
+ include("includes/clanbase.php");
+ $warinfo = get_clans($wid);
+}
+
+IF ($stage == "1") {
+ $claninfo0 = get_players($warinfo[0][1]);
+ $claninfo1 = get_players($warinfo[1][1]);
+
+ echo'<form action="" method="get">
+ <input type="hidden" name="p" value="report" size="0">
+ <input type="hidden" name="rtype" value="clanbase" size="0">
+ <input type="hidden" name="id" value="'.$id.'" size="0">
+ <input type="hidden" name="wid" value="'.$wid.'" size="0">
+ <input type="hidden" name="stage" value="2" size="0">
+ <table class="searchformb">
+
+ <tr>
+ <td width="480" align="center" class="heading" colspan="2">
+ <b>Who Played As Red Team?</b></td>
+ </tr>
+ <tr>
+ <td width="100%" class="grey" colspan="2">
+ <select size="1" name="red" CLASS="searchform">
+ <option value="'.$warinfo[0][1].'">'.$warinfo[0][2].'</option>
+ <option value="'.$warinfo[1][1].'">'.$warinfo[1][2].'</option>
+ </select>
+ <input type=submit CLASS="searchformb" value="Assign"></td>
+ </tr>
+ </table>
+ </form>';
+}
+
+IF ($stage == "2") {
+ $redteam = $_GET["red"];
+
+ IF($redteam == $warinfo[0][1]) {
+ $redcid = $warinfo[0][1];
+ $redname = $warinfo[0][2];
+ $redinfo = get_players($warinfo[0][1]);
+ $bluecid = $warinfo[1][1];
+ $bluename = $warinfo[1][2];
+ $blueinfo = get_players($warinfo[1][1]);
+
+ } else {
+ $redcid = $warinfo[1][1];
+ $redname = $warinfo[1][2];
+ $redinfo = get_players($warinfo[1][1]);
+ $bluecid = $warinfo[0][1];
+ $bluename = $warinfo[0][2];
+ $blueinfo = get_players($warinfo[0][1]);
+ }
+
+ echo'<form action="" method="get">
+ <input type="hidden" name="p" value="report" size="0">
+ <input type="hidden" name="rtype" value="clanbase" size="0">
+ <input type="hidden" name="stage" value="generate" size="0">
+ <input type="hidden" name="id" value="'.$id.'" size="0">
+ <input type="hidden" name="wid" value="'.$wid.'" size="0">
+ <input type="hidden" name="red" value="'.htmlspecialchars($redteam, ENT_QUOTES).'" size="0">
+ <table class="searchformb">
+ <tr>
+ <td width="480" colspan="2" align="center" class="heading">
+ <b>Clan and Player Info for Clanbase War ID '.$wid.'</b></td>
+ </tr>
+ <tr>
+ <td colspan="2" align="center" class="smheading">
+ <a href="http://www.clanbase.com/claninfo.php?cid='.$redcid.'" target="_blank">'.$redname.'</a></td>
+ </tr>';
+
+ $redcount = count($redinfo);
+ $bluecount = count($blueinfo);
+
+ $sql_rteam = "SELECT p.id, pi.name FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id AND team = 0 ORDER BY pi.name ASC";
+
+ $q_rteam = mysql_query($sql_rteam);
+ while($r_rteam = mysql_fetch_array($q_rteam)) {
+
+ echo'<tr>
+ <td class="grey">'.$r_rteam[name].'</td>
+ <td class="grey">
+ <select CLASS="searchform" name="'.$r_rteam[id].'">
+ <option selected CLASS="searchform" value="">Use Me To Assign a CB Player to Stats</option>';
+
+ for ($i = 0; $i < $redcount; $i++) {
+ echo'<option CLASS="searchform" value="'.$redinfo[$i][0].'">'.$redinfo[$i][1].'</option>';
+ }
+ echo'</select></td>
+ </tr>';
+ }
+
+ echo'<td width="100%" align="center" class="smheading" colspan="2">
+ <a href="http://www.clanbase.com/claninfo.php?cid='.$bluecid.'" target="_blank">'.$bluename.'</a></td>';
+
+
+ $sql_bteam = "SELECT p.id, pi.name FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id AND team = 1 ORDER BY pi.name ASC";
+
+ $q_bteam = mysql_query($sql_bteam);
+ while($r_bteam = mysql_fetch_array($q_bteam)) {
+
+ echo'<tr>
+ <td class="grey">'.$r_bteam[name].'</td>
+ <td class="grey">
+ <select CLASS="searchform" name="'.$r_bteam[id].'">
+ <option selected CLASS="searchform" value="">Use Me To Assign a CB Player to Stats</option>';
+
+ for ($i = 0; $i < $bluecount; $i++) {
+ echo'<option CLASS="searchform" value="'.$blueinfo[$i][0].'">'.$blueinfo[$i][1].'</option>';
+ }
+ echo'</select></td>
+ </tr>';
+ }
+
+ echo'<tr>
+ <td class="grey" colspan="2" align="center">
+ <input type=submit CLASS="searchformb" value="Generate Report">
+ </td>
+ </tr>
+ </table></form>';
+}
+?>
\ No newline at end of file diff --git a/html/pages/servers.php b/html/pages/servers.php new file mode 100755 index 0000000..63d3721 --- /dev/null +++ b/html/pages/servers.php @@ -0,0 +1,74 @@ +<?php
+// Firstly we need to work out First Last Next Prev pages
+
+$scount = small_count("SELECT servername, serverip FROM uts_match GROUP BY servername, serverip");
+
+$ecount = $scount/25;
+$ecount2 = number_format($ecount, 0, '.', '');
+
+IF($ecount > $ecount2) {
+ $ecount2 = $ecount2+1;
+}
+
+$fpage = 0;
+IF($ecount < 1) { $lpage = 0; }
+else { $lpage = $ecount2-1; }
+
+$cpage = preg_replace('/\D/', '', $_GET["page"]);
+IF ($cpage == "") { $cpage = "0"; }
+$qpage = $cpage*25;
+
+$tfpage = $cpage+1;
+$tlpage = $lpage+1;
+
+$ppage = $cpage-1;
+$ppageurl = "<a class=\"pages\" href=\"./?p=servers&page=$ppage\">[Previous]</a>";
+IF ($ppage < "0") { $ppageurl = "[Previous]"; }
+
+$npage = $cpage+1;
+$npageurl = "<a class=\"pages\" href=\"./?p=servers&page=$npage\">[Next]</a>";
+IF ($npage >= "$ecount") { $npageurl = "[Next]"; }
+
+$fpageurl = "<a class=\"pages\" href=\"./?p=servers&page=$fpage\">[First]</a>";
+IF ($cpage == "0") { $fpageurl = "[First]"; }
+
+$lpageurl = "<a class=\"pages\" href=\"./?p=servers&page=$lpage\">[Last]</a>";
+IF ($cpage == "$lpage") { $lpageurl = "[Last]"; }
+
+echo'
+<div class="pages"><b>Page ['.$tfpage.'/'.$tlpage.'] Selection: '.$fpageurl.' / '.$ppageurl.' / '.$npageurl.' / '.$lpageurl.'</b></div>
+<table class="box" border="0" cellpadding="1" cellspacing="1">
+ <tbody><tr>
+ <td class="heading" colspan="6" align="center">Unreal Tournament Server List</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center" width="250">Server Name</td>
+ <td class="smheading" align="center" width="50">Status</td>
+ <td class="smheading" align="center" width="100">Matches</td>
+ <td class="smheading" align="center">Frags</td>
+ <td class="smheading" align="center" width="100">TeamScore</td>
+ <td class="smheading" align="center" width="100">Hours</td>
+ </tr>';
+
+$sql_servers = "SELECT servername, serverip, COUNT(*) AS matchcount, SUM(frags) AS frags, SUM(t0score+t1score+t2score+t3score) AS matchscore, SUM(gametime) AS gametime
+FROM uts_match GROUP BY servername, serverip ORDER BY servername ASC LIMIT $qpage,25";
+$q_servers = mysql_query($sql_servers) or die(mysql_error());
+while ($r_servers = mysql_fetch_array($q_servers)) {
+
+ $r_gametime = sec2hour($r_servers[gametime]);
+
+ echo'
+ <tr>
+ <td class="dark" align="center"><a class="darkhuman" href="./?p=sinfo&serverip='.$r_servers[serverip].'">'.$r_servers[servername].'</a></td>
+ <td class="grey" align="center"><a href="./?p=squery&serverip='.$r_servers[serverip].'"><img border="0" alt="Server Status" title="Server Status" src="images/magnify.gif"></a></td>
+ <td class="grey" align="center">'.$r_servers[matchcount].'</td>
+ <td class="grey" align="center">'.$r_servers[frags].'</td>
+ <td class="grey" align="center">'.$r_servers[matchscore].'</td>
+ <td class="grey" align="center">'.$r_gametime.'</td>
+ </tr>';
+}
+
+echo'
+</tbody></table>
+<div class="pages"><b>Page ['.$tfpage.'/'.$tlpage.'] Selection: '.$fpageurl.' / '.$ppageurl.' / '.$npageurl.' / '.$lpageurl.'</b></div>';
+?>
\ No newline at end of file diff --git a/html/pages/servers_info.php b/html/pages/servers_info.php new file mode 100755 index 0000000..2548197 --- /dev/null +++ b/html/pages/servers_info.php @@ -0,0 +1,104 @@ +<?php
+$serverip = $_GET[serverip];
+
+// Firstly we need to work out First Last Next Prev pages
+$scount = small_count("SELECT id FROM uts_match WHERE serverip = '$serverip'");
+
+$ecount = $scount/25;
+$ecount2 = number_format($ecount, 0, '.', '');
+
+IF($ecount > $ecount2) {
+ $ecount2 = $ecount2+1;
+}
+
+$fpage = 0;
+IF($ecount < 1) { $lpage = 0; }
+else { $lpage = $ecount2-1; }
+
+$cpage = $_GET["page"];
+IF ($cpage == "") { $cpage = "0"; }
+$qpage = $cpage*25;
+
+$tfpage = $cpage+1;
+$tlpage = $lpage+1;
+
+$ppage = $cpage-1;
+$ppageurl = "<a class=\"pages\" href=\"./?p=sinfo&serverip=$serverip&page=$ppage\">[Previous]</a>";
+IF ($ppage < "0") { $ppageurl = "[Previous]"; }
+
+$npage = $cpage+1;
+$npageurl = "<a class=\"pages\" href=\"./?p=sinfo&serverip=$serverip&page=$npage\">[Next]</a>";
+IF ($npage >= "$ecount") { $npageurl = "[Next]"; }
+
+$fpageurl = "<a class=\"pages\" href=\"./?p=sinfo&serverip=$serverip&page=$fpage\">[First]</a>";
+IF ($cpage == "0") { $fpageurl = "[First]"; }
+
+$lpageurl = "<a class=\"pages\" href=\"./?p=sinfo&serverip=$serverip&page=$lpage\">[Last]</a>";
+IF ($cpage == "$lpage") { $lpageurl = "[Last]"; }
+
+
+// Get the last match entry for this server
+
+$serverinfo = small_query("SELECT time, servername, serverinfo, gameinfo, mutators FROM uts_match WHERE serverip = '$serverip' ORDER BY time DESC LIMIT 0,1");
+$matchdate = mdate($serverinfo[time]);
+
+echo'
+<table class = "box" border="0" cellpadding="1" cellspacing="2" width="720">
+ <tbody><tr>
+ <td class="heading" align="center" colspan="4">'.$serverinfo[servername].'</td>
+ </tr>
+ <tr>
+ <td class="dark" align="center" width="110">Last Match</td>
+ <td class="grey" align="center" width="305">'.$matchdate.'</td>
+ <td class="dark" align="center" width="305">Game Info</td>
+ </tr>
+ <tr>
+ <td class="dark" align="center">Server Info</td>
+ <td class="grey" align="center">'.$serverinfo[serverinfo].'</td>
+ <td class="grey" align="center" rowspan="2">'.$serverinfo[gameinfo].'</td>
+ </tr>
+ <tr>
+ <td class="dark" align="center">Mutators</td>
+ <td class="grey" align="center">'.$serverinfo[mutators].'</td>
+ </tr>
+</tbody></table>
+<br>';
+
+// Do graph stuff
+$bgwhere = "serverip = '$serverip'";
+include("pages/graph_mbreakdown.php");
+
+echo'<div class="pages"><b>Page ['.$tfpage.'/'.$tlpage.'] Selection: '.$fpageurl.' / '.$ppageurl.' / '.$npageurl.' / '.$lpageurl.'</b></div>
+<table class="box" border="0" cellpadding="1" cellspacing="1">
+ <tbody><tr>
+ <td class="heading" colspan="4" align="center">Unreal Tournament Match List</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center" width="220">Date/Time</td>
+ <td class="smheading" align="center" width="140">Match Type</td>
+ <td class="smheading" align="center">Map</td>
+ <td class="smheading" align="center" width="40">Time</td>
+ </tr>';
+
+$sql_recent = "SELECT m.id, m.time, g.name AS gamename, m.mapfile, m.gametime FROM uts_match AS m, uts_games AS g WHERE g.id = m.gid AND m.serverip = '$serverip' ORDER BY m.time DESC LIMIT $qpage,25";
+$q_recent = mysql_query($sql_recent) or die(mysql_error());
+while ($r_recent = mysql_fetch_array($q_recent)) {
+
+ $r_time = mdate($r_recent[time]);
+ $r_mapfile = un_ut($r_recent[mapfile]);
+ $r_gametime = sec2min($r_recent[gametime]);
+ $myurl = urlencode($r_mapfile);
+
+ echo'
+ <tr>
+ <td class="dark" align="center"><a class="darkhuman" href="./?p=match&mid='.$r_recent[id].'">'.$r_time.'</a></td>
+ <td class="grey" align="center">'.$r_recent[gamename].'</td>
+ <td class="grey" align="center"><a class="grey" href="./?p=minfo&map='.$myurl.'">'.$r_mapfile.'</a></td>
+ <td class="grey" align="center">'.$r_gametime.'</td>
+ </tr>';
+}
+
+echo'
+</tbody></table>
+<div class="pages"><b>Page ['.$tfpage.'/'.$tlpage.'] Selection: '.$fpageurl.' / '.$ppageurl.' / '.$npageurl.' / '.$lpageurl.'</b></div>';
+?>
\ No newline at end of file diff --git a/html/pages/servers_query.php b/html/pages/servers_query.php new file mode 100755 index 0000000..95265c6 --- /dev/null +++ b/html/pages/servers_query.php @@ -0,0 +1,176 @@ +<?php
+//Return if no variables are set (exit)
+if (isset($_GET['serverip']) != 1) return;
+
+// Get server IP info
+list($serverip, $serverport) = split(":", addslashes($_GET[serverip]));
+$queryport = preg_replace('/\D/', '', $serverport)+1;
+
+// check for valid ip address, no ipv6 support
+if (!preg_match('/(\w{1,3}\.){3}\w{1,3}/', $serverip)) {
+ die('bla');
+}
+
+//If there is no IP, return (exit)
+if (strlen($serverip) == 0) return;
+
+//Open UDP socket to server
+$sock = fsockopen("udp://" . $serverip, $queryport, $errno, $errstr,4);
+
+//Check if we have a socket open, if not, display error message
+if (!$sock) {
+ echo "$errstr ($errno)<br>\n";
+ exit;
+}
+
+fputs($sock,"\\status\\\player_property\Health\\\game_property\ElapsedTime\\\game_property\RemainingTime\\");
+
+$gotfinal = False;
+$data = "";
+
+//Set starttime, for possible loop expiration, so the server doesn't get too much work.
+$starttime = Time();
+
+//Loop until final packet has been received.
+while(!($gotfinal == True || feof($sock))) {
+
+ //Get data
+ if(($buf = fgetc($sock)) == FALSE) {
+ usleep(100); // wait for additional data? :S whatever
+ }
+
+ //Add to databuffer
+ $data .= $buf;
+
+ //Check if final item (queryid) has been received
+ if (strpos($data,"final\\") != False) {
+ $gotfinal = True;
+ }
+
+ //Protect webserver against massive loop.
+ if ((Time() - $starttime) > 5) {
+ echo "Data receiving took too long. Cancelled.<P>";
+ $gotfinal = True;
+ }
+}
+
+//Close socket
+fclose ($sock);
+
+
+//Split chunks by \
+$chunks = split('[\]', $data);
+
+$mappic = strtolower("images/maps/".$map.".jpg");
+
+if (file_exists($mappic)) {
+} else {
+ $mappic = ("images/maps/blank.jpg");
+}
+
+$mapname = getiteminfo("mapname",$chunks);
+$mappic = strtolower("images/maps/".$mapname.".jpg");
+IF (file_exists($mappic)) {
+ } else {
+ $mappic = "images/maps/blank.jpg";
+}
+
+$r_hostname = getiteminfo("hostname",$chunks);
+$r_gametype = getiteminfo("gametype",$chunks);
+
+$r_adminname = getiteminfo("adminname",$chunks);
+$r_adminemail = getiteminfo("adminemail",$chunks);
+
+$r_password = getiteminfo("password",$chunks);
+$r_timelimit = getiteminfo("timelimit",$chunks);
+$r_remainingtime = GetMinutes(getiteminfo("RemainingTime",$chunks)) . " mins";
+$r_elapsedtime = GetMinutes(getiteminfo("ElapsedTime",$chunks)) . " mins";
+
+$r_goalteamscore = getiteminfo("goalteamscore",$chunks);
+$r_numplayers = getiteminfo("numplayers",$chunks);
+$r_minplayers = getiteminfo("minplayers",$chunks);
+$r_maxplayers = getiteminfo("maxplayers",$chunks);
+$r_maxteams = getiteminfo("maxteams",$chunks);
+
+$r_balanceteams = getiteminfo("balanceteams",$chunks);
+$r_tournament = getiteminfo("tournament",$chunks);
+$r_friendlyfire = getiteminfo("friendlyfire",$chunks);
+$r_gamestyle = getiteminfo("gamestyle",$chunks);
+
+echo'
+<table class = "box" border="0" cellpadding="1" cellspacing="2" width="720">
+ <tbody><tr>
+ <td class="heading" colspan="4" align="center">Server Status for '.$r_hostname.'</td>
+ </tr>
+ <tr>
+ <td class="dark" align="center" width="110">Server IP</td>
+ <td class="grey" align="center" width="350"><a class="grey" href="unreal://'.$serverip.':'.$serverport.'">'.$serverip.':'.$serverport.'</a></td>
+ <td class="dark" align="center" rowspan="5" colspan="2"><img border="0" alt="'.$mapname.'" title="'.$mapname.'" src="'.$mappic.'"></td>
+ </tr>
+ <tr>
+ <td class="dark" align="center">Map Name</td>
+ <td class="grey" align="center">'.$mapname.'</td>
+ </tr>
+ <tr>
+ <td class="dark" align="center" width="110">Match Type</td>
+ <td class="grey" align="center">'.$r_gametype.'</td>
+ </tr>
+ <tr>
+ <td class="dark" align="center">Server Info</td>
+ <td class="grey" align="center">Admin: '.$r_adminname.'<br />Email: '.$r_adminemail.'</td>
+ </tr>
+ <tr>
+ <td class="dark" align="center">Game Info</td>
+ <td class="grey" align="center">
+ Goal Team Score: '.$r_goalteamscore.'<br />
+ Min Players: '.$r_minplayers.'<br />
+ Max Players: '.$r_maxplayers.'<br />
+ Max Teams: '.$r_maxteams.'<br />
+ Balanced Teams: '.$r_balanceteams.'<br />
+ Tournament Mode: '.$r_tournament.'<br />
+ Friendly Fire: '.$r_friendlyfire.'<br />
+ Game Style: '.$r_gamestyle.'<br /><br />
+ Time Limit: '.$r_timelimit.'<br />
+ Time Remaining: '.$r_remainingtime.'<br />
+ Time Elapsed: '.$r_elapsedtime.'<br />
+ Password Required: '.$r_password.'<br />
+ </td>
+ </tr>
+</tbody></table>
+<br>
+
+<table class = "box" border="0" cellpadding="0" cellspacing="2" width="720">
+ <tbody>
+ <tr>
+ <td class="heading" colspan="5" align="center">Player Information</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center" width="270">Player</td>
+ <td class="smheading" align="center">Frags</td>
+ <td class="smheading" align="center">Team</td>
+ <td class="smheading" align="center">Ping</td>
+ <td class="smheading" align="center">Health</td>
+ </tr>';
+
+//Loop through all players
+for ($i = 0; $i < $r_numplayers; $i++) {
+ $actualid = $i;
+ $itemx = $i+1;
+
+ $r_playername = getiteminfo("player_" . $actualid,$chunks);
+ $r_playerfrags = getiteminfo("frags_" . $actualid,$chunks);
+ $r_playerteam = getiteminfo("team_" . $actualid,$chunks);
+ $r_playerping = getiteminfo("ping_" . $actualid,$chunks);
+ $r_playerhealth = getiteminfo("Health_" . $itemx,$chunks);
+
+ echo'<tr>
+ <td class="grey" align="center">'.$r_playername.'</td>
+ <td class="grey" align="center">'.$r_playerfrags.'</td>
+ <td class="grey" align="center">'.$r_playerteam.'</td>
+ <td class="grey" align="center">'.$r_playerping.'</td>
+ <td class="grey" align="center">'.$r_playerhealth.'</td>
+ </tr>';
+}
+
+echo'</tbody></table>';
+?>
\ No newline at end of file diff --git a/html/pages/totals.php b/html/pages/totals.php new file mode 100755 index 0000000..64acedd --- /dev/null +++ b/html/pages/totals.php @@ -0,0 +1,606 @@ +<?php
+echo'
+<table class = "box" border="0" cellpadding="1" cellspacing="2" width="720">
+ <tbody><tr>
+ <td class="heading" align="center">Totals Summary</td>
+ </tr>
+</tbody></table>
+<br>
+<table class="box" border="0" cellpadding="1" cellspacing="2">
+ <tbody><tr>
+ <td class="medheading" colspan="10" align="center">Summary</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center" width="150">Game Type</td>
+ <td class="smheading" align="center" width="45">Score</td>
+ <td class="smheading" align="center" width="35">Frags</td>
+ <td class="smheading" align="center" width="35">Kills</td>
+ <td class="smheading" align="center" width="35">Suicides</td>
+ <td class="smheading" align="center" width="35">Team Kills</td>
+ <td class="smheading" align="center" width="50">Matches</td>
+ <td class="smheading" align="center" width="45">Hours</td>
+ </tr>';
+
+$sql_totsumm = "SELECT g.name AS gamename, SUM(p.gamescore) AS gamescore, SUM(p.frags) AS frags, SUM(p.kills) AS kills, SUM(p.suicides) AS suicides, SUM(p.teamkills) AS teamkills, COUNT(DISTINCT p.matchid) AS matchcount, SUM(p.gametime) AS sumgametime
+FROM uts_player AS p, uts_games AS g WHERE p.gid = g.id GROUP BY gamename ORDER BY gamename ASC";
+$q_totsumm = mysql_query($sql_totsumm) or die(mysql_error());
+while ($r_totsumm = zero_out(mysql_fetch_array($q_totsumm))) {
+
+ $gametime = sec2hour($r_totsumm[sumgametime]);
+
+ echo'
+ <tr>
+ <td class="dark" align="center">'.$r_totsumm[gamename].'</td>
+ <td class="grey" align="center">'.$r_totsumm[gamescore].'</td>
+ <td class="grey" align="center">'.$r_totsumm[frags].'</td>
+ <td class="grey" align="center">'.$r_totsumm[kills].'</td>
+ <td class="grey" align="center">'.$r_totsumm[suicides].'</td>
+ <td class="grey" align="center">'.$r_totsumm[teamkills].'</td>
+ <td class="grey" align="center">'.$r_totsumm[matchcount].'</td>
+ <td class="grey" align="center">'.$gametime.'</td>
+ </tr>';
+}
+
+$sql_summtot = zero_out(small_query("SELECT SUM(gamescore) AS gamescore, SUM(frags) AS frags, SUM(kills) AS kills, SUM(suicides) AS suicides, SUM(teamkills) AS teamkills, COUNT(DISTINCT matchid) AS matchcount, SUM(gametime) AS sumgametime
+FROM uts_player"));
+
+$gametime2 = sec2hour($sql_summtot[sumgametime]);
+
+echo'
+ <tr>
+ <td class="dark" align="center"><b>Totals</b></td>
+ <td class="grey" align="center">'.$sql_summtot[gamescore].'</td>
+ <td class="grey" align="center">'.$sql_summtot[frags].'</td>
+ <td class="grey" align="center">'.$sql_summtot[kills].'</td>
+ <td class="grey" align="center">'.$sql_summtot[suicides].'</td>
+ <td class="grey" align="center">'.$sql_summtot[teamkills].'</td>
+ <td class="grey" align="center">'.$sql_summtot[matchcount].'</td>
+ <td class="grey" align="center">'.$gametime2.'</td>
+ </tr>
+</tbody></table>
+<br>
+<table class = "box" border="0" cellpadding="1" cellspacing="2" width="600">
+ <tbody><tr>
+ <td class="medheading" colspan="11" align="center">Assault, Domination and CTF Events Summary</td>
+ </tr>
+ <tr>
+ <td class="dark" align="center" rowspan="2">Assault Objectives</td>
+ <td class="dark" align="center" rowspan="2">Control Point Captures</td>
+ <td class="dark" align="center" colspan="9">Capture The Flag</td>
+ </tr>
+ <tr>
+ <td class="dark" align="center">Flag Takes</td>
+ <td class="dark" align="center">Flag Pickups</td>
+ <td class="dark" align="center">Flag Drops</td>
+ <td class="dark" align="center">Flag Assists</td>
+ <td class="dark" align="center">Flag Covers</td>
+ <td class="dark" align="center">Flag Seals</td>
+ <td class="dark" align="center">Flag Captures</td>
+ <td class="dark" align="center">Flag Kills</td>
+ <td class="dark" align="center">Flag Returns</td>
+ </tr>';
+
+ $q_assgids = mysql_query("SELECT id FROM uts_games WHERE gamename LIKE '%Assault%';") or die(mysql_error());
+ $assgids = array();
+ while ($r_assgids = mysql_fetch_array($q_assgids)) {
+ $assgids[] = $r_assgids['id'];
+ }
+ $assquery = (count($assgids) > 0) ? 'SUM(IF (gid IN ('. implode(',', $assgids) .'), ass_obj, 0)) AS ass_obj' : '0 AS ass_obj';
+
+ $sql_cdatot = zero_out(small_query("SELECT SUM(dom_cp) AS dom_cp, $assquery, SUM(flag_taken) AS flag_taken,
+ SUM(flag_pickedup) AS flag_pickedup, SUM(flag_dropped) AS flag_dropped, SUM(flag_assist) AS flag_assist, SUM(flag_cover) AS flag_cover,
+ SUM(flag_seal) AS flag_seal, SUM(flag_capture) AS flag_capture, SUM(flag_kill)as flag_kill,
+ SUM(flag_return) AS flag_return FROM uts_player"));
+
+ echo'
+ <tr>
+ <td class="grey" align="center">'.$sql_cdatot[ass_obj].'</td>
+ <td class="grey" align="center">'.$sql_cdatot[dom_cp].'</td>
+ <td class="grey" align="center">'.$sql_cdatot[flag_taken].'</td>
+ <td class="grey" align="center">'.$sql_cdatot[flag_pickedup].'</td>
+ <td class="grey" align="center">'.$sql_cdatot[flag_dropped].'</td>
+ <td class="grey" align="center">'.$sql_cdatot[flag_assist].'</td>
+ <td class="grey" align="center">'.$sql_cdatot[flag_cover].'</td>
+ <td class="grey" align="center">'.$sql_cdatot[flag_seal].'</td>
+ <td class="grey" align="center">'.$sql_cdatot[flag_capture].'</td>
+ <td class="grey" align="center">'.$sql_cdatot[flag_kill].'</td>
+ <td class="grey" align="center">'.$sql_cdatot[flag_return].'</td>
+ </tr>
+</tbody></table>
+<br>
+<table class = "box" border="0" cellpadding="1" cellspacing="2" width="500">
+ <tbody><tr>
+ <td class="medheading" colspan="4" align="center">Special Events</td>
+ </tr>';
+
+$sql_firstblood = zero_out(small_count("SELECT firstblood FROM uts_match WHERE firstblood != ''"));
+$sql_multis = zero_out(small_query("SELECT SUM(spree_double) AS spree_double, SUM(spree_multi) AS spree_multi, SUM(spree_ultra) AS spree_ultra, SUM(spree_monster) AS spree_monster FROM uts_player"));
+$sql_sprees = zero_out(small_query("SELECT SUM(spree_kill) AS spree_kill, SUM(spree_rampage) AS spree_rampage, SUM(spree_dom) AS spree_dom, SUM(spree_uns) AS spree_uns, SUM(spree_god) AS spree_god FROM uts_player"));
+
+ echo'
+ <tr>
+ <td class="smheading" align="center" colspan="2" width="250">Special/Multis</td>
+ <td class="smheading" align="center" colspan="2" width="250">Sprees</td>
+ </tr>
+ <tr>
+ <td class="dark" align="center" width="150">First Blood</td>
+ <td class="grey" align="center" width="100">'.$sql_firstblood.'</td>
+ <td class="dark" align="center" width="150">Killing Spree</td>
+ <td class="grey" align="center" width="100">'.$sql_sprees[spree_kill].'</td>
+ </tr>
+ <tr>
+ <td class="dark" align="center">Double Kills</td>
+ <td class="grey" align="center">'.$sql_multis[spree_double].'</td>
+ <td class="dark" align="center">Rampage</td>
+ <td class="grey" align="center">'.$sql_sprees[spree_rampage].'</td>
+ </tr>
+ <tr>
+ <td class="dark" align="center">Multi Kills</td>
+ <td class="grey" align="center">'.$sql_multis[spree_multi].'</td>
+ <td class="dark" align="center">Dominating</td>
+ <td class="grey" align="center">'.$sql_sprees[spree_dom].'</td>
+ </tr>
+ <tr>
+ <td class="dark" align="center">Ultra Kills</td>
+ <td class="grey" align="center">'.$sql_multis[spree_ultra].'</td>
+ <td class="dark" align="center">Unstoppable</td>
+ <td class="grey" align="center">'.$sql_sprees[spree_uns].'</td>
+ </tr>
+ <tr>
+ <td class="dark" align="center">Monster Kills</td>
+ <td class="grey" align="center">'.$sql_multis[spree_monster].'</td>
+ <td class="dark" align="center">Godlike</td>
+ <td class="grey" align="center">'.$sql_sprees[spree_god].'</td>
+ </tr>
+</tbody></table>
+<br>';
+
+include('includes/weaponstats.php');
+weaponstats(0, 0);
+
+echo'<br>
+<table class = "box" border="0" cellpadding="1" cellspacing="2" width="710">
+ <tbody><tr>
+ <td class="heading" align="center">Totals for Players</td>
+ </tr>
+</tbody></table>';
+
+// NGStats Style Total Highs (All Time)
+
+$sql_chighfrags = small_query("SELECT p.pid, pi.name, p.country, SUM(frags) AS frags , SUM(gametime) AS sumgametime, COUNT(matchid) AS mcount FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND pi.banned <> 'Y' GROUP BY pid HAVING sumgametime > 1800 ORDER BY frags DESC LIMIT 0,1");
+$sql_chighdeaths = small_query("SELECT p.pid, pi.name, p.country, SUM(deaths) AS deaths , SUM(gametime) AS sumgametime, COUNT(matchid) AS mcount FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND pi.banned <> 'Y' GROUP BY pid HAVING sumgametime > 1800 ORDER BY deaths DESC LIMIT 0,1");
+$sql_chighkills = small_query("SELECT p.pid, pi.name, p.country, SUM(kills) AS kills , SUM(gametime) AS sumgametime, COUNT(matchid) AS mcount FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND pi.banned <> 'Y' GROUP BY pid HAVING sumgametime > 1800 ORDER BY kills DESC LIMIT 0,1");
+$sql_chighsuicides = small_query("SELECT p.pid, pi.name, p.country, SUM(suicides) AS suicides , SUM(gametime) AS sumgametime, COUNT(matchid) AS mcount FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND pi.banned <> 'Y' GROUP BY pid HAVING sumgametime > 1800 ORDER BY suicides DESC LIMIT 0,1");
+$sql_chighteamkills = small_query("SELECT p.pid, pi.name, p.country, SUM(teamkills) AS teamkills , SUM(gametime) AS sumgametime, COUNT(matchid) AS mcount FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND pi.banned <> 'Y' GROUP BY pid HAVING sumgametime > 1800 ORDER BY teamkills DESC LIMIT 0,1");
+$sql_chigheff = small_query("SELECT p.pid, pi.name, p.country, AVG(eff) AS eff , SUM(gametime) AS sumgametime, COUNT(matchid) AS mcount FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND pi.banned <> 'Y' GROUP BY pid HAVING sumgametime > 1800 ORDER BY eff DESC LIMIT 0,1");
+$sql_chighaccuracy = small_query("SELECT p.pid, pi.name, p.country, AVG(accuracy) AS accuracy , SUM(gametime) AS sumgametime, COUNT(matchid) AS mcount FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND pi.banned <> 'Y' GROUP BY pid HAVING sumgametime > 1800 ORDER BY accuracy DESC LIMIT 0,1");
+$sql_chighttl = small_query("SELECT p.pid, pi.name, p.country, AVG(ttl) AS ttl , SUM(gametime) AS sumgametime, COUNT(matchid) AS mcount FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND pi.banned <> 'Y' GROUP BY pid HAVING sumgametime > 1800 ORDER BY ttl DESC LIMIT 0,1");
+$sql_chighflag_capture = small_query("SELECT p.pid, pi.name, p.country, SUM(flag_capture) AS flag_capture , SUM(gametime) AS sumgametime, COUNT(matchid) AS mcount FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND pi.banned <> 'Y' GROUP BY pid HAVING sumgametime > 1800 ORDER BY flag_capture DESC LIMIT 0,1");
+$sql_chighflag_kill = small_query("SELECT p.pid, pi.name, p.country, SUM(flag_kill) AS flag_kill , SUM(gametime) AS sumgametime, COUNT(matchid) AS mcount FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND pi.banned <> 'Y' GROUP BY pid HAVING sumgametime > 1800 ORDER BY flag_kill DESC LIMIT 0,1");
+$sql_chighdom_cp = small_query("SELECT p.pid, pi.name, p.country, SUM(dom_cp) AS dom_cp , SUM(gametime) AS sumgametime, COUNT(matchid) AS mcount FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND pi.banned <> 'Y' GROUP BY pid HAVING sumgametime > 1800 ORDER BY dom_cp DESC LIMIT 0,1");
+
+$ass_obj_check = small_query("SELECT COUNT(id) AS idcount FROM uts_games WHERE gamename LIKE '%Assault%';") or die(mysql_error());
+IF ($ass_obj_check[idcount] > 0 ) {
+ $sql_chighass_obj = small_query("SELECT p.pid, pi.name, p.country, SUM(ass_obj) AS ass_obj , SUM(gametime) AS sumgametime, COUNT(matchid) AS mcount FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND pi.banned <> 'Y' GROUP BY pid HAVING sumgametime > 1800 ORDER BY ass_obj DESC LIMIT 0,1");
+} else {
+ $sql_chighass_obj = "";
+}
+
+$sql_chighspree_monster = small_query("SELECT p.pid, pi.name, p.country, SUM(spree_monster) AS spree_monster , SUM(gametime) AS sumgametime, COUNT(matchid) AS mcount FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND pi.banned <> 'Y' GROUP BY pid HAVING sumgametime > 1800 ORDER BY spree_monster DESC LIMIT 0,1");
+$sql_chighspree_god = small_query("SELECT p.pid, pi.name, p.country, SUM(spree_god) AS spree_god , SUM(gametime) AS sumgametime, COUNT(matchid) AS mcount FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND pi.banned <> 'Y' GROUP BY pid HAVING sumgametime > 1800 ORDER BY spree_god DESC LIMIT 0,1");
+$sql_chighrank = small_query("SELECT p.pid, pi.name, p.country, SUM(rank) AS rank , SUM(gametime) AS sumgametime, COUNT(matchid) AS mcount FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND pi.banned <> 'Y' GROUP BY pid HAVING sumgametime > 1800 ORDER BY rank DESC LIMIT 0,1");
+
+echo'<br>
+<table class = "box" border="0" cellpadding="1" cellspacing="2" width="550">
+ <tbody>
+ <tr>
+ <td class="medheading" colspan="5" align="center">Career Highs</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center" width="200">Category</td>
+ <td class="smheading" align="center" width="200">Player</td>
+ <td class="smheading" align="center" width="50">Amount</td>
+ <td class="smheading" align="center" width="50">Hours</td>
+ <td class="smheading" align="center" width="50">Matches</td>
+ </tr>';
+if ($sql_chighfrags and $sql_chighfrags[frags]) {
+ echo '
+ <tr>
+ <td class="dark" align="center">Frags</td>
+ <td nowrap class="greyhuman" align="center"><a class="greyhuman" href="./?p=pinfo&pid='.$sql_chighfrags[pid].'">'.FlagImage($sql_chighfrags['country'], false).' '.$sql_chighfrags[name].'</a></td>
+ <td class="grey" align="center">'.$sql_chighfrags[frags].'</td>
+ <td class="grey" align="center">'.sec2hour($sql_chighfrags[sumgametime]).'</td>
+ <td class="grey" align="center">'.$sql_chighfrags[mcount].'</td>
+ </tr>';
+}
+if ($sql_chighdeaths and $sql_chighdeaths[deaths]) {
+ echo '
+ <tr>
+ <td class="dark" align="center">Deaths</td>
+ <td nowrap class="greyhuman" align="center"><a class="greyhuman" href="./?p=pinfo&pid='.$sql_chighdeaths[pid].'">'.FlagImage($sql_chighdeaths['country'], false).' '.$sql_chighdeaths[name].'</a></td>
+ <td class="grey" align="center">'.$sql_chighdeaths[deaths].'</td>
+ <td class="grey" align="center">'.sec2hour($sql_chighdeaths[sumgametime]).'</td>
+ <td class="grey" align="center">'.$sql_chighdeaths[mcount].'</td>
+ </tr>';
+}
+if ($sql_chighkills and $sql_chighkills[kills]) {
+ echo '
+ <tr>
+ <td class="dark" align="center">Kills</td>
+ <td nowrap class="greyhuman" align="center"><a class="greyhuman" href="./?p=pinfo&pid='.$sql_chighkills[pid].'">'.FlagImage($sql_chighkills['country'], false).' '.$sql_chighkills[name].'</a></td>
+ <td class="grey" align="center">'.$sql_chighkills[kills].'</td>
+ <td class="grey" align="center">'.sec2hour($sql_chighkills[sumgametime]).'</td>
+ <td class="grey" align="center">'.$sql_chighkills[mcount].'</td>
+ </tr>';
+}
+if ($sql_chighsuicides and $sql_chighsuicides[suicides]) {
+ echo '
+ <tr>
+ <td class="dark" align="center">Suicides</td>
+ <td nowrap class="greyhuman" align="center"><a class="greyhuman" href="./?p=pinfo&pid='.$sql_chighsuicides[pid].'">'.FlagImage($sql_chighsuicides['country'], false).' '.$sql_chighsuicides[name].'</a></td>
+ <td class="grey" align="center">'.$sql_chighsuicides[suicides].'</td>
+ <td class="grey" align="center">'.sec2hour($sql_chighsuicides[sumgametime]).'</td>
+ <td class="grey" align="center">'.$sql_chighsuicides[mcount].'</td>
+ </tr>';
+}
+if ($sql_chighteamkills and $sql_chighteamkills[teamkills]) {
+ echo '
+ <tr>
+ <td class="dark" align="center">Team Kills</td>
+ <td nowrap class="greyhuman" align="center"><a class="greyhuman" href="./?p=pinfo&pid='.$sql_chighteamkills[pid].'">'.FlagImage($sql_chighteamkills['country'], false).' '.$sql_chighteamkills[name].'</a></td>
+ <td class="grey" align="center">'.$sql_chighteamkills[teamkills].'</td>
+ <td class="grey" align="center">'.sec2hour($sql_chighteamkills[sumgametime]).'</td>
+ <td class="grey" align="center">'.$sql_chighteamkills[mcount].'</td>
+ </tr>';
+}
+if ($sql_chigheff and $sql_chigheff[eff]) {
+ echo '
+ <tr>
+ <td class="dark" align="center">Efficiency</td>
+ <td nowrap class="greyhuman" align="center"><a class="greyhuman" href="./?p=pinfo&pid='.$sql_chigheff[pid].'">'.FlagImage($sql_chigheff['country'], false).' '.$sql_chigheff[name].'</a></td>
+ <td class="grey" align="center">'.get_dp($sql_chigheff[eff]).'</td>
+ <td class="grey" align="center">'.sec2hour($sql_chigheff[sumgametime]).'</td>
+ <td class="grey" align="center">'.$sql_chigheff[mcount].'</td>
+ </tr>';
+}
+if ($sql_chighaccuracy and $sql_chighaccuracy[accuracy]) {
+ echo '
+ <tr>
+ <td class="dark" align="center">Accuracy</td>
+ <td nowrap class="greyhuman" align="center"><a class="greyhuman" href="./?p=pinfo&pid='.$sql_chighaccuracy[pid].'">'.FlagImage($sql_chighaccuracy['country'], false).' '.$sql_chighaccuracy[name].'</a></td>
+ <td class="grey" align="center">'.get_dp($sql_chighaccuracy[accuracy]).'</td>
+ <td class="grey" align="center">'.sec2hour($sql_chighaccuracy[sumgametime]).'</td>
+ <td class="grey" align="center">'.$sql_chighaccuracy[mcount].'</td>
+ </tr>';
+}
+if ($sql_chighttl and $sql_chighttl[ttl]) {
+ echo '
+ <tr>
+ <td class="dark" align="center">TTL</td>
+ <td nowrap class="greyhuman" align="center"><a class="greyhuman" href="./?p=pinfo&pid='.$sql_chighttl[pid].'">'.FlagImage($sql_chighttl['country'], false).' '.$sql_chighttl[name].'</a></td>
+ <td class="grey" align="center">'.get_dp($sql_chighttl[ttl]).'</td>
+ <td class="grey" align="center">'.sec2hour($sql_chighttl[sumgametime]).'</td>
+ <td class="grey" align="center">'.$sql_chighttl[mcount].'</td>
+ </tr>';
+}
+if ($sql_chighflag_capture and $sql_chighflag_capture[flag_capture]) {
+ echo '
+ <tr>
+ <td class="dark" align="center">Flag Caps</td>
+ <td nowrap class="greyhuman" align="center"><a class="greyhuman" href="./?p=pinfo&pid='.$sql_chighflag_capture[pid].'">'.FlagImage($sql_chighflag_capture['country'], false).' '.$sql_chighflag_capture[name].'</a></td>
+ <td class="grey" align="center">'.$sql_chighflag_capture[flag_capture].'</td>
+ <td class="grey" align="center">'.sec2hour($sql_chighflag_capture[sumgametime]).'</td>
+ <td class="grey" align="center">'.$sql_chighflag_capture[mcount].'</td>
+ </tr>';
+}
+if ($sql_chighflag_kill and $sql_chighflag_kill[flag_kill]) {
+ echo '
+ <tr>
+ <td class="dark" align="center">Flag Kills</td>
+ <td nowrap class="greyhuman" align="center"><a class="greyhuman" href="./?p=pinfo&pid='.$sql_chighflag_kill[pid].'">'.FlagImage($sql_chighflag_kill['country'], false).' '.$sql_chighflag_kill[name].'</a></td>
+ <td class="grey" align="center">'.$sql_chighflag_kill[flag_kill].'</td>
+ <td class="grey" align="center">'.sec2hour($sql_chighflag_kill[sumgametime]).'</td>
+ <td class="grey" align="center">'.$sql_chighflag_kill[mcount].'</td>
+ </tr>';
+}
+if ($sql_chighdom_cp and $sql_chighdom_cp[dom_cp]) {
+ echo '
+ <tr>
+ <td class="dark" align="center">Domination Control Points</td>
+ <td nowrap class="greyhuman" align="center"><a class="greyhuman" href="./?p=pinfo&pid='.$sql_chighdom_cp[pid].'">'.FlagImage($sql_chighdom_cp['country'], false).' '.$sql_chighdom_cp[name].'</a></td>
+ <td class="grey" align="center">'.$sql_chighdom_cp[dom_cp].'</td>
+ <td class="grey" align="center">'.sec2hour($sql_chighdom_cp[sumgametime]).'</td>
+ <td class="grey" align="center">'.$sql_chighdom_cp[mcount].'</td>
+ </tr>';
+}
+if ($sql_chighass_obj and $sql_chighass_obj[ass_obj]) {
+ echo '
+ <tr>
+ <td class="dark" align="center">Assault Objectives</td>
+ <td nowrap class="greyhuman" align="center"><a class="greyhuman" href="./?p=pinfo&pid='.$sql_chighass_obj[pid].'">'.FlagImage($sql_chighass_obj['country'], false).' '.$sql_chighass_obj[name].'</a></td>
+ <td class="grey" align="center">'.$sql_chighass_obj[ass_obj].'</td>
+ <td class="grey" align="center">'.sec2hour($sql_chighass_obj[sumgametime]).'</td>
+ <td class="grey" align="center">'.$sql_chighass_obj[mcount].'</td>
+ </tr>';
+}
+if ($sql_chighspree_monster and $sql_chighspree_monster[spree_monster]) {
+ echo '
+ <tr>
+ <td class="dark" align="center">Monster Kills</td>
+ <td nowrap class="greyhuman" align="center"><a class="greyhuman" href="./?p=pinfo&pid='.$sql_chighspree_monster[pid].'">'.FlagImage($sql_chighspree_monster['country'], false).' '.$sql_chighspree_monster[name].'</a></td>
+ <td class="grey" align="center">'.$sql_chighspree_monster[spree_monster].'</td>
+ <td class="grey" align="center">'.sec2hour($sql_chighspree_monster[sumgametime]).'</td>
+ <td class="grey" align="center">'.$sql_chighspree_monster[mcount].'</td>
+ </tr>';
+}
+if ($sql_chighspree_god and $sql_chighspree_god[spree_god]) {
+ echo '
+ <tr>
+ <td class="dark" align="center">Godlikes</td>
+ <td nowrap class="greyhuman" align="center"><a class="greyhuman" href="./?p=pinfo&pid='.$sql_chighspree_god[pid].'">'.FlagImage($sql_chighspree_god['country'], false).' '.$sql_chighspree_god[name].'</a></td>
+ <td class="grey" align="center">'.$sql_chighspree_god[spree_god].'</td>
+ <td class="grey" align="center">'.sec2hour($sql_chighspree_god[sumgametime]).'</td>
+ <td class="grey" align="center">'.$sql_chighspree_god[mcount].'</td>
+ </tr>';
+}
+if ($sql_chighrank and $sql_chighrank[rank]) {
+ echo '
+ <tr>
+ <td class="dark" align="center">Rank Points</td>
+ <td nowrap class="greyhuman" align="center"><a class="greyhuman" href="./?p=pinfo&pid='.$sql_chighrank[pid].'">'.FlagImage($sql_chighrank['country'], false).' '.$sql_chighrank[name].'</a></td>
+ <td class="grey" align="center">'.get_dp($sql_chighrank[rank]).'</td>
+ <td class="grey" align="center">'.sec2hour($sql_chighrank[sumgametime]).'</td>
+ <td class="grey" align="center">'.$sql_chighrank[mcount].'</td>
+ </tr>';
+}
+echo '
+</tbody></table>
+<br>';
+
+
+// NGStats Style Total Highs (Single Match)
+
+$sql_mhighfrags = small_query("SELECT p.matchid, p.pid, pi.name, p.country, SUM(frags) AS frags , SUM(gametime) AS sumgametime FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND pi.banned <> 'Y' AND frags > 0 GROUP BY matchid, pid HAVING sumgametime > 600 ORDER BY frags DESC LIMIT 0,1");
+$sql_mhighdeaths = small_query("SELECT p.matchid, p.pid, pi.name, p.country, SUM(deaths) AS deaths , SUM(gametime) AS sumgametime FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND pi.banned <> 'Y' AND deaths > 0 GROUP BY matchid, pid HAVING sumgametime > 600 ORDER BY deaths DESC LIMIT 0,1");
+$sql_mhighkills = small_query("SELECT p.matchid, p.pid, pi.name, p.country, SUM(kills) AS kills , SUM(gametime) AS sumgametime FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND pi.banned <> 'Y' AND kills > 0 GROUP BY matchid, pid HAVING sumgametime > 600 ORDER BY kills DESC LIMIT 0,1");
+$sql_mhighsuicides = small_query("SELECT p.matchid, p.pid, pi.name, p.country, SUM(suicides) AS suicides , SUM(gametime) AS sumgametime FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND pi.banned <> 'Y' AND suicides > 0 GROUP BY matchid, pid HAVING sumgametime > 600 ORDER BY suicides DESC LIMIT 0,1");
+$sql_mhighteamkills = small_query("SELECT p.matchid, p.pid, pi.name, p.country, SUM(teamkills) AS teamkills , SUM(gametime) AS sumgametime FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND pi.banned <> 'Y' AND teamkills > 0 GROUP BY matchid, pid HAVING sumgametime > 600 ORDER BY teamkills DESC LIMIT 0,1");
+$sql_mhigheff = small_query("SELECT p.matchid, p.pid, pi.name, p.country, SUM(eff) AS eff , SUM(gametime) AS sumgametime FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND pi.banned <> 'Y' AND eff > 0 GROUP BY matchid, pid HAVING sumgametime > 600 ORDER BY eff DESC LIMIT 0,1");
+$sql_mhighaccuracy = small_query("SELECT p.matchid, p.pid, pi.name, p.country, SUM(accuracy) AS accuracy , SUM(gametime) AS sumgametime FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND pi.banned <> 'Y' AND accuracy > 0 GROUP BY matchid, pid HAVING sumgametime > 600 ORDER BY accuracy DESC LIMIT 0,1");
+$sql_mhighttl = small_query("SELECT p.matchid, p.pid, pi.name, p.country, SUM(ttl) AS ttl , SUM(gametime) AS sumgametime FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND pi.banned <> 'Y' AND ttl > 0 GROUP BY matchid, pid HAVING sumgametime > 600 ORDER BY ttl DESC LIMIT 0,1");
+$sql_mhighflag_capture = small_query("SELECT p.matchid, p.pid, pi.name, p.country, SUM(flag_capture) AS flag_capture , SUM(gametime) AS sumgametime FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND pi.banned <> 'Y' AND flag_capture > 0 GROUP BY matchid, pid HAVING sumgametime > 600 ORDER BY flag_capture DESC LIMIT 0,1");
+$sql_mhighflag_kill = small_query("SELECT p.matchid, p.pid, pi.name, p.country, SUM(flag_kill) AS flag_kill , SUM(gametime) AS sumgametime FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND pi.banned <> 'Y' AND flag_kill > 0 GROUP BY matchid, pid HAVING sumgametime > 600 ORDER BY flag_kill DESC LIMIT 0,1");
+$sql_mhighdom_cp = small_query("SELECT p.matchid, p.pid, pi.name, p.country, SUM(dom_cp) AS dom_cp , SUM(gametime) AS sumgametime FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND pi.banned <> 'Y' AND dom_cp > 0 GROUP BY matchid, pid HAVING sumgametime > 600 ORDER BY dom_cp DESC LIMIT 0,1");
+
+$ass_obj_check = small_query("SELECT COUNT(id) AS idcount FROM uts_games WHERE gamename LIKE '%Assault%';") or die(mysql_error());
+IF ($ass_obj_check[idcount] > 0 ) {
+ $sql_mhighass_obj = small_query("SELECT p.matchid, p.pid, pi.name, p.country, SUM(ass_obj) AS ass_obj , SUM(gametime) AS sumgametime FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND pi.banned <> 'Y' AND ass_obj > 0 GROUP BY matchid, pid HAVING sumgametime > 600 ORDER BY ass_obj DESC LIMIT 0,1");
+} else {
+ $sql_mhighass_obj = "";
+}
+
+$sql_mhighspree_monster = small_query("SELECT p.matchid, p.pid, pi.name, p.country, SUM(spree_monster) AS spree_monster , SUM(gametime) AS sumgametime FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND pi.banned <> 'Y' AND spree_monster > 0 GROUP BY matchid, pid HAVING sumgametime > 600 ORDER BY spree_monster DESC LIMIT 0,1");
+$sql_mhighspree_god = small_query("SELECT p.matchid, p.pid, pi.name, p.country, SUM(spree_god) AS spree_god , SUM(gametime) AS sumgametime FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND pi.banned <> 'Y' AND spree_god > 0 GROUP BY matchid, pid HAVING sumgametime > 600 ORDER BY spree_god DESC LIMIT 0,1");
+$sql_mhighrank = small_query("SELECT p.matchid, p.pid, pi.name, p.country, SUM(rank) AS rank , SUM(gametime) AS sumgametime FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND pi.banned <> 'Y' AND rank > 0 GROUP BY matchid, pid HAVING sumgametime > 600 ORDER BY rank DESC LIMIT 0,1");
+
+echo'<table class = "box" border="0" cellpadding="1" cellspacing="2" width="480">
+ <tbody>
+ <tr>
+ <td class="medheading" colspan="4" align="center">Match Highs</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center" width="175">Category</td>
+ <td class="smheading" align="center" width="175">Player</td>
+ <td class="smheading" align="center" width="65">Amount</td>
+ <td class="smheading" align="center" width="65">Match</td>
+ </tr>';
+
+if ($sql_mhighfrags) {
+ echo '
+ <tr>
+ <td class="dark" align="center">Frags</td>
+ <td nowrap class="greyhuman" align="center"><a class="greyhuman" href="./?p=pinfo&pid='.$sql_mhighfrags[pid].'">'.FlagImage($sql_mhighfrags['country'], false).' '.$sql_mhighfrags[name].'</a></td>
+ <td class="grey" align="center">'.$sql_mhighfrags[frags].'</td>
+ <td class="grey" align="center"><a class="greyhuman" href="./?p=match&mid='.$sql_mhighfrags[matchid].'">(click)</a></td>
+ </tr>';
+}
+if ($sql_mhighdeaths) {
+ echo '
+ <tr>
+ <td class="dark" align="center">Deaths</td>
+ <td nowrap class="greyhuman" align="center"><a class="greyhuman" href="./?p=pinfo&pid='.$sql_mhighdeaths[pid].'">'.FlagImage($sql_mhighdeaths['country'], false).' '.$sql_mhighdeaths[name].'</a></td>
+ <td class="grey" align="center">'.$sql_mhighdeaths[deaths].'</td>
+ <td class="grey" align="center"><a class="greyhuman" href="./?p=match&mid='.$sql_mhighdeaths[matchid].'">(click)</a></td>
+ </tr>';
+}
+if ($sql_mhighkills) {
+ echo '
+ <tr>
+ <td class="dark" align="center">Kills</td>
+ <td nowrap class="greyhuman" align="center"><a class="greyhuman" href="./?p=pinfo&pid='.$sql_mhighkills[pid].'">'.FlagImage($sql_mhighkills['country'], false).' '.$sql_mhighkills[name].'</a></td>
+ <td class="grey" align="center">'.$sql_mhighkills[kills].'</td>
+ <td class="grey" align="center"><a class="greyhuman" href="./?p=match&mid='.$sql_mhighkills[matchid].'">(click)</a></td>
+ </tr>';
+}
+if ($sql_mhighsuicides) {
+ echo '
+ <tr>
+ <td class="dark" align="center">Suicides</td>
+ <td nowrap class="greyhuman" align="center"><a class="greyhuman" href="./?p=pinfo&pid='.$sql_mhighsuicides[pid].'">'.FlagImage($sql_mhighsuicides['country'], false).' '.$sql_mhighsuicides[name].'</a></td>
+ <td class="grey" align="center">'.$sql_mhighsuicides[suicides].'</td>
+ <td class="grey" align="center"><a class="greyhuman" href="./?p=match&mid='.$sql_mhighsuicides[matchid].'">(click)</a></td>
+ </tr>';
+}
+if ($sql_mhighteamkills) {
+ echo '
+ <tr>
+ <td class="dark" align="center">Team Kills</td>
+ <td nowrap class="greyhuman" align="center"><a class="greyhuman" href="./?p=pinfo&pid='.$sql_mhighteamkills[pid].'">'.FlagImage($sql_mhighteamkills['country'], false).' '.$sql_mhighteamkills[name].'</a></td>
+ <td class="grey" align="center">'.$sql_mhighteamkills[teamkills].'</td>
+ <td class="grey" align="center"><a class="greyhuman" href="./?p=match&mid='.$sql_mhighteamkills[matchid].'">(click)</a></td>
+ </tr>';
+}
+if ($sql_mhigheff) {
+ echo '
+ <tr>
+ <td class="dark" align="center">Efficiency</td>
+ <td nowrap class="greyhuman" align="center"><a class="greyhuman" href="./?p=pinfo&pid='.$sql_mhigheff[pid].'">'.FlagImage($sql_mhigheff['country'], false).' '.$sql_mhigheff[name].'</a></td>
+ <td class="grey" align="center">'.get_dp($sql_mhigheff[eff]).'</td>
+ <td class="grey" align="center"><a class="greyhuman" href="./?p=match&mid='.$sql_mhigheff[matchid].'">(click)</a></td>
+ </tr>';
+}
+if ($sql_mhighaccuracy) {
+ echo '
+ <tr>
+ <td class="dark" align="center">Accuracy</td>
+ <td nowrap class="greyhuman" align="center"><a class="greyhuman" href="./?p=pinfo&pid='.$sql_mhighaccuracy[pid].'">'.FlagImage($sql_mhighaccuracy['country'], false).' '.$sql_mhighaccuracy[name].'</a></td>
+ <td class="grey" align="center">'.get_dp($sql_mhighaccuracy[accuracy]).'</td>
+ <td class="grey" align="center"><a class="greyhuman" href="./?p=match&mid='.$sql_mhighaccuracy[matchid].'">(click)</a></td>
+ </tr>';
+}
+if ($sql_mhighttl) {
+ echo '
+ <tr>
+ <td class="dark" align="center">TTL</td>
+ <td nowrap class="greyhuman" align="center"><a class="greyhuman" href="./?p=pinfo&pid='.$sql_mhighttl[pid].'">'.FlagImage($sql_mhighttl['country'], false).' '.$sql_mhighttl[name].'</a></td>
+ <td class="grey" align="center">'.get_dp($sql_mhighttl[ttl]).'</td>
+ <td class="grey" align="center"><a class="greyhuman" href="./?p=match&mid='.$sql_mhighttl[matchid].'">(click)</a></td>
+ </tr>';
+}
+if ($sql_mhighflag_capture) {
+ echo '
+ <tr>
+ <td class="dark" align="center">Flag Caps</td>
+ <td nowrap class="greyhuman" align="center"><a class="greyhuman" href="./?p=pinfo&pid='.$sql_mhighflag_capture[pid].'">'.FlagImage($sql_mhighflag_capture['country'], false).' '.$sql_mhighflag_capture[name].'</a></td>
+ <td class="grey" align="center">'.$sql_mhighflag_capture[flag_capture].'</td>
+ <td class="grey" align="center"><a class="greyhuman" href="./?p=match&mid='.$sql_mhighflag_capture[matchid].'">(click)</a></td>
+ </tr>';
+}
+if ($sql_mhighflag_kill) {
+ echo '
+ <tr>
+ <td class="dark" align="center">Flag Kills</td>
+ <td nowrap class="greyhuman" align="center"><a class="greyhuman" href="./?p=pinfo&pid='.$sql_mhighflag_kill[pid].'">'.FlagImage($sql_mhighflag_kill['country'], false).' '.$sql_mhighflag_kill[name].'</a></td>
+ <td class="grey" align="center">'.$sql_mhighflag_kill[flag_kill].'</td>
+ <td class="grey" align="center"><a class="greyhuman" href="./?p=match&mid='.$sql_mhighflag_kill[matchid].'">(click)</a></td>
+ </tr>';
+}
+if ($sql_mhighdom_cp) {
+ echo '
+ <tr>
+ <td class="dark" align="center">Domination Control Points</td>
+ <td nowrap class="greyhuman" align="center"><a class="greyhuman" href="./?p=pinfo&pid='.$sql_mhighdom_cp[pid].'">'.FlagImage($sql_mhighdom_cp['country'], false).' '.$sql_mhighdom_cp[name].'</a></td>
+ <td class="grey" align="center">'.$sql_mhighdom_cp[dom_cp].'</td>
+ <td class="grey" align="center"><a class="greyhuman" href="./?p=match&mid='.$sql_mhighdom_cp[matchid].'">(click)</a></td>
+ </tr>';
+}
+if ($sql_mhighass_obj) {
+ echo '
+ <tr>
+ <td class="dark" align="center">Assault Objectives</td>
+ <td nowrap class="greyhuman" align="center"><a class="greyhuman" href="./?p=pinfo&pid='.$sql_mhighass_obj[pid].'">'.FlagImage($sql_mhighass_obj['country'], false).' '.$sql_mhighass_obj[name].'</a></td>
+ <td class="grey" align="center">'.$sql_mhighass_obj[ass_obj].'</td>
+ <td class="grey" align="center"><a class="greyhuman" href="./?p=match&mid='.$sql_mhighass_obj[matchid].'">(click)</a></td>
+ </tr>';
+}
+if ($sql_mhighspree_monster) {
+ echo '
+ <tr>
+ <td class="dark" align="center">Monster Kills</td>
+ <td nowrap class="greyhuman" align="center"><a class="greyhuman" href="./?p=pinfo&pid='.$sql_mhighspree_monster[pid].'">'.FlagImage($sql_mhighspree_monster['country'], false).' '.$sql_mhighspree_monster[name].'</a></td>
+ <td class="grey" align="center">'.$sql_mhighspree_monster[spree_monster].'</td>
+ <td class="grey" align="center"><a class="greyhuman" href="./?p=match&mid='.$sql_mhighspree_monster[matchid].'">(click)</a></td>
+ </tr>';
+}
+if ($sql_mhighspree_god) {
+ echo '
+ <tr>
+ <td class="dark" align="center">Godlikes</td>
+ <td nowrap class="greyhuman" align="center"><a class="greyhuman" href="./?p=pinfo&pid='.$sql_mhighspree_god[pid].'">'.FlagImage($sql_mhighspree_god['country'], false).' '.$sql_mhighspree_god[name].'</a></td>
+ <td class="grey" align="center">'.$sql_mhighspree_god[spree_god].'</td>
+ <td class="grey" align="center"><a class="greyhuman" href="./?p=match&mid='.$sql_mhighspree_god[matchid].'">(click)</a></td>
+ </tr>';
+}
+if ($sql_mhighrank) {
+ echo '
+ <tr>
+ <td class="dark" align="center">Rank Points</td>
+ <td nowrap class="greyhuman" align="center"><a class="greyhuman" href="./?p=pinfo&pid='.$sql_mhighrank[pid].'">'.FlagImage($sql_mhighrank['country'], false).' '.$sql_mhighrank[name].'</a></td>
+ <td class="grey" align="center">'.get_dp($sql_mhighrank[rank]).'</td>
+ <td class="grey" align="center"><a class="greyhuman" href="./?p=match&mid='.$sql_mhighrank[matchid].'">(click)</a></td>
+ </tr>';
+}
+echo '
+</tbody></table>
+<br>
+<table class = "box" border="0" cellpadding="1" cellspacing="2" width="480">
+ <tbody>
+<tr>
+ <td class="medheading" colspan="4" align="center">Weapon Career Highs</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center" width="175">Category</td>
+ <td class="smheading" align="center" width="175">Player</td>
+ <td class="smheading" align="center" width="65">Kills</td>
+ <td class="smheading" align="center" width="65">Matches</td>
+ </tr>
+';
+
+$sql_mweapons = "SELECT id, name, image FROM uts_weapons WHERE hide <> 'Y' ORDER BY sequence, id ASC";
+$q_mweapons = mysql_query($sql_mweapons) or die(mysql_error());
+while ($r_mweapons = mysql_fetch_array($q_mweapons)) {
+
+ $wid = $r_mweapons[id];
+ $sql_mweaponsl = "SELECT w.pid AS playerid, pi.name AS name, pi.country AS country, SUM(w.kills) as kills, COUNT(DISTINCT w.matchid) AS mcount FROM uts_weaponstats AS w LEFT JOIN uts_pinfo AS pi ON w.pid = pi.id WHERE w.weapon = '$wid' AND w.pid > 0 AND w.matchid <> 0 AND pi.banned <> 'Y' GROUP BY w.pid ORDER BY kills DESC LIMIT 0,1";
+ $q_mweaponsl = mysql_query($sql_mweaponsl) or die(mysql_error());
+ while ($r_mweaponsl = mysql_fetch_array($q_mweaponsl)) {
+
+ echo '<tr>
+ <td class="dark" align="center">'.$r_mweapons[name].'</td>
+ <td class="greyhuman" align="center"><a class="greyhuman" href="./?p=pinfo&pid='.$r_mweaponsl[playerid].'">'.FlagImage($r_mweaponsl[country], false).' '.$r_mweaponsl[name].'</a></td>
+ <td class="grey" align="center">'.$r_mweaponsl[kills].'</td>
+ <td class="grey" align="center">'.$r_mweaponsl[mcount].'</td>
+ </tr>';
+
+ }
+}
+
+echo '</tbody></table>
+<br>';
+
+// NGStats Style Weapon Highs (All Time)
+
+echo '<table class = "box" border="0" cellpadding="1" cellspacing="2" width="480">
+ <tbody>
+<tr>
+ <td class="medheading" colspan="4" align="center">Weapon Match Highs</td>
+ </tr>
+ <tr>
+ <td class="smheading" align="center" width="175">Category</td>
+ <td class="smheading" align="center" width="175">Player</td>
+ <td class="smheading" align="center" width="65">Kills</td>
+ <td class="smheading" align="center" width="65">Match</td>
+ </tr>
+';
+
+$sql_mweapons = "SELECT id, name, image FROM uts_weapons WHERE hide <> 'Y' ORDER BY sequence, id ASC";
+$q_mweapons = mysql_query($sql_mweapons) or die(mysql_error());
+while ($r_mweapons = mysql_fetch_array($q_mweapons)) {
+
+ $wid = $r_mweapons[id];
+ $sql_mweaponsl = "SELECT w.matchid, w.pid AS playerid, pi.name AS name, pi.country AS country, w.kills FROM uts_weaponstats AS w LEFT JOIN uts_pinfo AS pi ON w.pid = pi.id WHERE w.weapon = '$wid' AND w.pid > 0 AND w.matchid > 0 AND pi.banned <> 'Y' ORDER BY w.kills DESC LIMIT 0,1";
+ $q_mweaponsl = mysql_query($sql_mweaponsl) or die(mysql_error());
+ while ($r_mweaponsl = mysql_fetch_array($q_mweaponsl)) {
+
+ echo '<tr>
+ <td class="dark" align="center">'.$r_mweapons[name].'</td>
+ <td class="greyhuman" align="center"><a class="greyhuman" href="./?p=pinfo&pid='.$r_mweaponsl[playerid].'">'.FlagImage($r_mweaponsl[country], false).' '.$r_mweaponsl[name].'</a></td>
+ <td class="grey" align="center">'.$r_mweaponsl[kills].'</td>
+ <td class="grey" align="center"><a class="greyhuman" href="./?p=match&mid='.$r_mweaponsl[matchid].'">(click)</a></td>
+ </tr>';
+ }
+}
+
+// NGStats Style Weapon Highs (Single Match)
+echo'</tbody></table>';
+?>
diff --git a/html/pages/watchlist.php b/html/pages/watchlist.php new file mode 100755 index 0000000..bfc8512 --- /dev/null +++ b/html/pages/watchlist.php @@ -0,0 +1,106 @@ +<?php
+global $s_lastvisit;
+echo'
+<table class = "box" border="0" cellpadding="1" cellspacing="2" width="720">
+ <tbody><tr>
+ <td class="heading" align="center">Your Watchlist</td>
+ </tr>
+</tbody></table>';
+echo '<br><br><br>';
+
+
+$watchlist = GetCurrentWatchlist();
+if (count($watchlist) > 25) $watchlist = array_slice($watchlist, 0, 25);
+if (count($watchlist) == 0) {
+ echo "<p class='pages'>Your watchlist is empty!<br><br>You can add players to your watchlist by clicking the appropriate icon on the header of their career summary page.</p>";
+ return;
+}
+
+echo '
+<table class="box" border="0" cellpadding="1" cellspacing="1" width="625">
+ <tbody>
+ <tr>
+ <td class="smheading" align="center" width="150">Player Name</td>
+ <td class="smheading" align="center">Last Match</td>
+ <td class="smheading" align="center">Matches</td>
+ <td class="smheading" align="center">Score</td>
+ <td class="smheading" align="center">Frags</td>
+ <td class="smheading" align="center">Kills</td>
+ <td class="smheading" align="center">Deaths</td>
+ <td class="smheading" align="center">Suicides</td>
+ <td class="smheading" align="center">Eff</td>
+ <td class="smheading" align="center">Acc</td>
+ <td class="smheading" align="center">TTL</td>
+ <td class="smheading" align="center">Hours</td>
+ </tr>';
+
+
+$i = 0;
+foreach($watchlist as $pid) {
+ $sql_players = "SELECT pi.id AS pid,
+ pi.name,
+ pi.country,
+ m.time,
+ m.id AS mid
+ FROM uts_pinfo pi,
+ uts_match m,
+ uts_player p
+ WHERE pi.id = '$pid'
+ AND p.matchid = m.id
+ AND p.pid = pi.id
+ ORDER BY m.time DESC
+ LIMIT 0,1
+ ";
+
+ $sql_pinfo = " SELECT COUNT(*) AS games,
+ SUM(p.gamescore) as gamescore,
+ SUM(p.frags) AS frags,
+ SUM(p.kills) AS kills,
+ SUM(p.deaths) AS deaths,
+ SUM(p.suicides) as suicides,
+ AVG(p.eff) AS eff,
+ AVG(p.accuracy) AS accuracy,
+ AVG(p.ttl) AS ttl,
+ SUM(gametime) as gametime
+ FROM uts_player AS p
+ WHERE p.pid = '$pid'
+ GROUP BY p.pid";
+ $r_pinfo = small_query($sql_pinfo);
+
+ $q_players = mysql_query($sql_players) or die(mysql_error());
+
+
+ while ($r_players = mysql_fetch_array($q_players)) {
+ $i++;
+ $new = (mtimestamp($r_players['time']) > $s_lastvisit) ? true : false;
+ $class = ($i % 2) ? 'grey' : 'grey2';
+ echo '<tr>';
+ echo '<td class="dark"><a class="darkhuman" href="?p=pinfo&pid='. $r_players['pid'] .'">';
+ echo FormatPlayerName($r_players['country'], $r_players['pid'], $r_players['name']);
+ echo '</a></td>';
+ echo '<td class="'.$class.'" align="center"><a class="'.$class.'" href="?p=match&mid='. $r_players['mid'] .'">';;
+ if ($new) echo "<strong>";
+ echo date("Y-m-d H:i", mtimestamp($r_players['time']));
+ if ($new) echo "</strong>";
+ echo '</a></td>';
+
+ echo '
+ <td class="'.$class.'" align="center">'.$r_pinfo['games'].'</td>
+ <td class="'.$class.'" align="center">'.$r_pinfo['gamescore'].'</td>
+ <td class="'.$class.'" align="center">'.$r_pinfo['frags'].'</td>
+ <td class="'.$class.'" align="center">'.$r_pinfo['kills'].'</td>
+ <td class="'.$class.'" align="center">'.$r_pinfo['deaths'].'</td>
+ <td class="'.$class.'" align="center">'.$r_pinfo['suicides'].'</td>
+ <td class="'.$class.'" align="center">'.get_dp($r_pinfo['eff']).'</td>
+ <td class="'.$class.'" align="center">'.get_dp($r_pinfo['accuracy']).'</td>
+ <td class="'.$class.'" align="center">'.GetMinutes($r_pinfo['ttl']).'</td>
+ <td class="'.$class.'" align="center">'.sec2hour($r_pinfo['gametime']).'</td>';
+
+ echo '</tr>';
+ }
+}
+
+echo '</tbody></table>';
+
+
+?>
diff --git a/html/pic.php b/html/pic.php new file mode 100755 index 0000000..8123dd7 --- /dev/null +++ b/html/pic.php @@ -0,0 +1,348 @@ +<?php
+require ("includes/config.php");
+require ("includes/config_pic.php");
+require ("includes/functions.php");
+
+if (!isset($pic_enable) or !$pic_enable) pic_error('err_disabled');
+
+
+function pic_error($name) {
+ header("Content-type: image/png");
+ readfile("images/templates/${name}.png");
+ exit;
+}
+
+function place_text(&$im, $size, $angle, $x, $to_x, $y, $to_y, $color, $font, $align, $text) {
+ $cp = allocate_color($im, $color);
+ $box = imagettfbbox($size, $angle, $font, $text);
+ $twidth = $box[4] - $box[0];
+
+ switch($align) {
+ case 'center':
+ $p_x = ($to_x - $x) / 2 - ceil($twidth/2); break;
+ case 'right':
+ $p_x = $to_x - $twidth; break;
+ default:
+ $p_x = $x;
+ }
+ imagettftext($im, $size, $angle, $p_x, $y, $cp, $font, $text);
+}
+
+function image_create($filename, &$load) {
+ if (!file_exists($filename)) return(false);
+ $infos = getimagesize($filename);
+ if (!$infos) return(false);
+ switch($infos[2]) {
+ case 1:
+ $im = @imagecreatefromgif($filename);
+ break;
+ case 2:
+ $im = @imagecreatefromjpeg($filename);
+ break;
+ case 3:
+ $im = @imagecreatefrompng($filename);
+ break;
+ default:
+ die("Unsupported image type");
+ }
+ if (!$im) die("Unable to load image template");
+ if (!$load['recreate']) return($im);
+
+ $in = imagecreatetruecolor(imagesx($im), imagesy($im));
+ if (!empty($load['bgcolor'])) {
+ $bg = allocate_color($in, $load['bgcolor']);
+ imagefill($in, 0, 0, $bg);
+ }
+ if ($load['bgtransparent']) imagecolortransparent($in, $bg);
+ imagecopy($in, $im, 0, 0, 0, 0, imagesx($im), imagesy($im)) or die("Unable to copy image");
+ imagedestroy($im);
+
+ return($in);
+}
+
+
+function allocate_color(&$im, $colstring) {
+ static $cache = array();
+
+ if (isset($cache[$colstring])) return($cache[$colstring]);
+
+ $col = explode(':', substr(chunk_split($colstring, 2, ':'), 0, -1));
+ $r = hexdec($col[0]);
+ $g = hexdec($col[1]);
+ $b = hexdec($col[2]);
+ if (isset($col[3])) {
+ $alpha = hexdec($col[3]);
+ $cp = imagecolorallocatealpha($im, $r, $g, $b, $alpha);
+ } else {
+ $cp = imagecolorallocate($im, $r, $g, $b);
+ }
+ $cache[$colstring] = $cp;
+ return($cp);
+}
+
+function output_image(&$im, &$options) {
+ switch($options['type']) {
+ case 'jpg':
+ header("Content-type: image/jpeg");
+ imagejpeg($im);
+ break;
+
+ case 'gif':
+ header("Content-type: image/gif");
+ imagegif($im);
+ break;
+
+ default:
+ header("Content-type: image/png");
+ imagepng($im);
+ }
+}
+
+
+function replace_vars($text, &$searchrepl) {
+ static $search = NULL;
+ static $replace = NULL;
+
+ if ($search === NULL) {
+ $search = array();
+ $replace = array();
+ foreach($searchrepl as $key => $value) {
+ $search[] = $key;
+ $replace[] = $value;
+ }
+ }
+
+ $text = str_replace($search, $replace, $text);
+
+ if (!empty($searchrepl['%GID%'])) {
+ $rankingtext = RankImageOrText($searchrepl['%PID%'], $searchrepl['%PLAYERNAME%'], 0, $searchrepl['%GID%'], $searchrepl['%GAMENAME%'], false, $text, NULL);
+ if (!empty($rankingtext)) $text = $rankingtext;
+ }
+ return($text);
+}
+
+
+
+function get_values($date_from, $date_to, $pid, $gid, $prefix, &$searchrepl) {
+ $sql_time = (empty($date_from)) ? '' : "AND m.time >= '".date("YmdHis", $week_start)."' and m.time <= '".date("YmdHis", $week_end);
+ $sql_gid = (empty($gid)) ? '' : "AND m.gid = '$gid'";
+ $sql_order = ($prefix != 'LM') ? '' : 'ORDER BY m.time DESC LIMIT 0,1';
+ $sql_groupby = ($prefix != 'LM') ? 'p.pid' : '1';
+ $sql = " SELECT m.time AS gamedate,
+ COUNT(*) AS games,
+ SUM(p.gamescore) as gamescore,
+ SUM(p.frags) AS frags,
+ SUM(p.kills) AS kills,
+ SUM(p.deaths) AS deaths,
+ SUM(p.suicides) as suicides,
+ AVG(p.eff) AS eff,
+ AVG(p.accuracy) AS acc,
+ AVG(p.ttl) AS ttl,
+ SUM(p.gametime) as gametime,
+ SUM(p.flag_capture) as flag_capture,
+ SUM(p.flag_cover) as flag_cover,
+ SUM(p.flag_seal) as flag_cover,
+ SUM(p.flag_assist) as flag_assist,
+ SUM(p.flag_kill) as flag_kill,
+ SUM(p.flag_pickedup) as flag_pickedup,
+ SUM(p.dom_cp) as dom_cp,
+ SUM(p.ass_obj) as ass_obj,
+ SUM(p.spree_double) as spree_double,
+ SUM(p.spree_triple) as spree_triple,
+ SUM(p.spree_multi) as spree_multi,
+ SUM(p.spree_mega) as spree_mega,
+ SUM(p.spree_ultra) as spree_ultra,
+ SUM(p.spree_monster) as spree_monster,
+ SUM(p.spree_kill) as spree_kill,
+ SUM(p.spree_rampage) as spree_rampage,
+ SUM(p.spree_dom) as spree_dom,
+ SUM(p.spree_uns) as spree_uns,
+ SUM(p.spree_god) as spree_god,
+ SUM(p.pu_pads) as pu_pads,
+ SUM(p.pu_armour) as pu_armour,
+ SUM(p.pu_keg) as pu_keg,
+ SUM(p.pu_invis) as pu_invis,
+ SUM(p.pu_belt) as pu_belt,
+ SUM(p.pu_amp) as pu_amp,
+ SUM(p.rank) as rankmovement
+ FROM uts_match AS m,
+ uts_player AS p
+ WHERE m.id = p.matchid
+ $sql_time
+ $sql_gid
+ AND p.pid = '$pid'
+ GROUP BY $sql_groupby
+ $sql_order";
+ $result = small_query($sql);
+ if (!$result) return;
+ foreach($result as $name => $value) {
+ $name = strtoupper($name);
+ switch($name) {
+ case 'EFF': $value = get_dp($value); break;
+ case 'ACC': $value = get_dp($value); break;
+ case 'TTL': $value = GetMinutes($value); break;
+ case 'GAMETIME': $value = sec2hour($value); break;
+ case 'GAMEDATE': $value = date("Y-m-d H:i", mtimestamp($value)); break;
+ case 'RANKMOVEMENT': $value = ($value >= 0) ? '+'.get_dp($value) : get_dp($value); break;
+ }
+ $searchrepl["%${prefix}_${name}%"] = $value;
+ }
+}
+
+
+
+
+?>
+<?php
+
+
+
+if (!function_exists("gd_info")) {
+ if (!check_extension('gd2')) pic_error('err_no_gd');
+}
+
+$gd_info = gd_info();
+if (!$gd_info['FreeType Support']) pic_error('err_no_ft');
+
+
+$num = isset($_GET['num']) ? $_GET['num'] : 0;
+$pid = isset($_GET['pid']) ? my_addslashes($_GET['pid']) : 0;
+$gid = isset($_GET['gid']) ? my_addslashes($_GET['gid']) : 0;
+
+
+if ($num == 0 and $pid == 0 and $gid == 0 and !empty($_SERVER['PATH_INFO'])) {
+ $pi = explode('/', $_SERVER['PATH_INFO']);
+ list($void, $num, $pid, $gid) = $pi;
+}
+
+if (!isset($pic[$num]) or !$pic[$num]['enabled']) pic_error('err_na');
+$load = &$pic[$num]['load'];
+$std = &$pic[$num]['default'];
+$output = &$pic[$num]['output'];
+
+
+
+
+if (empty($pid)) die("No pid supplied");
+$r_pinfo = small_query("SELECT name, country, banned FROM uts_pinfo WHERE id = '$pid'");
+if (!$r_pinfo) die("Unable to fetch player record");
+if ($r_pinfo['banned'] == 'Y') pic_error('err_banned');
+$playername = $r_pinfo['name'];
+$playercountry = $r_pinfo['country'];
+
+
+$gamename = '(unknown)';
+if (!empty($gid)) {
+ $r_gameinfo = small_query("SELECT name FROM uts_games WHERE id = '$gid'");
+ if (!$r_gameinfo) die("Unable to fetch game record");
+ $gamename = $r_gameinfo['name'];
+}
+
+
+$searchrepl = array( '%GID%' => $gid,
+ '%PID%' => $pid,
+ '%GAMENAME%' => $gamename,
+ '%PLAYERNAME%' => $playername,
+ '%PLAYERCOUNTRY%' => strtoupper($playercountry)
+ );
+//$search = array('%RT%', '%RN%', '%RP%', '%RI%', '%GN%', '%PN%', '%IT%');
+//$replace = array($ranktext, $rank, $points, $img, $gamename, $name, $imageortext);
+
+
+// Add all texts that are used in this pic to one big string
+// We'll use this string to determine which values the user wants
+// and hence which we'll have to provide
+$textstrings = '';
+foreach ($pic[$num]['process'] as $process) {
+ if ($process['type'] != 'text') continue;
+ $textstrings .= $process['value'];
+}
+
+
+$ts = time();
+if (strpos($textstrings, '%WEEK_') !== false) {
+ $week_start = mktime(0,0,0, date('m', $ts), date('d', $ts) - date('w', $ts), date('Y', $ts));
+ $week_end = mktime(23,59,59, date('m', $week_start), date('d', $week_start) + 6, date('Y', $ts));
+ get_values($week_start, $week_end, $pid, $gid, 'WEEK', $searchrepl);
+}
+
+if (strpos($textstrings, '%LWEEK_') !== false) {
+ $last_week_start = mktime(0,0,0, date('m', $ts), date('d', $ts) - date('w', $ts) - 7, date('Y', $ts));
+ $last_week_end = mktime(23,59,59, date('m', $last_week_start), date('d', $last_week_start) + 6, date('Y', $ts));
+ get_values($last_week_start, $last_week_end, $pid, $gid, 'LWEEK', $searchrepl);
+}
+
+if (strpos($textstrings, '%MONTH_') !== false) {
+ $month_start = mktime(0,0,0, date('m', $ts), 1, date('Y', $ts));
+ $month_end = mktime(23,59,59, date('m', $month_start) + 1, 0, date('Y', $month_start));
+ get_values($month_start, $month_end, $pid, $gid, 'MONTH', $searchrepl);
+}
+
+if (strpos($textstrings, '%LMONTH_') !== false) {
+ $last_month_start = mktime(0,0,0, date('m', $ts) - 1, 1, date('Y', $ts));
+ $last_month_end = mktime(23,59,59, date('m', $last_month_start) + 1, 0, date('Y', $last_month_start));
+ get_values($last_month_start, $last_month_end, $pid, $gid, 'LMONTH', $searchrepl);
+}
+
+if (strpos($textstrings, '%YEAR_') !== false) {
+ $year_start = mktime(0,0,0, 1, 1, date('Y', $ts));
+ $year_end = mktime(23,59,59, 12, 31, date('Y', $year_start));
+ get_values($year_start, $year_end, $pid, $gid, 'YEAR', $searchrepl);
+}
+
+if (strpos($textstrings, '%LYEAR_') !== false) {
+ $last_year_start = mktime(0,0,0, 1, 1, date('Y', $ts) - 1);
+ $last_year_end = mktime(23,59,59, 12, 31, date('Y', $last_year_start));
+ get_values($last_year_start, $last_year_end, $pid, $gid, 'LYEAR', $searchrepl);
+}
+
+if (strpos($textstrings, '%TOTAL_') !== false) {
+ get_values(0, 0, $pid, $gid, 'TOTAL', $searchrepl);
+}
+
+if (strpos($textstrings, '%GTOTAL_') !== false) {
+ get_values(0, 0, $pid, 0, 'GTOTAL', $searchrepl);
+}
+
+if (strpos($textstrings, '%LM_') !== false) {
+ get_values(0, 0, $pid, $gid, 'LM', $searchrepl);
+}
+
+//echo "<pre>"; var_dump($searchrepl); echo "</pre>"; exit;
+
+
+$im = image_create('images/templates/'. $load['template'], $load);
+
+$img_width = imagesx($im);
+$img_height = imagesy($im);
+
+if (empty($std['align'])) $std['align'] = 'left';
+if (empty($std['angle'])) $std['angle'] = 0;
+if (empty($std['font'])) $std['font'] = 'microsbe.ttf';
+if (empty($std['fontcolor'])) $std['fontcolor'] = 'FFFFFF';
+if (empty($std['fontsize'])) $std['fontsize'] = 12;
+
+foreach ($pic[$num]['process'] as $process) {
+ switch($process['type']) {
+ case 'text':
+ if (empty($process['align'])) $process['align'] = $std['align'];
+ if (empty($process['font'])) $process['font'] = $std['font'];
+ if (empty($process['fontcolor'])) $process['fontcolor'] = $std['fontcolor'];
+ if (empty($process['fontsize'])) $process['fontsize'] = $std['fontsize'];
+ if (empty($process['angle'])) $process['angle'] = $std['angle'];
+ if (empty($process['x_to'])) $process['x_to'] = $img_width;
+ if (empty($process['y_to'])) $process['y_to'] = $process['y_from'];
+
+ $text = replace_vars($process['value'], $searchrepl);
+ place_text($im, $process['fontsize'], $process['angle'], $process['x_from'], $process['x_to'], $process['y_from'], $process['y_to'], $process['fontcolor'], 'images/fonts/'.$process['font'], $process['align'], $text);
+ break;
+
+ default:
+ die("Don't know how to process: ". $process['type']);
+ }
+
+}
+
+output_image($im, $output);
+
+?>
\ No newline at end of file diff --git a/html/style.css b/html/style.css new file mode 100755 index 0000000..a192541 --- /dev/null +++ b/html/style.css @@ -0,0 +1,107 @@ +BODY {BACKGROUND: #243954 url(images/sidebar.gif); background-repeat: repeat-y; COLOR: #ffffff}
+a {FONT-FAMILY: Verdana,Geneva,Arial,Helvetica,sans-serif; FONT-SIZE: 10pt; COLOR: #ffcc66; TEXT-DECORATION: none}
+a:hover {FONT-FAMILY: Verdana,Geneva,Arial,Helvetica,sans-serif; FONT-SIZE: 10pt; COLOR: #ffffff; TEXT-DECORATION: none}
+.text {FONT-FAMILY: Verdana,Geneva,Arial,Helvetica,sans-serif; FONT-SIZE: 10pt; COLOR: #efefef}
+.text2 {FONT-FAMILY: Verdana,Geneva,Arial,Helvetica,sans-serif; FONT-SIZE: 7pt; COLOR: #efefef}
+.txttitle {FONT-FAMILY: Verdana,Geneva,Arial,Helvetica,sans-serif; FONT-SIZE: 14pt; COLOR: #eaeaea; FONT-WEIGHT: bold}
+.rangtext {FONT-FAMILY: Verdana,Geneva,Arial,Helvetica,sans-serif; FONT-SIZE: 7pt; COLOR: #808080}
+
+.box {border: 1px #5d6c81 solid}
+.darkbox {border: 1px #2C323A solid}
+.heading {FONT-FAMILY: Arial, Helvetica, Sans-serif; FONT-SIZE: 12pt; COLOR: #ffffcc; background: #58677c; FONT-WEIGHT: bold}
+a.heading {FONT-FAMILY: Arial, Helvetica, Sans-serif; FONT-SIZE: 12pt; COLOR: #ffee66; background: #58677c; FONT-WEIGHT: bold}
+a.heading:hover {FONT-FAMILY: Arial, Helvetica, Sans-serif; FONT-SIZE: 12pt; COLOR: #ffffff; background: #58677c; FONT-WEIGHT: bold}
+.medheading {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 10pt; COLOR: #f7fbff; background: #58677c; FONT-WEIGHT: bold}
+.hlheading {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 10pt; COLOR: #dfedff; background: #58677c; FONT-WEIGHT: bold}
+.smheading {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #f7fbff; background: #58677c; FONT-WEIGHT: bold; TEXT-DECORATION: none}
+a.smheading:hover {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #fdd932; BACKGROUND: #58677c; FONT-WEIGHT: bold; TEXT-DECORATION: none}
+.smheadingx {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 7pt; COLOR: #f7fbff; background: #58677c; FONT-WEIGHT: bold; TEXT-DECORATION: none}
+.blank {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 10pt; COLOR: #243954; background: #243954; FONT-WEIGHT: normal}
+
+.lggrey {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #dfedff; background: #485464; FONT-WEIGHT: bold}
+a.lggrey {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #dfedff; background: #485464; FONT-WEIGHT: bold}
+a.lggrey:hover {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #ffffff; background: #485464; FONT-WEIGHT: bold}
+
+.dark {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #dfdfdf; background: #2E3038; FONT-WEIGHT: normal}
+a.dark {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #dfdfdf; background: #2E3038; FONT-WEIGHT: normal}
+a.dark:hover {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #ffffff; background: #2E3038; FONT-WEIGHT: normal}
+
+.grey {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #ffffff; background: #6c6c6c; FONT-WEIGHT: normal}
+a.grey {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #f4d01e; background: #6c6c6c; FONT-WEIGHT: normal}
+a.grey:hover {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #ffffff; background: #6c6c6c; FONT-WEIGHT: normal}
+
+.grey2 {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #ffffff; background: #606060; FONT-WEIGHT: normal}
+a.grey2 {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #f4d01e; background: #606060; FONT-WEIGHT: normal}
+a.grey2:hover {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #ffffff; background: #606060; FONT-WEIGHT: normal}
+
+.darkgrey2 {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #000000; background: #747474; FONT-WEIGHT: normal}
+a.dakgrey2 {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #f4d01e; background: #747474; FONT-WEIGHT: normal}
+a.darkgrey2:hover {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #ffffff; background: #747474; FONT-WEIGHT: normal}
+
+
+.darkgrey {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #000000; background: #808080; FONT-WEIGHT: normal}
+.warn {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #880000; background: #aeaeae; FONT-WEIGHT: bold}
+.gselog {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #0f5465; background: #aeaeae; FONT-WEIGHT: bold}
+.tclog {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #4d2821; background: #aeaeae; FONT-WEIGHT: bold}
+.opnote {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #af3020; FONT-WEIGHT: bold}
+
+.chatlink {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 10pt; COLOR: #ffffff; background: #303441; FONT-WEIGHT: bold}
+a.chatlink {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 10pt; COLOR: #ffff00; background: #303441; FONT-WEIGHT: bold}
+a.chatlink:hover {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 10pt; COLOR: #ffffff; background: #303441; FONT-WEIGHT: bold}
+
+.chat {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #000000; background: #cccccc; FONT-WEIGHT: bold}
+.chatred {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #800000; background: #cccccc; FONT-WEIGHT: bold}
+.chatblue {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #000080; background: #cccccc; FONT-WEIGHT: bold}
+.chatsys {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #408040; background: #cccccc; FONT-WEIGHT: bold}
+.chatkill {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #A4A21C; background: #cccccc; FONT-WEIGHT: bold}
+.blueteamscore {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #505080; background: #cccccc; FONT-WEIGHT: bold}
+.redteamscore {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #805050; background: #cccccc; FONT-WEIGHT: bold}
+
+.connect {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #ffffff; background: #6c6c6c; FONT-WEIGHT: normal}
+.disconnect {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #880000; background: #9f9f9f; FONT-WEIGHT: bold}
+
+.greyhuman {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #e4bf12; background: #6c6c6c; FONT-WEIGHT: normal; TEXT-DECORATION: none}
+a.greyhuman {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #e4bf12; background: #6c6c6c; FONT-WEIGHT: normal; TEXT-DECORATION: none}
+a.greyhuman:hover {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #ffffff; background: #6c6c6c; FONT-WEIGHT: normal; TEXT-DECORATION: none}
+.darkhuman {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #fdd932; background: #2E3038; FONT-WEIGHT: normal; TEXT-DECORATION: none}
+a.darkhuman {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #fdd932; background: #2E3038; FONT-WEIGHT: normal; TEXT-DECORATION: none}
+a.darkhuman:hover {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #ffffff; background: #2E3038; FONT-WEIGHT: normal; TEXT-DECORATION: none}
+
+.darkbot {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #0575dd; BACKGROUND: #2E3038; FONT-WEIGHT: normal; TEXT-DECORATION: none}
+a.darkbot {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #0575dd; BACKGROUND: #2E3038; FONT-WEIGHT: normal; TEXT-DECORATION: none}
+a.darkbot:hover {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #ffffff; BACKGROUND: #2E3038; FONT-WEIGHT: normal; TEXT-DECORATION: none}
+
+.darkid {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #dfdfdf; background: #2E3038; FONT-WEIGHT: normal; TEXT-DECORATION: none}
+a.darkid {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #dfdfdf; background: #2E3038; FONT-WEIGHT: normal; TEXT-DECORATION: none}
+a.darkid:hover {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #ffffff; background: #2E3038; FONT-WEIGHT: normal; TEXT-DECORATION: none}
+
+.sidebar {FONT-FAMILY: Arial, Helvetica, sans-serif; FONT-SIZE: 10pt; COLOR: #000000; BACKGROUND: #58677C; FONT-WEIGHT: bold}
+a.sidebar {FONT-FAMILY: Arial, Helvetica, sans-serif; FONT-SIZE: 10pt; COLOR: #000000; BACKGROUND: #58677C; FONT-WEIGHT: bold; TEXT-DECORATION: none}
+a.sidebar:hover {FONT-FAMILY: Arial, Helvetica, sans-serif; FONT-SIZE: 10pt; COLOR: #ffffff; BACKGROUND: #58677C; FONT-WEIGHT: bold; TEXT-DECORATION: none}
+
+.pages {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #bdbd8c; FONT-WEIGHT: bold}
+a.pages {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #eeeebb; FONT-WEIGHT: bold; TEXT-DECORATION: none}
+a.pages:hover {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #ffffff; FONT-WEIGHT: bold; TEXT-DECORATION: none}
+
+.blueteam {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #000000; background: #0000ff; FONT-WEIGHT: bold}
+.redteam {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #000000; background: #ff0000; FONT-WEIGHT: bold}
+.greenteam {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #000000; background: #00ff00; FONT-WEIGHT: bold}
+.goldteam {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #000000; background: #ffd700; FONT-WEIGHT: bold}
+
+.lglheading {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 10pt; COLOR: #fdd30d; background: #58677c; FONT-WEIGHT: bold}
+a.lglheading {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 10pt; COLOR: #f7fbff; background: #58677c; FONT-WEIGHT: bold}
+a.lglheading:hover {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 10pt; COLOR: #ffffff; background: #58677c; FONT-WEIGHT: bold}
+
+.status {FONT-FAMILY: Verdana,Helvetica; FONT-SIZE: 12px; border: 1px #666666 solid}
+.statustitle {FONT-FAMILY: Verdana,Helvetica; FONT-SIZE: 12px; COLOR: #ffffcc; BACKGROUND: #303441}
+
+.searchform {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; FONT-WEIGHT: normal}
+.searchformb {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; FONT-WEIGHT: bold}
+
+.titlemsg {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 10pt; COLOR: #efefef; FONT-WEIGHT: bold}
+.mainbody {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 10pt; COLOR: #efefef; FONT-WEIGHT: bold}
+a.mainbody {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 10pt; COLOR: #f4d01e; FONT-WEIGHT: bold}
+a.mainbody:hover {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 10pt; COLOR: #ffffff; FONT-WEIGHT: bold}
+.epicinfo {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #efefef; FONT-WEIGHT: bold}
+a.epicinfo {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #caad20; FONT-WEIGHT: bold; TEXT-DECORATION: none}
+a.epicinfo:hover {FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt; COLOR: #ffffff; FONT-WEIGHT: bold; TEXT-DECORATION: none}
diff --git a/info.txt b/info.txt new file mode 100755 index 0000000..ef1f220 --- /dev/null +++ b/info.txt @@ -0,0 +1,52 @@ +UTStats
+Copyright (C) 2004/2005 azazel, )°DoE°(-AnthraX and toa
+
+This program is free software; you can redistribute and/or modify
+it under the terms of the Open Unreal Mod License.
+See license.txt for more information.
+
+===================
+UTStats Information
+===================
+
+What Is It
+----------
+UTStats is a Serverside Actor and websystem for the original Unreal Tournament
+that generates statistics from a custom NGStats log file.
+
+
+What Does It Record
+-------------------
+Lots of stuff
+
+
+What Will I Need
+----------------
+Access to the logs
+PHP & MySQL enabled website
+PHP needs to allow ftpconnect etc if you wish to use auto-ftp of logs
+
+
+What Game Types Does it Support
+-------------------------------
+All the official game types.
+
+
+Do You Have A Preview Site?
+-------------------------------
+Yes. http://utstats.unrealadmin.org/
+
+
+Why Beta?/Any New Stuff to Come
+-------------------------------
+Possible new stuff, but until we're happy its 100% stable it stays as beta :)
+
+
+I Want to Help What Can I Do?
+-----------------------------
+When the Beta is released please check the pages.
+They might be able to be done more efficiently or other things could be added.
+If you work something out, let us know, share, don't be one of the selfish people
+in life who keeps it to themselves.
+Remember, the maps you likely play, the mods you use, someone shared them.
+If you can, now is your opportunity to share back.
\ No newline at end of file diff --git a/install.txt b/install.txt new file mode 100755 index 0000000..7d2cd4d --- /dev/null +++ b/install.txt @@ -0,0 +1,186 @@ +UTStats
+Copyright (C) 2004/2005 azazel, )°DoE°(-AnthraX and toa
+
+This program is free software; you can redistribute and/or modify
+it under the terms of the Open Unreal Mod License.
+See license.txt for more information.
+
+===============================================================================
+Contents
+===============================================================================
+
+1. Installing the Server Actor
+2. Installing the web stuff (new install and upgrade)
+3. Importing Logs
+4. Known Bugs/Issues Still
+5. License
+
+===============================================================================
+1. UTStats Actor Install Information
+===============================================================================
+
+From the System folder in the zip file, copy to your UTServer\System folder the
+following files:
+
+UTSAccuBeta4_2.u
+UTStatsBeta4_2.u
+
+Remove any previous entries for UTStats and UTSAccuBeta from [Engine.GameEngine]
+
+Add to [Engine.GameEngine] the following lines:
+
+ServerPackages=UTSAccuBeta4_2
+ServerActors=UTStatsBeta4_2.UTStatsSA
+
+Under the [Engine.GameInfo] check for:
+bLocalLog=True or bLocalLog=False
+
+This line HAS to be:
+bLocalLog=False
+
+Setting it to True will not give you complete logs (don't ask why it just won't).
+
+Log files are recorded to the UTServer\Logs folder.
+
+
+===============================================================================
+2. UTStats Web Install Information
+===============================================================================
+
+UPGRADING from Version 4.2 and newer
+-------------------------------------------------------------------------------
+The current install is compatible with the database of version 4.2 and later.
+However bunny track stats are only available from version 4.2.5.
+
+Just remove all the files/folders (apart from the logs folder, if you wish to
+keep your backup logs), and upload all the files in the html folder to your
+webserver.
+
+Then visit the admin area and click "Check Server Settings" near the bottom of
+the list. This will install databases if they're missing and fix the Bunny
+Track captimes to the new format if needed.
+
+If you use your old config.php make sure the following section is included:
+
+// ================ START OF ADDITINAL CONFIG.PHP OPTIONS =====================
+// Screenshot files start with...
+$import_utdc_screenshot_start = "[UTDC]";
+
+// Screenshot files end with...
+$import_utdc_screenshot_extension = ".enc";
+
+// UTStats can download and manage your ACE logs
+// Enable downloading of ACE logs?
+$import_ace_download_enable = false;
+
+// Log files start with...
+$import_ace_log_start = "[ACE]";
+
+// Log files end with...
+$import_ace_log_extension = ".log";
+
+// Log files start with...
+$import_ace_screenshot_start = "[ACE]";
+
+// Log files end with...
+$import_ace_screenshot_extension = ".jpg";
+
+// Compress ACE logfiles after download? [compress/gzip/no]
+// (see $import_log_backup for available options)
+$import_ace_log_compress = "compress";
+
+// Purge old ACE logs after x days. 0 to disable.
+$import_ace_log_purge_after = 0;
+// ================= END OF ADDITINAL CONFIG.PHP OPTIONS ======================
+
+UPGRADING from older versions:
+-------------------------------------------------------------------------------
+Firstly we don't advise using any old logs, you will not benefit from any new
+features AND it will likely mess up some page data.
+We apologise for not being able to save this information but there are a
+massive amount of new features that are well worth ditching the old logs for :)
+
+If you do wish to keep the old logs you need to do a full install anyway, so
+drop all the tables you had and remove all the
+files/folders (making sure you don't delete the logs backups).
+When you edit config.php make sure to change the option:
+$import_incompatible_logs=false;
+to
+$import_incompatible_logs=true;
+
+If you are wisely going to ditch the old logs just clear out your old install
+and all the tables and start from here.
+
+FULL INSTALL:
+-------------------------------------------------------------------------------
+From the html folder in the zip file, upload all the files to your webserver
+wherever you like. I suggest under a folder called utstats.
+After the files have uploaded browse to the stats folder where you should see
+the following folders:
+
+\images
+\import
+\includes
+\logs
+\pages
+
+Now edit the config.php file.
+
+Enter in your mysql database, hostname, username and password at the top.
+You must set an adminkey in here or you won't be able to import/use the admin
+feature.
+Check all the other options to see if they are as you wish (they are set to
+what we consider the best options).
+If you are going to use ftp transferring of log files amend the FTP connection
+as required.
+
+Now visit the admin area and click "Check Server Settings" near the bottom.
+This will setup the database, if the tables allready exist it will keep the
+old tables. It will also check the file permissions. If it can't set
+the file permissions you'll have to do it yourself,
+
+Using whatever means (usually the ftp client) you need to CHMOD the logs folder
+to 777.
+Now go into the logs folder.
+Now CHMOD the backups, utdc, ac and ace folders to 777.
+
+Now go back a level and into the includes folder.
+CHMOD the file ftptimestamp.php to 777.
+
+=================
+3. Importing Logs
+=================
+
+Depending on the level of access you have and how competent you are you can do this 4 ways.
+*** Important ***
+Make sure you edit config.php and set an adminkey at the top!
+
+Way 1:
+If you don't have ftp access to your UT server or allowed to use ftp via php then upload your
+logs manually to the logs folder and then run the importer via the Import link.
+
+Way 2:
+If you have ftp access and can do ftp via php, edit the config.php file and input your UT servers ftp
+information into there.
+Now run the importer via the Import link.
+
+Way 3:
+Automate the process using a cron job or scheduled task.
+Just get this to run cd to the root of stats (where import.php is) and execute the import.php file
+with php.
+
+Way 4:
+Automate the web process using a web service cron job.
+
+====================
+4. Known Bugs/Issues
+====================
+
+If you find any bugs or issues please post them at our forums:
+http://www.unrealadmin.org/forums/forumdisplay.php?f=173
+
+====================
+5. License
+====================
+
+This product includes GeoLite data created by MaxMind, available from http://www.maxmind.com/.
\ No newline at end of file diff --git a/license.txt b/license.txt new file mode 100755 index 0000000..05c6253 --- /dev/null +++ b/license.txt @@ -0,0 +1,79 @@ +Open Unreal Mod License
+Version 1, March 2004
+
+ 0. Definitions
+ "Program" the work, either in binary or source form, that has a notice
+ attached to it stating that it has been released under this
+ license it by the copyright holder.
+ "Modification" a derivative of the Program or any other work based on the Program
+ "Linking" using parts of the Program, or using parts of any other work,
+ thus creating a direct dependency
+ "You" the licensee
+ "Runtime Environment"
+ the virtual machine or operating system required to run the
+ Program, as released by the Publisher or Creator of said
+ runtime environment. This includes any extentions or updates
+ for the runtime environment released by the Publisher or
+ Creator.
+
+ 1. License
+ Herewith everybody is granted permission to copy and distribute verbatim copies
+ of this document. The only restriction lies on changing the content, with the
+ exception to translation of this license.
+
+ This license applies to the Program that has been released under this license.
+ The license only applies to copying, distribution and modification of the
+ Program. Execution or output of the Program are not covered by this license,
+ however the right for additional limitations on the use (that do not cover
+ copying, distribution or modification) is granted to the copyright holder.
+ This license is only valid when all terms in this license comply with the
+ licenses of the dependecies of the Program. This includes the license of the
+ possible required runtime envoirement.
+
+ 2. Copying and distribution
+ You are granted to copy or distribute verbatim copies of the Program, on any
+ medium, or in any format as you see fit. You are not limited to charging a fee
+ for the physical act of transferring the copy, nor are you limited to provide
+ warranty for the Program in return of a fee. Unless this is prohibited by the
+ license of the Runtime Envoirement.
+
+ Any distribution of the program should be accompanied with a verbatim copy of
+ this license.
+
+ 3. Modification
+ You are allowed to modify the Program, or portions of it, therefore making it a
+ derivative of the Program. You are allowed to distribute your modifications under
+ the following conditions:
+ - You must clearly state that it is a modification or derivative of the
+ Program
+ - The original copyright notice must be kept intact
+ - The modified files must contain notices of the changed made to it
+ - The Modification must be released under the same license as the Program
+ - Distribution happens in compliance with section 2
+
+ 4. Source
+ The original source of the Program or Modification must be freely available on
+ request.
+
+ 5. Linking
+ The Program or Modification may only link with other work that have been
+ released as free software.
+
+ The license grants exclusive right to link with any part of the Runtime
+ Environment, as provided by the publisher or creator of said Runtime
+ Environment.
+ Reusing pieces of source code available in the runtime environment in the
+ Program is only allowed under the following terms:
+ - the "borrowed" code is clearly marked to originate from the runtime
+ environment, quoting the original copyright.
+ - the following notice is added to the top of the file:
+ "This file contains portions of code from the runtime environment."
+
+ The right to "port" the Program to another runtime environment is reserved for
+ the copyright holder.
+
+ 6. NON WARRANTY
+ THIS SOFTWARE DOES NOT COME WITH A WARRANTY OF ANY KIND, UNLESS NOTED OTHERWISE
+ BY THE COPYRIGHT HOLDER OR WARRANTY PROVIDER. THE ENTIRE RISK OF THE PERFORMANCE
+ AND QUALITY OF THE PROGRAM LIES WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE,
+ YOU WILL ASSUME ALL COSTS FOR REQUIRED REPAIR OR CORRECTION.
\ No newline at end of file |