summaryrefslogtreecommitdiff
path: root/html/includes
diff options
context:
space:
mode:
Diffstat (limited to 'html/includes')
-rwxr-xr-xhtml/includes/clanbase.php90
-rwxr-xr-xhtml/includes/config.php188
-rwxr-xr-xhtml/includes/config_pic.php239
-rwxr-xr-xhtml/includes/countries.php244
-rwxr-xr-xhtml/includes/footer.php16
-rwxr-xr-xhtml/includes/ftp.php411
-rwxr-xr-xhtml/includes/ftp_class.php492
-rwxr-xr-xhtml/includes/ftp_class_native.php142
-rwxr-xr-xhtml/includes/ftp_class_pure.php192
-rwxr-xr-xhtml/includes/ftp_class_sockets.php249
-rwxr-xr-xhtml/includes/ftptimestamp.php1
-rwxr-xr-xhtml/includes/functions.php605
-rwxr-xr-xhtml/includes/functions_admin.php332
-rwxr-xr-xhtml/includes/geoip.inc498
-rwxr-xr-xhtml/includes/header.php66
-rwxr-xr-xhtml/includes/hints.php81
-rwxr-xr-xhtml/includes/index.htm0
-rwxr-xr-xhtml/includes/overlib_mini.js322
-rwxr-xr-xhtml/includes/sidebar.php27
-rwxr-xr-xhtml/includes/teamstats.php177
-rwxr-xr-xhtml/includes/weaponstats.php216
21 files changed, 4588 insertions, 0 deletions
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>|&nbsp;)/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> &copy; 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) ? '&nbsp;' : ' ';
+
+ $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 '&nbsp;&nbsp;&nbsp;&nbsp;';
+ 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="&lt;&lt; Back">';
+ echo '</td>';
+ $caption = ($step == $maxsteps) ? 'Finish' : 'Next &gt;&gt;';
+ 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(/\&nbsp;/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,'&nbsp;');if(!tReg.test(o3_cap))o3_cap=o3_cap.replace(/[ ]+/g,'&nbsp;');}
+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(/\&nbsp;/g,' ');o3_cap=o3_cap.replace(/\&nbsp;/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&amp;mid='.$mid.'&amp;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&amp;mid='.$_mid.'&amp;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">&nbsp;</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&amp;mid='.$_mid.'&amp;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