예제 #1
0
function showConfigForm()
{
    global $cfg;
    $i = 0;
    ?>
	<div class="content-head">
		<div class="desc-title">Global Configuration</div>
		<div class="description">
		<i>Description:</i> This area allows you to alter the configuration of the Battlefield 2 Private
		Statistics system. This only alters the global settings defined on the "Gamespy" database server.
		To alter in-game configurations, please edit the "python/bf2/BF2StatisticsConfig.py" file on your
		game server.
		</div>
	</div>
	<div class="content">
		<form method="POST" action="index.php" onSubmit="return configvalidation(this);" name="adminform">
		<input type="hidden" name="action" value="process">
		<input type="hidden" name="task" value="saveconfig">
		<input type="hidden" name="ext_ip" value="<?php 
    echo get_ext_ip();
    ?>
">
		<input type="hidden" name="cfg__db_expected_ver" value="<?php 
    echo $cfg->get('db_expected_ver');
    ?>
">
		
		<table border="0" width="95%" style="border: 2px solid #808080;">
			<tr>
				<td colspan="3" class="form-head">Global Configuration</td>
			</tr>
			
			<tr>
				<td colspan="3" align="left" class="form-section-head">Database Config:</td>
			</tr>
			<tr>
				<td width="120" align="right" valign="middle" class="form-text">Database Host:</td>
				<td width="100" align="left" valign="middle">
				<input type="text" name="cfg__db_host" size="20" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox" value="<?php 
    echo $cfg->get('db_host');
    ?>
" /></td>
				<td align="left" valign="top" class="form-desc">MySQL Database Host. Typically LOCALHOST.</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">Database Port:</td>
				<td align="left" valign="middle">
				<input type="text" name="cfg__db_port" size="20" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox" value="<?php 
    echo $cfg->get('db_port');
    ?>
" /></td>
				<td align="left" valign="top" class="form-desc">MySQL database port. Typically 3306.</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">Database Name:</td>
				<td align="left" valign="middle">
				<input type="text" name="cfg__db_name" size="20" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox" value="<?php 
    echo $cfg->get('db_name');
    ?>
" /></td>
				<td align="left" valign="top" class="form-desc">Database Name to store stats.</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">Database Username:</td>
				<td align="left" valign="middle">
				<input type="text" name="cfg__db_user" size="20" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox" value="<?php 
    echo $cfg->get('db_user');
    ?>
" /></td>
				<td align="left" valign="top" class="form-desc">Username with rights to Database.</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">Database Password:</td>
				<td align="left" valign="middle">
				<input type="password" name="cfg__db_pass" size="20" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox" value="<?php 
    echo $cfg->get('db_pass');
    ?>
" /></td>
				<td align="left" valign="top" class="form-desc">Password for Database Username.</td>
			</tr>
			
			<tr>
				<td colspan="3" align="left" class="form-section-head">Stats Processing Options:</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">SNAPSHOT Log Extension:</td>
				<td align="left" valign="middle">
				<input type="text" name="cfg__stats_ext" size="10" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox" value="<?php 
    echo $cfg->get('stats_ext');
    ?>
" /></td>
				<td align="left" valign="top" class="form-desc">Extension for SNAPSHOT logs (Default: '.stats').</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">SNAPSHOT Log Path:</td>
				<td align="left" valign="middle">
				<input type="text" name="cfg__stats_logs" size="20" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox" value="<?php 
    echo $cfg->get('stats_logs');
    ?>
" /></td>
				<td align="left" valign="top" class="form-desc">Path to store SNAPSHOT logs during processing (Include trailing '/').</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">Archive SNAPSHOTS:</td>
				<td align="left" valign="middle">
					<select name="cfg__stats_move_logs" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox">
						<option value="1"<?php 
    echo $cfg->get('stats_move_logs') == 1 ? " selected" : "";
    ?>
>Yes</option>
						<option value="0"<?php 
    echo $cfg->get('stats_move_logs') == 0 ? " selected" : "";
    ?>
>No</option>
					</select>
				</td>
				<td align="left" valign="top" class="form-desc">Archive SNAPSHOTS logs after processing</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">SNAPSHOT Archive Path:</td>
				<td align="left" valign="middle">
				<input type="text" name="cfg__stats_logs_store" size="20" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox" value="<?php 
    echo $cfg->get('stats_logs_store');
    ?>
" /></td>
				<td align="left" valign="top" class="form-desc">Path to archive SNAPSHOT logs after processing (Include trailing '/').</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">Min. Game Time (Global):</td>
				<td align="left" valign="middle">
				<input type="text" name="cfg__stats_min_game_time" size="5" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox" value="<?php 
    echo $cfg->get('stats_min_game_time');
    ?>
" /></td>
				<td align="left" valign="top" class="form-desc">Minimum game time of total round in SNAPSHOT before processing (Seconds)?</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">Min. Game Time (Player):</td>
				<td align="left" valign="middle">
				<input type="text" name="cfg__stats_min_player_game_time" size="5" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox" value="<?php 
    echo $cfg->get('stats_min_player_game_time');
    ?>
" /></td>
				<td align="left" valign="top" class="form-desc">Minimum game time for each player in SNAPSHOT before processing (Seconds)?</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">Min. Players:</td>
				<td align="left" valign="middle">
				<input type="text" name="cfg__stats_players_min" size="5" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox" value="<?php 
    echo $cfg->get('stats_players_min');
    ?>
" /></td>
				<td align="left" valign="top" class="form-desc">Minimum players in SNAPSHOT before processing?</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">Max. Players:</td>
				<td align="left" valign="middle">
				<input type="text" name="cfg__stats_players_max" size="5" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox" value="<?php 
    echo $cfg->get('stats_players_max');
    ?>
" /></td>
				<td align="left" valign="top" class="form-desc">Maximum players in SNAPSHOT before stopping processing (used to stop data hole loops)?</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">Rank Checking:</td>
				<td align="left" valign="middle">
					<select name="cfg__stats_rank_check" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox">
						<option value="1"<?php 
    echo $cfg->get('stats_rank_check') == 1 ? " selected" : "";
    ?>
>Yes</option>
						<option value="0"<?php 
    echo $cfg->get('stats_rank_check') == 0 ? " selected" : "";
    ?>
>No</option>
					</select>
				</td>
				<td align="left" valign="top" class="form-desc">Enable Rank Checking? Leave off, unless you are having problems with ranks being reset to 0.</td>
			</tr>
			<tr>
				<td align="right" valign="top" class="form-text">Rank Tenure:</td>
				<td align="left" valign="top">
				<input type="text" name="cfg__stats_rank_tenure" size="5" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox" value="<?php 
    echo $cfg->get('stats_rank_tenure');
    ?>
" /></td>
				<td align="left" valign="top" class="form-desc">Minimum time to hold special ranks (ie, Sergeant Major of the Corps (SMoC) & General (GEN)).</td>
			</tr>
			<tr>
				<td align="right" valign="top" class="form-text">Award Processing:</td>
				<td align="left" valign="top">
					<select name="cfg__stats_awds_complete" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox">
						<option value="1"<?php 
    echo $cfg->get('stats_awds_complete') == 1 ? " selected" : "";
    ?>
>Yes</option>
						<option value="0"<?php 
    echo $cfg->get('stats_awds_complete') == 0 ? " selected" : "";
    ?>
>No</option>
					</select>
				</td>
				<td align="left" valign="top" class="form-desc">Require players to complete rounds before processing awards?</td>
			</tr>
			<tr>
				<td align="right" valign="top" class="form-text">LAN Override:</td>
				<td align="left" valign="top">
				<input type="text" name="cfg__stats_lan_override" size="16" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox" value="<?php 
    echo $cfg->get('stats_lan_override');
    ?>
" />
				<button name="use_ext_ip" class="button" type="button" title="Use Current External IP?" onClick="javascript:document.adminform.cfg__stats_lan_override.value = document.adminform.ext_ip.value;">IP</button>
				</td>
				<td align="left" valign="top" class="form-desc">Local Players IP 'Over-ride' for Country Code Lookup. Enter a properly formated non-private IP.</td>
			</tr>
			<tr>
				<td align="right" valign="top" class="form-text">Player Override:</td>
				<td align="left" valign="top">
				<textarea name="cfg__stats_local_pids" rows="4" cols="16" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox"><?php 
    echo implode("\n", $cfg->get('stats_local_pids'));
    ?>
</textarea></td>
				<td align="left" valign="top" class="form-desc">Individual Players IP 'Override' for Country Code Lookup. Enter one per line.</td>
			</tr>
			
			<tr>
				<td colspan="3" align="left" class="form-section-head">Global Game Server Configuration:</td>
			</tr>
			<tr>
				<td align="right" valign="top" class="form-text">Auth Game Servers:</td>
				<td align="left" valign="top">
				<textarea name="cfg__game_hosts" rows="4" cols="16" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox"><?php 
    echo implode("\n", $cfg->get('game_hosts'));
    ?>
</textarea></td>
				<td align="left" valign="top" class="form-desc">Authorised Game Servers. Enter one <a href="http://en.wikipedia.org/wiki/IPv4" target="_blank">IPv4 Address</a>
				per line (Supports CIDR x.x.x.x/y notation).</td>
			</tr>
			<tr>
				<td align="right" valign="top" class="form-text">Custom MapID:</td>
				<td align="left" valign="top">
				<input type="text" name="cfg__game_custom_mapid" size="10" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox" value="<?php 
    echo $cfg->get('game_custom_mapid');
    ?>
" /></td>
				<td align="left" valign="top" class="form-desc">Default Custom MapID. This will be used for the first custom map detetced, all
				others will increment from this value (Default: 700).<br>
				NOTE: All Custom MapID's will be assigned based on the HIGHEST existing MapID.<br>
				WARNING: Set this ONLY once or you may lose access to you custom map data!</td>
			</tr>
			<tr>
				<td align="right" valign="top" class="form-text">Offline PID:</td>
				<td align="left" valign="top">
				<input type="text" name="cfg__game_default_pid" size="10" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox" value="<?php 
    echo $cfg->get('game_default_pid');
    ?>
" /></td>
				<td align="left" valign="top" class="form-desc">Default Offline Player ID (PID). This will be used for the first offline player detected, all
				others will decrement from this value (Default: 29000000).<br>
				NOTE: All offline PID's will be assigned based on the LOWEST existing PID.</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">Ignore Time Req.:</td>
				<td align="left" valign="middle">
					<select name="cfg__game_awds_ignore_time" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox" disabled>
						<option value="0"<?php 
    echo $cfg->get('game_awds_ignore_time') == 0 ? " selected" : "";
    ?>
>No</option>
						<option value="1"<?php 
    echo $cfg->get('game_awds_ignore_time') == 1 ? " selected" : "";
    ?>
>Yes</option>
					</select>
				</td>
				<td align="left" valign="top" class="form-desc">Ignore Global Time Requirements for Awards (* Not Yet Active *)</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">Unlocks Option:</td>
				<td align="left" valign="middle">
					<select name="cfg__game_unlocks" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox">
						<option value="0"<?php 
    echo $cfg->get('game_unlocks') == 0 ? " selected" : "";
    ?>
>Earned</option>
						<option value="1"<?php 
    echo $cfg->get('game_unlocks') == 1 ? " selected" : "";
    ?>
>All Unlocked</option>
						<option value="-1"<?php 
    echo $cfg->get('game_unlocks') == -1 ? " selected" : "";
    ?>
>Disabled</option>
					</select>
				</td>
				<td align="left" valign="top" class="form-desc">Global Unlocks handling</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">Bonus Unlocks:</td>
				<td align="left" valign="middle">
					<select name="cfg__game_unlocks_bonus" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox">
						<option value="0"<?php 
    echo $cfg->get('game_unlocks_bonus') == 0 ? " selected" : "";
    ?>
>&lt;None&gt;</option>
						<option value="1"<?php 
    echo $cfg->get('game_unlocks_bonus') == 1 ? " selected" : "";
    ?>
>Basic</option>
						<option value="2"<?php 
    echo $cfg->get('game_unlocks_bonus') == 2 ? " selected" : "";
    ?>
>Veteran</option>
						<option value="3"<?php 
    echo $cfg->get('game_unlocks_bonus') == 3 ? " selected" : "";
    ?>
>Expert</option>
					</select>
				</td>
				<td align="left" valign="top" class="form-desc">Allow bonus Unlocks based on Kit Badges?</td>
			</tr>
			<tr>
				<td align="right" valign="top" class="form-text">Min. Rank for Bonus Unlocks:</td>
				<td align="left" valign="top">
				<select name="cfg__game_unlocks_bonus_min" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox">
						<option value="0"<?php 
    echo $cfg->get('game_unlocks_bonus_min') == 0 ? " selected" : "";
    ?>
>Private (0)</option>
						<option value="1"<?php 
    echo $cfg->get('game_unlocks_bonus_min') == 1 ? " selected" : "";
    ?>
>Pvt First Class (1)</option>
						<option value="2"<?php 
    echo $cfg->get('game_unlocks_bonus_min') == 2 ? " selected" : "";
    ?>
>Lance Corporal (2)</option>
						<option value="3"<?php 
    echo $cfg->get('game_unlocks_bonus_min') == 3 ? " selected" : "";
    ?>
>Corporal (3)</option>
						<option value="4"<?php 
    echo $cfg->get('game_unlocks_bonus_min') == 4 ? " selected" : "";
    ?>
>Sergeant (4)</option>
						<option value="5"<?php 
    echo $cfg->get('game_unlocks_bonus_min') == 5 ? " selected" : "";
    ?>
>Staff Sergeant (5)</option>
						<option value="6"<?php 
    echo $cfg->get('game_unlocks_bonus_min') == 6 ? " selected" : "";
    ?>
>Gunnery Sergeant (6)</option>
						<option value="7"<?php 
    echo $cfg->get('game_unlocks_bonus_min') == 7 ? " selected" : "";
    ?>
>&lt;Field Officer&gt; (7-11)</option>
						<option value="12"<?php 
    echo $cfg->get('game_unlocks_bonus_min') == 12 ? " selected" : "";
    ?>
>&lt;Officer&gt; (12+)</option>
					</select>
				<td align="left" valign="top" class="form-desc">Minimum Rank before allowing bonus unlocks</td>
			</tr>

			<tr>
				<td colspan="3" align="left" class="form-section-head">Error Reporting Options:</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">Error Log:</td>
				<td align="left" valign="middle">
				<input type="text" name="cfg__debug_log" size="20" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox" value="<?php 
    echo $cfg->get('debug_log');
    ?>
" /></td>
				<td align="left" valign="top" class="form-desc">Location of Error Log File.</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">Error Level:</td>
				<td align="left" valign="middle">
					<select name="cfg__debug_lvl" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox">
						<option value="0"<?php 
    echo $cfg->get('debug_lvl') == 0 ? " selected" : "";
    ?>
>Security (0)</option>
						<option value="1"<?php 
    echo $cfg->get('debug_lvl') == 1 ? " selected" : "";
    ?>
>Errors (1)</option>
						<option value="2"<?php 
    echo $cfg->get('debug_lvl') == 2 ? " selected" : "";
    ?>
>Warning (2)</option>
						<option value="3"<?php 
    echo $cfg->get('debug_lvl') == 3 ? " selected" : "";
    ?>
>Notice (3)</option>
						<option value="4"<?php 
    echo $cfg->get('debug_lvl') == 4 ? " selected" : "";
    ?>
>Detailed (4)</option>
					</select>
				</td>
				<td align="left" valign="top" class="form-desc">Error Logging Level (Includes all message above selected option).</td>
			</tr>
			
			<tr>
				<td colspan="3" align="left" class="form-section-head">Admin Config:</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">DB Backup Extension:</td>
				<td align="left" valign="middle">
				<input type="text" name="cfg__admin_backup_ext" size="10" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox" value="<?php 
    echo $cfg->get('admin_backup_ext');
    ?>
" /></td>
				<td align="left" valign="top" class="form-desc">Extension for Database Backup files (Defualt: .bak).</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">DB Backup Path:</td>
				<td align="left" valign="middle">
				<input type="text" name="cfg__admin_backup_path" size="20" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox" value="<?php 
    echo $cfg->get('admin_backup_path');
    ?>
" /></td>
				<td align="left" valign="top" class="form-desc">Path to store database backup data (Include trailing '/'). This should be an absolute
				path as it is MySQL using it, not PHP (execpt for restores, then PHP needs it).</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">Admin User:</td>
				<td align="left" valign="middle">
				<input type="text" name="cfg__admin_user" size="20" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox" value="<?php 
    echo $cfg->get('admin_user');
    ?>
" /></td>
				<td align="left" valign="top" class="form-desc">Username for access to BF2 Stats Admin System.<br>
				NOTE: You will be forced to re-logon after this has been saved.</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">Admin Password:</td>
				<td align="left" valign="middle">
				<input type="password" name="cfg__admin_pass" size="20" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox" value="<?php 
    echo $cfg->get('admin_pass');
    ?>
" /></td>
				<td align="left" valign="top" class="form-desc">Password for access to BF2 Stats Admin System.<br>
				NOTE: You will be forced to re-logon after this has been saved.</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">Auth Admin IP's:</td>
				<td align="left" valign="middle">
				<textarea name="cfg__admin_hosts" rows="4" cols="16" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox"><?php 
    echo implode("\n", $cfg->get('admin_hosts'));
    ?>
</textarea></td>
				<td align="left" valign="top" class="form-desc">Authorised IP Addresses for Admin System (Localhost is ALWAYS enabled).
				Enter one <a href="http://en.wikipedia.org/wiki/IPv4" target="_blank">IPv4 Address</a> per line (Supports CIDR x.x.x.x/y notation).</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">Admin Log File:</td>
				<td align="left" valign="middle">
				<input type="text" name="cfg__admin_log" size="20" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox" value="<?php 
    echo $cfg->get('admin_log');
    ?>
" /></td>
				<td align="left" valign="top" class="form-desc">File to log admin actions. Leave blank to disable.</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">Admin Page Size:</td>
				<td align="left" valign="middle">
					<select name="cfg__admin_page_size" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox">
						<option value="10" <?php 
    echo $cfg->get('admin_page_size') == 10 ? " selected" : "";
    ?>
>10</option>
						<option value="25" <?php 
    echo $cfg->get('admin_page_size') == 25 ? " selected" : "";
    ?>
>25</option>
						<option value="50" <?php 
    echo $cfg->get('admin_page_size') == 50 ? " selected" : "";
    ?>
>50</option>
						<option value="75" <?php 
    echo $cfg->get('admin_page_size') == 75 ? " selected" : "";
    ?>
>75</option>
						<option value="100" <?php 
    echo $cfg->get('admin_page_size') == 100 ? " selected" : "";
    ?>
>100</option>
						<option value="150" <?php 
    echo $cfg->get('admin_page_size') == 150 ? " selected" : "";
    ?>
>150</option>
					</select>
				<td align="left" valign="top" class="form-desc">Number of records to return per page.</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">Ignore AI Players:</td>
				<td align="left" valign="middle">
					<select name="cfg__admin_ignore_ai" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox">
						<option value="0"<?php 
    echo $cfg->get('admin_ignore_ai') == 0 ? " selected" : "";
    ?>
>No</option>
						<option value="1"<?php 
    echo $cfg->get('admin_ignore_ai') == 1 ? " selected" : "";
    ?>
>Yes</option>
					</select>
				</td>
				<td align="left" valign="top" class="form-desc">Ignore AI players in player lists?</td>
			</tr>
			
			<tr>
				<td colspan="3" align="right" class="form-text">
					Confirm Process:&nbsp;<input type="checkbox" tabindex="<?php 
    echo $i++;
    ?>
" name="confirm" />&nbsp;&nbsp;
					<button name="process" class="button" type="submit"><b>Update</b></button>&nbsp;&nbsp;
					<button name="reset" class="button" type="reset">Cancel</button>
				</td>
			</tr>
		</table>
		</form>
	</div>
<?php 
    // END showConfigForm()
}
function showConfigForm()
{
    global $cfg;
    $i = 0;
    ?>
	<div class="content-head">
		<div class="desc-title">Global Configuration</div>
		<div class="description">
		<i>Description:</i> This area allows you to alter the configuration of the Battlefield 2 Private
		Statistics system. This only alters the global settings defined on the "Gamespy" database server.
		To alter in-game configurations, please edit the "python/bf2/BF2142StatisticsConfig.py" file on your
		game server.
		</div>
	</div>
	<div class="content">
		<form method="POST" action="index.php" onSubmit="return configvalidation(this);" name="adminform">
		<input type="hidden" name="action" value="process">
		<input type="hidden" name="task" value="saveconfig">
		<input type="hidden" name="ext_ip" value="<?php 
    echo get_ext_ip();
    ?>
">
		<input type="hidden" name="cfg__db_expected_ver" value="<?php 
    echo $cfg->get('db_expected_ver');
    ?>
">
		
		<table border="0" width="95%" style="border: 2px solid #808080;">
			<tr>
				<td colspan="3" class="form-head">Global Configuration</td>
			</tr>
			
			<tr>
				<td colspan="3" align="left" class="form-section-head">Database Config:</td>
			</tr>
			<tr>
				<td width="120" align="right" valign="middle" class="form-text">Server:</td>
				<td width="100" align="left" valign="middle">
				<input type="text" name="cfg__db_host" size="20" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox" value="<?php 
    echo $cfg->get('db_host');
    ?>
" /></td>
				<td align="left" valign="top" class="form-desc">MySQL Database Host. Typically LOCALHOST.</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">Database:</td>
				<td align="left" valign="middle">
				<input type="text" name="cfg__db_name" size="20" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox" value="<?php 
    echo $cfg->get('db_name');
    ?>
" /></td>
				<td align="left" valign="top" class="form-desc">Database Name to store stats.</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">Username:</td>
				<td align="left" valign="middle">
				<input type="text" name="cfg__db_user" size="20" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox" value="<?php 
    echo $cfg->get('db_user');
    ?>
" /></td>
				<td align="left" valign="top" class="form-desc">Username with rights to Database.</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">Password:</td>
				<td align="left" valign="middle">
				<input type="password" name="cfg__db_pass" size="20" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox" value="<?php 
    echo $cfg->get('db_pass');
    ?>
" /></td>
				<td align="left" valign="top" class="form-desc">Password for Database Username.</td>
			</tr>
			
			<tr>
				<td colspan="3" align="left" class="form-section-head">Stats Processing Options:</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">SNAPSHOT Log Extension:</td>
				<td align="left" valign="middle">
				<input type="text" name="cfg__stats_ext" size="10" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox" value="<?php 
    echo $cfg->get('stats_ext');
    ?>
" /></td>
				<td align="left" valign="top" class="form-desc">Extension for SNAPSHOT logs (Default: '.stats').</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">SNAPSHOT Log Path:</td>
				<td align="left" valign="middle">
				<input type="text" name="cfg__stats_logs" size="20" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox" value="<?php 
    echo $cfg->get('stats_logs');
    ?>
" /></td>
				<td align="left" valign="top" class="form-desc">Path to store SNAPSHOT logs during processing (Include trailing '/').</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">Archive SNAPSHOTS:</td>
				<td align="left" valign="middle">
					<select name="cfg__stats_move_logs" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox">
						<option value="1"<?php 
    echo $cfg->get('stats_move_logs') == 1 ? " selected" : "";
    ?>
>Yes</option>
						<option value="0"<?php 
    echo $cfg->get('stats_move_logs') == 0 ? " selected" : "";
    ?>
>No</option>
					</select>
				</td>
				<td align="left" valign="top" class="form-desc">Archive SNAPSHOTS logs after processing</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">SNAPSHOT Archive Path:</td>
				<td align="left" valign="middle">
				<input type="text" name="cfg__stats_logs_store" size="20" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox" value="<?php 
    echo $cfg->get('stats_logs_store');
    ?>
" /></td>
				<td align="left" valign="top" class="form-desc">Path to archive SNAPSHOT logs after processing (Include trailing '/').</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">Min. Game Time (Global):</td>
				<td align="left" valign="middle">
				<input type="text" name="cfg__stats_min_game_time" size="5" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox" value="<?php 
    echo $cfg->get('stats_min_game_time');
    ?>
" /></td>
				<td align="left" valign="top" class="form-desc">Minimum game time of total round in SNAPSHOT before processing (Seconds)?</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">Min. Game Time (Player):</td>
				<td align="left" valign="middle">
				<input type="text" name="cfg__stats_min_player_game_time" size="5" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox" value="<?php 
    echo $cfg->get('stats_min_player_game_time');
    ?>
" /></td>
				<td align="left" valign="top" class="form-desc">Minimum game time for each player in SNAPSHOT before processing (Seconds)?</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">Min. Players:</td>
				<td align="left" valign="middle">
				<input type="text" name="cfg__stats_players_min" size="5" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox" value="<?php 
    echo $cfg->get('stats_players_min');
    ?>
" /></td>
				<td align="left" valign="top" class="form-desc">Minimum players in SNAPSHOT before processing?</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">Max. Players:</td>
				<td align="left" valign="middle">
				<input type="text" name="cfg__stats_players_max" size="5" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox" value="<?php 
    echo $cfg->get('stats_players_max');
    ?>
" /></td>
				<td align="left" valign="top" class="form-desc">Maximum players in SNAPSHOT before stopping processing (used to stop data hole loops)?</td>
			</tr>
			<tr>
				<td colspan="3" align="left" class="form-section-head">Global Game Server Configuration:</td>
			</tr>
			<tr>
				<td align="right" valign="top" class="form-text">Auth Game Servers:</td>
				<td align="left" valign="top">
				<textarea name="cfg__game_hosts" rows="4" cols="16" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox"><?php 
    echo implode("\n", $cfg->get('game_hosts'));
    ?>
</textarea></td>
				<td align="left" valign="top" class="form-desc">Authorised Game Servers. Enter one <a href="http://en.wikipedia.org/wiki/IPv4" target="_blank">IPv4 Address</a>
				per line (Supports CIDR x.x.x.x/y notation).</td>
			</tr>
			<tr>
				<td align="right" valign="top" class="form-text">Custom MapID:</td>
				<td align="left" valign="top">
				<input type="text" name="cfg__game_custom_mapid" size="10" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox" value="<?php 
    echo $cfg->get('game_custom_mapid');
    ?>
" /></td>
				<td align="left" valign="top" class="form-desc">Default Custom MapID. This will be used for the first custom map detetced, all
				others will increment from this value (Default: 700).<br>
				NOTE: All Custom MapID's will be assigned based on the HIGHEST existing MapID.<br>
				WARNING: Set this ONLY once or you may lose access to you custom map data!</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">Unlocks Option:</td>
				<td align="left" valign="middle">
					<select name="cfg__game_unlocks" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox">
						<option value="0"<?php 
    echo $cfg->get('game_unlocks') == 0 ? " selected" : "";
    ?>
>Earned</option>
						<option value="1"<?php 
    echo $cfg->get('game_unlocks') == 1 ? " selected" : "";
    ?>
>All Unlocked</option>
						<option value="-1"<?php 
    echo $cfg->get('game_unlocks') == -1 ? " selected" : "";
    ?>
>Disabled</option>
					</select>
				</td>
				<td align="left" valign="top" class="form-desc">Global Unlocks handling</td>
			</tr>
			<tr>
				<td colspan="3" align="left" class="form-section-head">Error Reporting Options:</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">Error Log:</td>
				<td align="left" valign="middle">
				<input type="text" name="cfg__debug_log" size="20" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox" value="<?php 
    echo $cfg->get('debug_log');
    ?>
" /></td>
				<td align="left" valign="top" class="form-desc">Location of Error Log File.</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">Error Level:</td>
				<td align="left" valign="middle">
					<select name="cfg__debug_lvl" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox">
						<option value="0"<?php 
    echo $cfg->get('debug_lvl') == 0 ? " selected" : "";
    ?>
>Security (0)</option>
						<option value="1"<?php 
    echo $cfg->get('debug_lvl') == 1 ? " selected" : "";
    ?>
>Errors (1)</option>
						<option value="2"<?php 
    echo $cfg->get('debug_lvl') == 2 ? " selected" : "";
    ?>
>Warning (2)</option>
						<option value="3"<?php 
    echo $cfg->get('debug_lvl') == 3 ? " selected" : "";
    ?>
>Notice (3)</option>
						<option value="4"<?php 
    echo $cfg->get('debug_lvl') == 4 ? " selected" : "";
    ?>
>Detailed (4)</option>
					</select>
				</td>
				<td align="left" valign="top" class="form-desc">Error Logging Level (Includes all message above selected option).</td>
			</tr>
			
			<tr>
				<td colspan="3" align="left" class="form-section-head">Admin Config:</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">DB Backup Extension:</td>
				<td align="left" valign="middle">
				<input type="text" name="cfg__admin_backup_ext" size="10" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox" value="<?php 
    echo $cfg->get('admin_backup_ext');
    ?>
" /></td>
				<td align="left" valign="top" class="form-desc">Extension for Database Backup files (Defualt: .bak).</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">DB Backup Path:</td>
				<td align="left" valign="middle">
				<input type="text" name="cfg__admin_backup_path" size="20" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox" value="<?php 
    echo $cfg->get('admin_backup_path');
    ?>
" /></td>
				<td align="left" valign="top" class="form-desc">Path to store database backup data (Include trailing '/'). This should be an absolute
				path as it is MySQL using it, not PHP (execpt for restores, then PHP needs it).</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">Admin User:</td>
				<td align="left" valign="middle">
				<input type="text" name="cfg__admin_user" size="20" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox" value="<?php 
    echo $cfg->get('admin_user');
    ?>
" /></td>
				<td align="left" valign="top" class="form-desc">Username for access to BF2142 Stats Admin System.<br>
				NOTE: You will be forced to re-logon after this has been saved.</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">Admin Password:</td>
				<td align="left" valign="middle">
				<input type="password" name="cfg__admin_pass" size="20" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox" value="<?php 
    echo $cfg->get('admin_pass');
    ?>
" /></td>
				<td align="left" valign="top" class="form-desc">Password for access to BF2142 Stats Admin System.<br>
				NOTE: You will be forced to re-logon after this has been saved.</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">Auth Admin IP's:</td>
				<td align="left" valign="middle">
				<textarea name="cfg__admin_hosts" rows="4" cols="16" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox"><?php 
    echo implode("\n", $cfg->get('admin_hosts'));
    ?>
</textarea></td>
				<td align="left" valign="top" class="form-desc">Authorised IP Addresses for Admin System (Localhost is ALWAYS enabled).
				Enter one <a href="http://en.wikipedia.org/wiki/IPv4" target="_blank">IPv4 Address</a> per line (Supports CIDR x.x.x.x/y notation).</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">Admin Log File:</td>
				<td align="left" valign="middle">
				<input type="text" name="cfg__admin_log" size="20" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox" value="<?php 
    echo $cfg->get('admin_log');
    ?>
" /></td>
				<td align="left" valign="top" class="form-desc">File to log admin actions. Leave blank to disable.</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">Admin Page Size:</td>
				<td align="left" valign="middle">
					<select name="cfg__admin_page_size" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox">
						<option value="10" <?php 
    echo $cfg->get('admin_page_size') == 10 ? " selected" : "";
    ?>
>10</option>
						<option value="25" <?php 
    echo $cfg->get('admin_page_size') == 25 ? " selected" : "";
    ?>
>25</option>
						<option value="50" <?php 
    echo $cfg->get('admin_page_size') == 50 ? " selected" : "";
    ?>
>50</option>
						<option value="75" <?php 
    echo $cfg->get('admin_page_size') == 75 ? " selected" : "";
    ?>
>75</option>
						<option value="100" <?php 
    echo $cfg->get('admin_page_size') == 100 ? " selected" : "";
    ?>
>100</option>
						<option value="150" <?php 
    echo $cfg->get('admin_page_size') == 150 ? " selected" : "";
    ?>
>150</option>
					</select>
				<td align="left" valign="top" class="form-desc">Number of records to return per page.</td>
			</tr>
			<tr>
				<td align="right" valign="middle" class="form-text">Ignore AI Players:</td>
				<td align="left" valign="middle">
					<select name="cfg__admin_ignore_ai" tabindex="<?php 
    echo $i++;
    ?>
" class="inputbox">
						<option value="0"<?php 
    echo $cfg->get('admin_ignore_ai') == 0 ? " selected" : "";
    ?>
>No</option>
						<option value="1"<?php 
    echo $cfg->get('admin_ignore_ai') == 1 ? " selected" : "";
    ?>
>Yes</option>
					</select>
				</td>
				<td align="left" valign="top" class="form-desc">Ignore AI players in player lists?</td>
			</tr>
			
			<tr>
				<td colspan="3" align="right" class="form-text">
					Confirm Process:&nbsp;<input type="checkbox" tabindex="<?php 
    echo $i++;
    ?>
" name="confirm" />&nbsp;&nbsp;
					<button name="process" class="button" type="submit"><b>Update</b></button>&nbsp;&nbsp;
					<button name="reset" class="button" type="reset">Cancel</button>
				</td>
			</tr>
		</table>
		</form>
	</div>
<?php 
}