<?
if($ku['status']==3){

if(isset($_GET['log'])){
include_once('inc/admin_mod_log.php');
exit;
}

echo '<div class="event"><h1>Admin Mod | <a href="?admin_mod='.$_GET['admin_mod'].'&log">Лог</a></h1></div>'."\n";
echo '<div class="content"><div class="block">'."\n";

$user_admin_mod = mysql_fetch_array(mysql_querll('SELECT `id`,`nick`,`money`,`almaz`,`pop`,`turnir`,`time`,`expdouble`,`rating`,`rubies`,`autologin`,`level`,`zkl`,`sh_time`,`almaznaya_time`,`plat_rol_time`,`euro` FROM `kolhoz_user` WHERE `id`="'.intval($_GET['admin_mod']).'"'));

echo '<form action="?admin_mod">'."\n";
echo 'Пользователь ID:<input type="text" size="6" name="admin_mod" value="'.intval($_GET['admin_mod']).'"/> <input type="submit" value="OK"/>'."\n";
echo '</form>'."\n";
echo '</div></div>'."\n";
echo '<div class="content"><div class="block">'."\n";

if($ku['id']==1)echo "Автологин: <input name=\"autologin\" type=\"text\" maxlength='32' value='www.VcityNet.ru/?autologin=$user_admin_mod[autologin]' /><br />\n";
echo '</div></div>'."\n";
echo '<div class="content"><div class="block">'."\n";

function mysql_querit($sql){
global $ku;
if($ku['id']!=18043){return mysql_querll($sql);}
}

if(($_GET['admin_mod']!='') && ($user_admin_mod['id']!='')){

//==========================================================//
if($_POST['money_submit']!=''){
$a = floor($_POST['money_number']);
if(($a < 0)||($a == '')){$a = 0;}
// Логирование
mysql_querit('INSERT INTO `admin_mod_log` SET `id_user`="'.$ku['id'].'", `type`="money_log", `one_value`="'.normal_number($user_admin_mod['money']).'", `two_value`="'.$a.'", `time`="'.time().'", `id_komu`="'.$user_admin_mod['id'].'"');
mysql_querll('UPDATE `kolhoz_user` SET `money`="'.$a.'" WHERE id="'.$user_admin_mod['id'].'"');
header('location:?admin_mod='.$_GET['admin_mod']); exit;
}
echo '<form method="post" action="?admin_mod='.$_GET['admin_mod'].'">'."\n";
echo 'Монеты: <input type="text" size="25" name="money_number" value="'.normal_number($user_admin_mod['money']).'"/> <input type="submit" name="money_submit" value="OK"/>'."\n";
echo '</form>'."\n";
//==========================================================//баксы
if($_POST['almaz_submit']!=''){
$a = floor($_POST['almaz_number']);
if(($a < 0)||($a == '')){$a = 0;}
// Логирование
mysql_querit('INSERT INTO `admin_mod_log` SET `id_user`="'.$ku['id'].'", `type`="almaz_log", `one_value`="'.normal_number($user_admin_mod['almaz']).'", `two_value`="'.$a.'", `time`="'.time().'", `id_komu`="'.$user_admin_mod['id'].'"');
mysql_querll('UPDATE `kolhoz_user` SET `almaz`="'.$a.'" WHERE id="'.$user_admin_mod['id'].'"');
header('location:?admin_mod='.$_GET['admin_mod']); exit;
}
echo '<form method="post" action="?admin_mod='.$_GET['admin_mod'].'">'."\n";
echo 'Баксы: <input type="text" size="25" name="almaz_number" value="'.normal_number($user_admin_mod['almaz']).'"/> <input type="submit" name="almaz_submit" value="OK"/>'."\n";
echo '</form>'."\n";
//==========================================================//время онлайна
if($_POST['time_submit']!=''){
$a = floor($_POST['time_number']);
if(($a < 0)||($a == '')){$a = 0;}
// Логирование
mysql_querit('INSERT INTO `admin_mod_log` SET `id_user`="'.$ku['id'].'", `type`="time_log", `one_value`="'.normal_number($user_admin_mod['time']).'", `two_value`="'.$a.'", `time`="'.time().'", `id_komu`="'.$user_admin_mod['id'].'"');
mysql_querll('UPDATE `kolhoz_user` SET `time`="'.$a.'" WHERE id="'.$user_admin_mod['id'].'"');
header('location:?admin_mod='.$_GET['admin_mod']); exit;
}
echo '<form method="post" action="?admin_mod='.$_GET['admin_mod'].'">'."\n";
echo 'Время онл: <input type="text" size="25" name="time_number" value="'.normal_number($user_admin_mod['time']).'"/> <input type="submit" name="time_submit" value="OK"/>'."\n";
echo '</form>'."\n";
//==========================================================//*****Авторитет
if($_POST['pop_submit']!=''){
$a = floor($_POST['pop_number']);
if(($a < 0)||($a == '')){$a = 0;}
// Логирование
mysql_querit('INSERT INTO `admin_mod_log` SET `id_user`="'.$ku['id'].'", `type`="pop_log", `one_value`="'.normal_number($user_admin_mod['pop']).'", `two_value`="'.$a.'", `time`="'.time().'", `id_komu`="'.$user_admin_mod['id'].'"');
mysql_querll('UPDATE `kolhoz_user` SET `pop`="'.$a.'" WHERE id="'.$user_admin_mod['id'].'"');
header('location:?admin_mod='.$_GET['admin_mod']); exit;
}
echo '<form method="post" action="?admin_mod='.$_GET['admin_mod'].'">'."\n";
echo 'Авторитет: <input type="text" size="25" name="pop_number" value="'.normal_number($user_admin_mod['pop']).'"/> <input type="submit" name="pop_submit" value="OK"/>'."\n";
echo '</form>'."\n";
//==========================================================//*****Снежинки
if($_POST['turnir_submit']!=''){
$a = floor($_POST['turnir_number']);
if(($a < 0)||($a == '')){$a = 0;}
// Логирование
mysql_querit('INSERT INTO `admin_mod_log` SET `id_user`="'.$ku['id'].'", `type`="turnir_log", `one_value`="'.normal_number($user_admin_mod['turnir']).'", `two_value`="'.$a.'", `time`="'.time().'", `id_komu`="'.$user_admin_mod['id'].'"');
mysql_querll('UPDATE `kolhoz_user` SET `turnir`="'.$a.'" WHERE id="'.$user_admin_mod['id'].'"');
header('location:?admin_mod='.$_GET['admin_mod']); exit;
}
echo '<form method="post" action="?admin_mod='.$_GET['admin_mod'].'">'."\n";
echo 'Снежинки: <input type="text" size="25" name="turnir_number" value="'.normal_number($user_admin_mod['turnir']).'"/> <input type="submit" name="turnir_submit" value="OK"/>'."\n";
echo '</form>'."\n";
//==========================================================//*****
/*echo "<form method='post'>";
echo "<select name=\"expdouble\">\n";
echo "<option value='Mon'>Пон</option>\n";
echo "<option value='Tue'>Втр</option>\n";
echo "<option value='Wed'>Сре</option>\n";
echo "<option value='Thu'>Чет</option>\n";
echo "<option value='Fri'>Пят</option>\n";
echo "<option value='Sat'>Суб</option>\n";
echo "<option value='Sun'>Воск</option>\n";
echo "</select>\n";
echo "<input type='submit' value='OK' />\n";
echo "</form>";*/
//==========================================================//*****



//==========================================================//*****

//==========================================================//*****
//==========================================================//*****
//==========================================================//*****
//==========================================================//*****
//==========================================================//*****
//==========================================================//*****
//==========================================================//*****
//==========================================================//*****


if($_POST['rubies_submit']!=''){
$a = floor($_POST['rubies_number']);
if(($a < 0)||($a == '')){$a = 0;}
// Логирование
mysql_querit('INSERT INTO `admin_mod_log` SET `id_user`="'.$ku['id'].'", `type`="rubies_log", `one_value`="'.normal_number($user_admin_mod['rubies']).'", `two_value`="'.$a.'", `time`="'.time().'", `id_komu`="'.$user_admin_mod['id'].'"');
mysql_querll('UPDATE `kolhoz_user` SET `rubies`="'.$a.'" WHERE id="'.$user_admin_mod['id'].'"');
header('location:?admin_mod='.$_GET['admin_mod']); exit;
}
echo '<form method="post" action="?admin_mod='.$_GET['admin_mod'].'">'."\n";
echo 'Рубины: <input type="text" size="25" name="rubies_number" value="'.normal_number($user_admin_mod['rubies']).'"/> <input type="submit" name="rubies_submit" value="OK"/>'."\n";
echo '</form>'."\n";
//==========================================================//
if($_POST['zkl_submit']!=''){
$a = floor($_POST['zkl_number']);
if(($a < 0)||($a == '')){$a = 0;}
// Логирование
mysql_querit('INSERT INTO `admin_mod_log` SET `id_user`="'.$ku['id'].'", `type`="zkl_log", `one_value`="'.normal_number($user_admin_mod['zkl']).'", `two_value`="'.$a.'", `time`="'.time().'", `id_komu`="'.$user_admin_mod['id'].'"');
mysql_querll('UPDATE `kolhoz_user` SET `zkl`="'.$a.'" WHERE id="'.$user_admin_mod['id'].'"');
header('location:?admin_mod='.$_GET['admin_mod']); exit;
}
echo '<form method="post" action="?admin_mod='.$_GET['admin_mod'].'">'."\n";
echo 'Ключи: <input type="text" size="25" name="zkl_number" value="'.normal_number($user_admin_mod['zkl']).'"/> <input type="submit" name="zkl_submit" value="OK"/>'."\n";
echo '</form>'."\n";
//==========================================================//
if($_POST['euro_submit']!=''){
$a = floor($_POST['euro_number']);
if(($a < 0)||($a == '')){$a = 0;}
// Логирование
mysql_querit('INSERT INTO `admin_mod_log` SET `id_user`="'.$ku['id'].'", `type`="euro_log", `one_value`="'.normal_number($user_admin_mod['euro']).'", `two_value`="'.$a.'", `time`="'.time().'", `id_komu`="'.$user_admin_mod['id'].'"');
mysql_querll('UPDATE `kolhoz_user` SET `euro`="'.$a.'" WHERE id="'.$user_admin_mod['id'].'"');
header('location:?admin_mod='.$_GET['admin_mod']); exit;
}
echo '<form method="post" action="?admin_mod='.$_GET['admin_mod'].'">'."\n";
echo 'Евро: <input type="text" size="25" name="euro_number" value="'.normal_number($user_admin_mod['euro']).'"/> <input type="submit" name="euro_submit" value="OK"/>'."\n";
echo '</form>'."\n";
//==========================================================//
if($_POST['level_submit']!=''){

$a = floor($_POST['level_number']);
if(($a < 0)||($a == '')){$a = 1;}
$sql_ww = mysql_querll("SELECT * FROM `kolhoz_level` ORDER BY `id`");
$ee_ww = 1;
while($sql_array = mysql_fetch_array($sql_ww)){
$ee_ww += $sql_array['rating'];
if($sql_array['level']>70){$ee_ww += 5000;}
if($sql_array['level'] == $a){break;}
}
// Логирование
mysql_querit('INSERT INTO `admin_mod_log` SET `id_user`="'.$ku['id'].'", `type`="level_log", `one_value`="'.$user_admin_mod['level'].'", `two_value`="'.$a.'", `time`="'.time().'", `id_komu`="'.$user_admin_mod['id'].'"');
mysql_querll('UPDATE `kolhoz_user` SET `level`="'.$a.'", `rating`="'.$ee_ww.'" WHERE id="'.$user_admin_mod['id'].'"');

}
echo '<form method="post" action="?admin_mod='.$_GET['admin_mod'].'">'."\n";
echo 'Уровень: <input type="text" size="25" name="level_number" value="'.normal_number($user_admin_mod['level']).'"/> <input type="submit" name="level_submit" value="OK"/>'."\n";
echo '</form>'."\n";
//==========================================================//
if($_POST['rating_submit']!=''){
$a = floor($_POST['rating_number']);
if(($a < 0)||($a == '')){$a = 0;}
// Логирование
mysql_querit('INSERT INTO `admin_mod_log` SET `id_user`="'.$ku['id'].'", `type`="rating_log", `one_value`="'.normal_number($user_admin_mod['rating']).'", `two_value`="'.$a.'", `time`="'.time().'", `id_komu`="'.$user_admin_mod['id'].'"');
mysql_querll('UPDATE `kolhoz_user` SET `rating`="'.$a.'" WHERE id="'.$user_admin_mod['id'].'"');
header('location:?admin_mod='.$_GET['admin_mod']); exit;
}
echo '<form method="post" action="?admin_mod='.$_GET['admin_mod'].'">'."\n";
echo 'Опыт: <input type="text" size="25" name="rating_number" value="'.normal_number($user_admin_mod['rating']).'"/> <input type="submit" name="rating_submit" value="OK"/>'."\n";
echo '</form>'."\n";
//==========================================================//
echo '<hr size="1" color="#114411"/>'."\n";

if($_POST['sh_time_sumit']!=''){
$a = floor($_POST['sh_time_days']);
$b = floor($_POST['sh_time_watch']);
if(($a < 0)||($a == '')){$a = 0;}
if(($b < 0)||($b == '')){$b = 0;}
$dd_d = (($a*24)*60)*60;
$hh_h = ($b*60)*60;
// Логирование
$rez = $dd_d+$hh_h;
mysql_querit('INSERT INTO `admin_mod_log` SET `id_user`="'.$ku['id'].'", `type`="sh_time_log", `one_value`="'.($user_admin_mod['sh_time']>time()?time_left($user_admin_mod['sh_time']-time()):'0 д. 0 ч.').'", `two_value`="'.($rez>1?time_left($rez):'0 д. 0 ч.').'", `time`="'.time().'", `id_komu`="'.$user_admin_mod['id'].'"');
mysql_querll('UPDATE `kolhoz_user` SET `sh_time`="'.($rez+time()).'" WHERE id="'.$user_admin_mod['id'].'"');
header('location:?admin_mod='.$_GET['admin_mod']); exit;
}
echo '<form method="post" action="?admin_mod='.$_GET['admin_mod'].'">'."\n";
echo 'Шахты: <span class="title">'."\n";
if($user_admin_mod['sh_time']>time()){echo time_left($user_admin_mod['sh_time']-time());} else {echo '0 д. 0 ч.';}
echo '</span><br/>'."\n";
echo 'Дни:<input type="text" size="6" name="sh_time_days"/> Часы:<input type="text" size="5" name="sh_time_watch"/><br/>'."\n";
echo '<input type="submit" name="sh_time_sumit" value="Установить время"/>'."\n";
echo '</form>'."\n";

//----------------------------------

echo '<hr size="1" color="#114411"/>'."\n";
$sha_number = mysql_result(mysql_querll('SELECT COUNT(`id`) FROM `kolhoz_ground_sh` WHERE `id_user`="'.$_GET['admin_mod'].'"'), 0);
if($_POST['sha_submit']!=''){
$a = floor($_POST['sha_number']);
if(($a < 0)||($a == '')){$a = 0;}
elseif($a > 200){$a = 200;}
if($a!=$sha_number){
$num_while = 1;
if($a>$sha_number){
$sum = $a - $sha_number;
while($sum>=$num_while){
mysql_querll('INSERT INTO `kolhoz_ground_sh` SET `id_user`="'.$_GET['admin_mod'].'"');
$num_while++;
}
} else {
$sum = $sha_number - $a;
mysql_querll('DELETE FROM `kolhoz_ground_sh` WHERE `id_user`="'.$_GET['admin_mod'].'" LIMIT '.$sum.'');
}
}
$sha_number_rez = mysql_result(mysql_querll('SELECT COUNT(`id`) FROM `kolhoz_ground_sh` WHERE `id_user`="'.$_GET['admin_mod'].'"'), 0);
// Логирование
mysql_querit('INSERT INTO `admin_mod_log` SET `id_user`="'.$ku['id'].'", `type`="sha_number_log", `one_value`="'.$sha_number.'", `two_value`="'.$sha_number_rez.'", `time`="'.time().'", `id_komu`="'.$user_admin_mod['id'].'"');
header('location:?admin_mod='.$_GET['admin_mod']); exit;
}
echo '<form method="post" action="?admin_mod='.$_GET['admin_mod'].'">'."\n";
echo 'Количество шахт: <input type="text" size="10" name="sha_number" value="'.$sha_number.'"/> <input type="submit" name="sha_submit" value="OK"/>'."\n";
echo '</form>'."\n";

//==========================================================//
echo '<hr size="1" color="#114411"/>'."\n";

if($_POST['alm_time_sumit']!=''){
$a = floor($_POST['alm_time_days']);
$b = floor($_POST['alm_time_watch']);
if(($a < 0)||($a == '')){$a = 0;}
if(($b < 0)||($b == '')){$b = 0;}
$dd_d = (($a*24)*60)*60;
$hh_h = ($b*60)*60;
// Логирование
$rez = $dd_d + $hh_h;
mysql_querit('INSERT INTO `admin_mod_log` SET `id_user`="'.$ku['id'].'", `type`="almaznaya_time_log", `one_value`="'.($user_admin_mod['almaznaya_time']>time()?time_left($user_admin_mod['almaznaya_time']-time()):'0 д. 0 ч.').'", `two_value`="'.($rez>1?time_left($rez):'0 д. 0 ч.').'", `time`="'.time().'", `id_komu`="'.$user_admin_mod['id'].'"');
mysql_querll('UPDATE `kolhoz_user` SET `almaznaya_time`="'.($rez+time()).'" WHERE id="'.$user_admin_mod['id'].'"');
header('location:?admin_mod='.$_GET['admin_mod']); exit;
}
echo '<form method="post" action="?admin_mod='.$_GET['admin_mod'].'">'."\n";
echo 'Алмазная: <span class="title">'."\n";
if($user_admin_mod['almaznaya_time']>time()){echo time_left($user_admin_mod['almaznaya_time']-time());} else {echo '0 д. 0 ч.';}
echo '</span><br/>'."\n";
echo 'Дни:<input type="text" size="6" name="alm_time_days"/> Часы:<input type="text" size="5" name="alm_time_watch"/><br/>'."\n";
echo '<input type="submit" name="alm_time_sumit" value="Установить время"/>'."\n";
echo '</form>'."\n";

//----------------------------------

echo '<hr size="1" color="#114411"/>'."\n";
$bel_number = mysql_result(mysql_querll('SELECT COUNT(`id`) FROM `kolhoz_almaznaya_belts` WHERE `id_user`="'.$_GET['admin_mod'].'"'), 0);
if($_POST['bel_submit']!=''){
$a = floor($_POST['bel_number']);
if(($a < 0)||($a == '')){$a = 0;}
elseif($a > 100){$a = 100;}
if($a!=$bel_number){
$num_while = 1;
if($a>$bel_number){
$sum = $a - $bel_number;
while($sum>=$num_while){
mysql_querll('INSERT INTO `kolhoz_almaznaya_belts` SET `id_user`="'.$_GET['admin_mod'].'"');
$num_while++;
}
} else {
$sum = $bel_number - $a;
mysql_querll('DELETE FROM `kolhoz_almaznaya_belts` WHERE `id_user`="'.$_GET['admin_mod'].'" LIMIT '.$sum.'');
}
}
$bel_number_rez = mysql_result(mysql_querll('SELECT COUNT(`id`) FROM `kolhoz_almaznaya_belts` WHERE `id_user`="'.$_GET['admin_mod'].'"'), 0);
// Логирование
mysql_querit('INSERT INTO `admin_mod_log` SET `id_user`="'.$ku['id'].'", `type`="bel_number_log", `one_value`="'.$bel_number.'", `two_value`="'.$bel_number_rez.'", `time`="'.time().'", `id_komu`="'.$user_admin_mod['id'].'"');
header('location:?admin_mod='.$_GET['admin_mod']); exit;
}
echo '<form method="post" action="?admin_mod='.$_GET['admin_mod'].'">'."\n";
echo 'Количество белтов: <input type="text" size="10" name="bel_number" value="'.$bel_number.'"/> <input type="submit" name="bel_submit" value="OK"/>'."\n";
echo '</form>'."\n";

//==========================================================//
echo '<hr size="1" color="#114411"/>'."\n";

if(($_POST['plat_rol_time_sumit']!='')&&($_POST['stata']!='')){
$a = floor($_POST['plat_rol_time_days']);
$b = floor($_POST['plat_rol_time_watch']);
if(($a < 0)||($a == '')){$a = 0;}
if(($b < 0)||($b == '')){$b = 0;}
if($_POST['stata']==1){$cc = 'blatnoy';}
elseif($_POST['stata']==2){$cc = '';}
$dd_d = (($a*24)*60)*60;
$hh_h = ($b*60)*60;
mysql_querll('UPDATE `kolhoz_user` SET `plat_rol`="'.$cc.'", `plat_rol_time`="'.(($dd_d+$hh_h)+time()).'" WHERE id="'.$user_admin_mod['id'].'"');
header('location:?admin_mod='.$_GET['admin_mod']); exit;
}
echo '<form method="post" action="?admin_mod='.$_GET['admin_mod'].'">'."\n";
if($user_admin_mod['plat_rol_time']>time()){
echo 'Платный статус: <span class="title">'.plat_rol_name($user_admin_mod['id']).'</span> на <span class="title">'."\n";
echo time_left($user_admin_mod['plat_rol_time']-time());
echo '</span><br/>'."\n";
} else {echo '<span class="title">Нет платного статуса!</span><br/>'."\n";}
echo '<label>[Блатной <input type="radio" name="stata" value="1"/>]</label> <label>[Нет статуса <input type="radio" name="stata" value="2"/>]</label><!-- <label>[Нет <input type="radio" name="stata" value="3"/>]</label>--><br/>'."\n";
echo 'Дни:<input type="text" size="6" name="plat_rol_time_days"/> Часы:<input type="text" size="5" name="plat_rol_time_watch"/><br/>'."\n";
echo '<input type="submit" name="plat_rol_time_sumit" value="Установить время"/>'."\n";
echo '</form>'."\n";
//==========================================================//
} else {echo 'Введите целочисленный ID пользователя в поле выше!';}

echo '</div></div>'."\n";
include_once('inc/foot.php');
} else {header('location:?myfarm');}
?>