Файл: zfarm.mobi/inc/admin/UpdateAssignment.php
Строк: 497
<?php
$title='Редактирование заданий';
include_once '../system/config.php';
if($ku['status']!=3)
{
echo "<div class='content'>";
echo "<div class='div'>";
echo 'Так просто ты тут ни чего не узнаешь. Попробуй найти того, кто тебе объяснит.';
include_once '../system/foot.php';
echo "</div></div>";
}
if(isset($_GET['go'])){
echo"<div class='rzd2'></div><div class='menuin2'>";
echo'<div class="title">Задания</div>';
echo" <div class='block'><a href='/UpdateAssignment/new/'>Создать новое</a> </div>";
echo" <div class='block'><a href='/UpdateAssignment/list/'>Редактирование существующих</a> (".mysql_result(mysql_query("SELECT COUNT(*) FROM assignments where id>'0'"), 0).")</div>";
}
if(isset($_GET['new'])){
echo"<div class='rzd2'></div><div class='menuin2'>";
echo'<div class="title">Добавление нового задания</div>';
if(isset($_POST['ok']))
{
$name = $_POST['name'];
$opis = $_POST['opis'];
$ruby = $_POST['ruby'];
$money = $_POST['money'];
$exp = $_POST['exp'];
$scarerow = $_POST['scarerow'];
$hydropinics = $_POST['hydropinics'];
$type_hydropinics = $_POST['type_hydropinics'];
$colorName = $_POST['colorName'];
$type_color = $_POST['type_color'];
$key_gold = $_POST['key_gold'];
$key_silver = $_POST['key_silver'];
$key_normal = $_POST['key_normal'];
$key_bronze = $_POST['key_bronze'];
$key_magic = $_POST['key_magic'];
$plant1 = $_POST['plant1'];
$plant2 = $_POST['plant2'];
$plant3 = $_POST['plant3'];
$pet1 = $_POST['pet1'];
$pet2 = $_POST['pet2'];
$pet3 = $_POST['pet3'];
$plants1 = $_POST['plant-1'];
$plants2 = $_POST['plant-2'];
$plants3 = $_POST['plant-3'];
$pets1 = $_POST['pet-1'];
$pets2 = $_POST['pet-2'];
$pets3 = $_POST['pet-3'];
$level = $_POST['level'];
if (!isset($err))
{
mysql_query("INSERT INTO `assignments` SET `level` = '$level', `name` = '$name', `opis` = '$opis', `exp` = '$exp', `money` = '$money', `ruby` = '$ruby', `scarerow` = '$scarerow', `hydropinics` = '$hydropinics', `type_hydropinics` = '$type_hydropinics',`colorName` = '$colorName', `type_color` = '$type_color', `key_gold` = '$key_gold', `key_bronze` = '$key_bronze', `key_normal` = '$key_normal', `key_magic` = '$key_magic', `key_silver` = '$key_silver', `plant1` = '$plant1', `plant2` = '$plant2', `plant3` = '$plant3', `plant-1` = '$plants1', `plant-2` = '$plants2', `plant-3` = '$plants3',`pet1` = '$pet1', `pet2` = '$pet2', `pet3` = '$pet3', `pet-1` = '$pets1', `pet-2` = '$pets2', `pet-3` = '$pets3'");
header("Location:/UpdateAssignment/new/");
}
}
echo "<ul>";
echo "<li style='padding-bottom:8px'>";
echo "<div class='div'>";
echo "<form method="post">n";
echo "Название:<br /><input class='btnp' name="name" type="text" maxlength='32' value='$ass[nick]' /><br />n";
echo "Описание:<br /><input class='btnp' name="opis" type="text" maxlength='32000' value='$ass[money]' /><br />n";
echo "Уровень:<br /><input class='btnp' name="level" type="text" maxlength='32' value='$ass[money]' /><br />n";
echo "Растение 1 (ID):<br /><input class='btnp' name="plant1" type="text" maxlength='32' value='$ass[rating]' /><br />n";
echo "Количество:<br /><input class='btnp' name="plant-1" type="text" maxlength='32' value='$ass[rating]' /><br />n";
echo "Растение 2 (ID):<br /><input class='btnp' name="plant2" type="text" maxlength='32' value='$ass[rating]' /><br />n";
echo "Количество:<br /><input class='btnp' name="plant-2" type="text" maxlength='32' value='$ass[rating]' /><br />n";
echo "Растение 3 (ID):<br /><input class='btnp' name="plant3" type="text" maxlength='32' value='$ass[rating]' /><br />n";
echo "Количество:<br /><input class='btnp' name="plant-3" type="text" maxlength='32' value='$ass[rating]' /><br />n";
echo "Животное 1 (ID):<br /><input class='btnp' name="pet1" type="text" maxlength='32' value='$ass[rating]' /><br />n";
echo "Количество:<br /><input class='btnp' name="pet-1" type="text" maxlength='32' value='$ass[rating]' /><br />n";
echo "Животное 2 (ID):<br /><input class='btnp' name="pet2" type="text" maxlength='32' value='$ass[rating]' /><br />n";
echo "Количество:<br /><input class='btnp' name="pet-2" type="text" maxlength='32' value='$ass[rating]' /><br />n";
echo "Животное 3 (ID):<br /><input class='btnp' name="pet3" type="text" maxlength='32' value='$ass[rating]' /><br />n";
echo "Количество:<br /><input class='btnp' name="pet-3" type="text" maxlength='32' value='$ass[rating]' /><br />n";
echo "<h3>Награда</h3>";
echo "Рубины:<br /><input class='btnp' name="ruby" type="text" maxlength='32' value='$ass[rubies]'/><br />n";
echo "Монеты:<br /><input class='btnp' name="money" type="text" maxlength='32' value='$ass[level]'/><br />n";
echo "Опыт:<br /><input class='btnp' name="exp" type="text" maxlength='32' value='$ass[key]' /><br />n";
echo "Гидропоника (часы):<br /><input class='btnp' name="hydropinics" type="text" maxlength='32' value='$ass[ogran]' /><br />n";
echo "Гидропоника (% бонуса):<br /><input class='btnp' name="type_hydropinics" type="text" maxlength='32' value='$ass[icon]' /><br />n";
echo "Пугало (часы):<br /><input class='btnp' name="screrow" type="text" maxlength='32' value='$ass[email]' /><br />n";
echo "Цвет ника (часы):<br /><input class='btnp' name="colorName" type="text" maxlength='32' value='$ass[stat]' /><br />n";
echo "Цвет ника (цвет):<br /><input class='btnp' name="type_color" type="text" maxlength='32' value='$ass[action]' /><br />n";
echo "Золотых ключей:<br /><input class='btnp' name="key_gold" type="text" maxlength='32' value='$ass[action]' /><br />n";
echo "Проклятых ключей:<br /><input class='btnp' name="magic_gold" type="text" maxlength='32' value='$ass[action]' /><br />n";
echo "Серебрянных ключей:<br /><input class='btnp' name="silver_gold" type="text" maxlength='32' value='$ass[action]' /><br />n";
echo "Обычных ключей:<br /><input class='btnp' name="key_normal" type="text" maxlength='32' value='$ass[action]' /><br />n";
echo "Бронзовых ключей:<br /><input class='btnp' name="key_bronze" type="text" maxlength='32' value='$ass[action]' /><br />n";
echo "<input value='Сохранить' type='submit' name='ok'/>n";
}
/////////////////////////
if(isset($_GET['list']))
{
echo"<div class='rzd2'></div><div class='menuin2'>";
echo'<div class="title">Список заданий</div>';
$ku['set'] = 500;
$post = mysql_fetch_array(mysql_query("SELECT * FROM `assignments`"));
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `assignments`"),0);
$k_page=k_page($k_post,$ku['set']);
$page=page($k_page);
$start=$ku['set']*$page-$ku['set'];
$xx = mysql_query("SELECT * FROM `assignments` ORDER BY level DESC LIMIT $start, $ku[set]");
while($ASS=mysql_fetch_assoc($xx)){
echo "<div class='block'><a href='/UpdateAssignment/id/$ASS[id]'>$ASS[name]</a></div>";
}
}
if(isset($_GET['id']) && ($_GET['id'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `assignments` WHERE `id` = '".($_GET['id'])."'"),0)!=0){
$ass = mysql_fetch_array(mysql_query("SELECT * FROM `assignments` WHERE `id` = '".($_GET['id'])."'"));
echo"<div class='rzd2'></div><div class='menuin2'>";
echo'<div class="title">'.$ass['name'].'</div>';
if(isset($_POST['ok']))
{
$name = $_POST['name'];
$opis = $_POST['opis'];
$ruby = $_POST['ruby'];
$money = $_POST['money'];
$exp = $_POST['exp'];
$scarerow = $_POST['scarerow'];
$hydropinics = $_POST['hydropinics'];
$type_hydropinics = $_POST['type_hydropinics'];
$colorName = $_POST['colorName'];
$type_color = $_POST['type_color'];
$key_gold = $_POST['key_gold'];
$key_silver = $_POST['key_silver'];
$key_normal = $_POST['key_normal'];
$key_bronze = $_POST['key_bronze'];
$key_magic = $_POST['key_magic'];
$plant1 = $_POST['plant1'];
$plant2 = $_POST['plant2'];
$plant3 = $_POST['plant3'];
$pet1 = $_POST['pet1'];
$pet2 = $_POST['pet2'];
$pet3 = $_POST['pet3'];
$plants1 = $_POST['plant-1'];
$plants2 = $_POST['plant-2'];
$plants3 = $_POST['plant-3'];
$pets1 = $_POST['pet-1'];
$pets2 = $_POST['pet-2'];
$pets3 = $_POST['pet-3'];
$level = $_POST['level'];
if (!isset($err))
{
mysql_query("UPDATE `assignments` SET `level` = '$level', `name` = '$name', `opis` = '$opis', `exp` = '$exp', `money` = '$money', `ruby` = '$ruby', `scarerow` = '$scarerow', `hydropinics` = '$hydropinics', `type_hydropinics` = '$type_hydropinics',`colorName` = '$colorName', `type_color` = '$type_color', `key_gold` = '$key_gold', `key_bronze` = '$key_bronze', `key_normal` = '$key_normal', `key_magic` = '$key_magic', `key_silver` = '$key_silver', `plant1` = '$plant1', `plant2` = '$plant2', `plant3` = '$plant3', `plant-1` = '$plants1', `plant-2` = '$plants2', `plant-3` = '$plants3',`pet1` = '$pet1', `pet2` = '$pet2', `pet3` = '$pet3', `pet-1` = '$pets1', `pet-2` = '$pets2', `pet-3` = '$pets3' WHERE `id` = '$ass[id]'");
header("Location:/UpdateAssignment/new/");
}
}
echo "<ul>";
echo "<li style='padding-bottom:8px'>";
echo "<div class='div'>";
echo "<form method="post">n";
echo "Название:<br /><input class='btnp' name="name" type="text" maxlength='32' value='$ass[name]' /><br />n";
echo "Описание:<br /><input class='btnp' name="opis" type="text" maxlength='32' value='$ass[opis]' /><br />n";
echo "Уровень:<br /><input class='btnp' name="level" type="text" maxlength='32' value='$ass[level]' /><br />n";
echo "Растение 1 (ID):<br /><input class='btnp' name="plant1" type="text" maxlength='32' value='$ass[plant1]' /><br />n";
echo "Количество:<br /><input class='btnp' name="plant-1" type="text" maxlength='32' value='".$ass['plant-1']."' /><br />n";
echo "Растение 2 (ID):<br /><input class='btnp' name="plant2" type="text" maxlength='32' value='$ass[plant2]' /><br />n";
echo "Количество:<br /><input class='btnp' name="plant-2" type="text" maxlength='32' value='".$ass['plant-2']."' /><br />n";
echo "Растение 3 (ID):<br /><input class='btnp' name="plant3" type="text" maxlength='32' value='$ass[plant3]' /><br />n";
echo "Количество:<br /><input class='btnp' name="plant-3" type="text" maxlength='32' value='".$ass['plant-3']."' /><br />n";
echo "Животное 1 (ID):<br /><input class='btnp' name="pet1" type="text" maxlength='32' value='$ass[pet1]' /><br />n";
echo "Количество:<br /><input class='btnp' name="pet-1" type="text" maxlength='32' value='".$ass['pet-1']."' /><br />n";
echo "Животное 2 (ID):<br /><input class='btnp' name="pet2" type="text" maxlength='32' value='$ass[pet2]' /><br />n";
echo "Количество:<br /><input class='btnp' name="pet-2" type="text" maxlength='32' value='".$ass['pet-2']."' /><br />n";
echo "Животное 3 (ID):<br /><input class='btnp' name="pet3" type="text" maxlength='32' value='$ass[pet3]' /><br />n";
echo "Количество:<br /><input class='btnp' name="pet-3" type="text" maxlength='32' value='".$ass['pet-3']."' /><br />n";
echo "<h3>Награда</h3>";
echo "Рубины:<br /><input class='btnp' name="ruby" type="text" maxlength='32' value='$ass[ruby]'/><br />n";
echo "Монеты:<br /><input class='btnp' name="money" type="text" maxlength='32' value='$ass[money]'/><br />n";
echo "Опыт:<br /><input class='btnp' name="exp" type="text" maxlength='32' value='$ass[exp]' /><br />n";
echo "Гидропоника (часы):<br /><input class='btnp' name="hydropinics" type="text" maxlength='32' value='$ass[hydropinics]' /><br />n";
echo "Гидропоника (% бонуса):<br /><input class='btnp' name="type_hydropinics" type="text" maxlength='32' value='$ass[type_hydropinics]' /><br />n";
echo "Пугало (часы):<br /><input class='btnp' name="screrow" type="text" maxlength='32' value='$ass[scarerow]' /><br />n";
echo "Цвет ника (часы):<br /><input class='btnp' name="colorName" type="text" maxlength='32' value='$ass[colorName]' /><br />n";
echo "Цвет ника (цвет):<br /><input class='btnp' name="type_color" type="text" maxlength='32' value='$ass[type_color]' /><br />n";
echo "Золотых ключей:<br /><input class='btnp' name="key_gold" type="text" maxlength='32' value='$ass[key_gold]' /><br />n";
echo "Проклятых ключей:<br /><input class='btnp' name="key_magic" type="text" maxlength='32' value='$ass[key_magic]' /><br />n";
echo "Серебрянных ключей:<br /><input class='btnp' name="key_silver" type="text" maxlength='32' value='$ass[key_silver]' /><br />n";
echo "Обычных ключей:<br /><input class='btnp' name="key_normal" type="text" maxlength='32' value='$ass[key_normal]' /><br />n";
echo "Бронзовых ключей:<br /><input class='btnp' name="key_bronze" type="text" maxlength='32' value='$ass[key_bronze]' /><br />n";
echo "<input value='Сохранить' type='submit' name='ok'/>n";
echo "<div></div>";
echo "</div>";
}
/////////////
echo"</div></div><div class='rzd2'></div>";
include_once '../system/foot.php';
?>