<?php
if (isset($_POST['add_new_serv'])) {
	$id=$_POST['serv'];
    $result = dbquery("UPDATE ".DB_SERVERS." SET server_new='0' WHERE server_id=".$id."");
	$error=$locale['obpost001'];
	if (!$result) { $error="=<b><font color='red'>".$locale['obpost002']."</font></b>"; }
		if(isset($_POST['null'])){
	$result2=dbquery("UPDATE ".DB_SERVERS." SET votes='0'");
	$result2=dbquery("DELETE FROM ".DB_VOTES);
	}
echo "<html><head><meta http-equiv='Refresh' content='2; URL=".AMX_SELF."?id=new_serv'></head>";
echo "<body>";
echo "<br><br><br><br><br><br><br><br>";
echo "<body><table height='104' border='1' align='center' bordercolor='#3C3A36'>";
echo "<tr bordercolor='#999999'>";
echo "<td width='294'><font color='3C3A36'><center><strong>".$error."</strong><br><br><br>";
echo "<small>[<a href='".AMX_SELF."?id=new_serv'>".$locale['obpost003']."</a>]</small></center></font></td>";
echo "</tr></table></body></html>";
	}
if (isset($_POST['delite_serv'])) {
	$id=$_POST['serv'];
    $result = dbquery("DELETE FROM ".DB_SERVERS." WHERE server_id=".$id);
		$error=$locale['obpost006'];
	if (!$result) { $error="=<b><font color='red'>".$locale['obpost002']."</font></b>"; }
echo "<html><head><meta http-equiv='Refresh' content='2; URL=".AMX_SELF."?id=new_serv'></head>";
echo "<body>";
echo "<br><br><br><br><br><br><br><br>";
echo "<body><table height='104' border='1' align='center' bordercolor='#3C3A36'>";
echo "<tr bordercolor='#999999'>";
echo "<td width='294'><font color='3C3A36'><center><strong>".$error."</strong><br><br><br>";
echo "<small>[<a href='".AMX_SELF."?id=new_serv'>".$locale['obpost003']."</a>]</small></center></font></td>";
echo "</tr></table></body></html>";
	}
	if (isset($_POST['savesettings'])) {
    $license = descript(stripslash($_POST['license']));
    $localeset = stripinput($_POST['localeset']);
    $old_localeset = stripinput($_POST['old_localeset']);
    $result = dbquery("UPDATE ".DB_SETTINGS." SET
        sitename='".stripinput($_POST['sitename'])."',
		zname='".stripinput($_POST['zname'])."',
        siteurl='".stripinput($_POST['siteurl']).(strrchr($_POST['siteurl'],"/") != "/" ? "/" : "")."',
        siteemail='".stripinput($_POST['siteemail'])."',
        siteusername='".stripinput($_POST['username'])."',
        description='".stripinput($_POST['description'])."',
        keywords='".stripinput($_POST['keywords'])."',
		copy_mon='".stripinput($_POST['cm'])."',
        license='$license',
        num_servers='".stripinput($_POST['num_servers'])."',
        locale='$localeset'
    ");
		$error=$locale['obpost004'];
	if (!$result) { $error="=<b><font color='red'>".$locale['obpost004']."</font></b>"; }
echo "<html><head><meta http-equiv='Refresh' content='2; URL=".AMX_SELF."?id=global'></head>";
echo "<body>";
echo "<br><br><br><br><br><br><br><br>";
echo "<body><table height='104' border='1' align='center' bordercolor='#3C3A36'>";
echo "<tr bordercolor='#999999'>";
echo "<td width='294'><font color='3C3A36'><center><strong>".$error."</strong><br><br><br>";
echo "<small>[<a href='".AMX_SELF."?id=global'>".$locale['obpost003']."</a>]</small></center></font></td>";
echo "</tr></table></body></html>";
}
if (isset($_POST['savesettings_other'])) {
    $maintenance_message = stripinput($_POST['m_message']);
    $result = dbquery("UPDATE ".DB_SETTINGS." SET
        enable_registration='".$_POST['register_global']."',
		register_off='".$_POST['register_off']."',
        register_MG1='".$_POST['register_MG1']."',
        register_MG2='".$_POST['register_MG2']."',
        maintenance='".$_POST['maintenance']."',
        maintenance_message='$maintenance_message'
    ");
	if(isset($_POST['null'])){
	$result2=dbquery("UPDATE ".DB_SERVERS." SET votes='0'");
	$result = dbquery("DROP TABLE IF EXISTS ".$db_prefix."vote_ip");
	$result = dbquery("CREATE TABLE ".$db_prefix."vote_ip (
		vote_id MEDIUMINT(11) NOT NULL auto_increment,
		id_resp MEDIUMINT(11) NOT NULL,
		ip varchar(15) NOT NULL,
		date_resp datetime NOT NULL,
		PRIMARY KEY (vote_id)
			) TYPE=MyISAM;");
	}
		$error=$locale['obpost004'];
	if (!$result) { $error="=<b><font color='red'>".$locale['obpost005']."</font></b>"; }
echo "<html><head><meta http-equiv='Refresh' content='2; URL=".AMX_SELF."?id=other'></head>";
echo "<body>";
echo "<br><br><br><br><br><br><br><br>";
echo "<body><table height='104' border='1' align='center' bordercolor='#3C3A36'>";
echo "<tr bordercolor='#999999'>";
echo "<td width='294'><font color='3C3A36'><center><strong>".$error."</strong><br><br><br>";
echo "<small>[<a href='".AMX_SELF."?id=other'>".$locale['obpost003']."</a>]</small></center></font></td>";
echo "</tr></table></body></html>";
}
if (isset($_POST['save_serv'])) {
	$id=$_POST['serv'];
    $result = dbquery("UPDATE ".DB_SERVERS." SET
        votes='".$_POST['votes']."',
        server_off='".$_POST['off']."',
        server_vip='".$_POST['vip']."'
     WHERE server_id=".$id);
		$error=$locale['obpost004'];
	if (!$result) { $error="=<b><font color='red'>".$locale['obpost005']."</font></b>"; }
echo "<html><head><meta http-equiv='Refresh' content='2; URL=".AMX_SELF."?id=info&serv=".$id."'></head>";
echo "<body>";
echo "<br><br><br><br><br><br><br><br>";
echo "<body><table height='104' border='1' align='center' bordercolor='#3C3A36'>";
echo "<tr bordercolor='#999999'>";
echo "<td width='294'><font color='3C3A36'><center><strong>".$error."</strong><br><br><br>";
echo "<small>[<a href='".AMX_SELF."?id=info&serv=".$id."'>".$locale['obpost003']."</a>]</small></center></font></td>";
echo "</tr></table></body></html>";
}
?>