diff --git a/modules_data/_mod.php b/modules_data/_mod.php index 5e4b00e9..c4b57196 100644 --- a/modules_data/_mod.php +++ b/modules_data/_mod.php @@ -1,10 +1,7 @@ 'light', 2 => 'admin', 3 => 'dark']; $merror = ''; - -$mod_login = $u->info['login']; - -if ($u->info['invise'] > 0) { - $mod_login = "Невидимка"; -} - $uer = ''; if (!empty($_POST['logingo'])) { @@ -96,7 +86,7 @@ if (!empty($_POST['marrypartner1']) && !empty($_POST['marrypartner2'])) { echo ''; -$p = mysql_fetch_array(mysql_query('SELECT * FROM `moder` WHERE `align` = "' . $u->info['align'] . '" LIMIT 1')); +$p = mysql_fetch_array(mysql_query('SELECT align FROM `moder` WHERE `align` = "' . $u->info['align'] . '" LIMIT 1')); if (!$m->isModerator && $u->info['align'] != 1 && $u->info['align'] != 3) { return; ######################### @@ -117,39 +107,21 @@ if (isset($_GET['go'])) { if ($go == 3 && $u->info['admin'] > 0) { ?> -
Редактирование обучающих квестов |
- - - info['admin'] > 0) { ?> - - + | Редактирование обучающих квестов |
+ + + | ||||||||||||||||
' . $merror . ''; - } - ?> + | = empty($merror) ? '' : "$merror" ?>
+
info['admin'] > 0) {
$pl['data'] = $_POST['pl_data'];
$pl['room'] = $_POST['pl_room'];
$pl['module'] = $_POST['pl_module'];
- mysql_query(
- 'UPDATE `an_quest` SET
- `name` = "' . mysql_real_escape_string($pl['name']) . '",
- `sex` = "' . mysql_real_escape_string($pl['sex']) . '",
- `ico_bot` = "' . mysql_real_escape_string($pl['ico_bot']) . '",
- `name_bot` = "' . mysql_real_escape_string($pl['name_bot']) . '",
- `info` = "' . mysql_real_escape_string($pl['info']) . '",
- `act` = "' . mysql_real_escape_string($pl['act']) . '",
- `next` = "' . mysql_real_escape_string($pl['next']) . '",
- `win` = "' . mysql_real_escape_string($pl['win']) . '",
- `data` = "' . mysql_real_escape_string($pl['data']) . '",
- `room` = "' . mysql_real_escape_string($pl['room']) . '",
- `module` = "' . mysql_real_escape_string($pl['module']) . '"
- WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
- );
- $pl = mysql_fetch_array(
- mysql_query(
- 'SELECT * FROM `an_quest` WHERE `id` = "' . mysql_real_escape_string(
- $_GET['eq']
- ) . '" LIMIT 1'
- )
- );
+
+ Db::sql('update an_quest set
+ name = ?,
+ sex = ?,
+ ico_bot = ?,
+ name_bot = ?,
+ info = ?,
+ act = ?,
+ next = ?,
+ win = ?,
+ data = ?,
+ room = ?,
+ module = ?
+ where id = ?',
+ [
+ $pl['name'],
+ $pl['sex'],
+ $pl['ico_bot'],
+ $pl['name_bot'],
+ $pl['info'],
+ $pl['act'],
+ $pl['next'],
+ $pl['win'],
+ $pl['data'],
+ $pl['room'],
+ $pl['module'],
+ $pl['id'],
+ ]);
+
+ $pl = Db::getRow('select * from an_quest where id = ?', [(int)$_GET['eq']]);
}
?>
-
Квест не найден.';
+ echo ' Квест не найден. >';
}
} else {
- echo 'Добавить новый квест'; + echo 'Добавить новый квест '; if (isset($_GET['del'])) { - mysql_query( - 'DELETE FROM `an_quest` WHERE `id` = "' . mysql_real_escape_string( - $_GET['del'] - ) . '" LIMIT 1' - ); + Db::sql('delete from an_quest where id = ?', [(int)$_GET['del']]); } elseif (isset($_GET['add'])) { - mysql_query('INSERT INTO `an_quest` (`sex`) VALUES ("0") '); + Db::sql('insert into an_quest (id) values (default)'); } - $sp = mysql_query('SELECT * FROM `an_quest`'); - while ($pl = mysql_fetch_array($sp)) { - echo ' '; + foreach (Db::getRows('select id, name, sex from an_quest') as ['id' => $qid, 'name' => $qname, 'sex' => $qsex]) { + $qsex = $sx[$qsex]; + echo << + $qid + $qname($qsex) + Изменить + Удалить + + + HTML; } } ?> @@ -264,603 +260,474 @@ if ($go == 3 && $u->info['admin'] > 0) { $qd['align'] = 3; } elseif ($_POST['align3'] == 1) { $qd['align'] = 7; - } elseif ($_POST['align4'] == 1) { - $qd['align'] = 2; - } - $i = 1; - while ($i != -1) { - if (isset($_POST['q_act_atr_' . $i])) { - if ($_POST['q_act_val_' . $i] != '') { - $qd['act_date'] .= $_POST['q_act_atr_' . $i] . ':=:' . $_POST['q_act_val_' . $i] . ':|:'; + + $i = 1; + while ($i != -1) { + if (isset($_POST['q_act_atr_' . $i])) { + if ($_POST['q_act_val_' . $i] != '') { + $qd['act_date'] .= $_POST['q_act_atr_' . $i] . ':=:' . $_POST['q_act_val_' . $i] . ':|:'; + } + } else { + $i = -2; + $qd['act_date'] = trim($qd['act_date'], ':|:'); } - } else { - $i = -2; - $qd['act_date'] = trim($qd['act_date'], ':|:'); + $i++; } - $i++; - } - $i = 1; - while ($i != -1) { - if (isset($_POST['q_tr_atr_' . $i])) { - if ($_POST['q_tr_val_' . $i] != '') { - $qd['tr_date'] .= $_POST['q_tr_atr_' . $i] . ':=:' . $_POST['q_tr_val_' . $i] . ':|:'; + $i = 1; + while ($i != -1) { + if (isset($_POST['q_tr_atr_' . $i])) { + if ($_POST['q_tr_val_' . $i] != '') { + $qd['tr_date'] .= $_POST['q_tr_atr_' . $i] . ':=:' . $_POST['q_tr_val_' . $i] . ':|:'; + } + } else { + $i = -2; + $qd['tr_date'] = trim($qd['tr_date'], ':|:'); } - } else { - $i = -2; - $qd['tr_date'] = trim($qd['tr_date'], ':|:'); + $i++; } - $i++; - } - $i = 1; - while ($i != -1) { - if (isset($_POST['q_ng_atr_' . $i])) { - if ($_POST['q_ng_val_' . $i] != '') { - $qd['win_date'] .= $_POST['q_ng_atr_' . $i] . ':=:' . $_POST['q_ng_val_' . $i] . ':|:'; + $i = 1; + while ($i != -1) { + if (isset($_POST['q_ng_atr_' . $i])) { + if ($_POST['q_ng_val_' . $i] != '') { + $qd['win_date'] .= $_POST['q_ng_atr_' . $i] . ':=:' . $_POST['q_ng_val_' . $i] . ':|:'; + } + } else { + $i = -2; + $qd['win_date'] = trim($qd['win_date'], ':|:'); } - } else { - $i = -2; - $qd['win_date'] = trim($qd['win_date'], ':|:'); + $i++; } - $i++; - } - $i = 1; - while ($i != -1) { - if (isset($_POST['q_nk_atr_' . $i])) { - if ($_POST['q_nk_val_' . $i] != '') { - $qd['lose_date'] .= $_POST['q_nk_atr_' . $i] . ':=:' . $_POST['q_nk_val_' . $i] . ':|:'; + $i = 1; + while ($i != -1) { + if (isset($_POST['q_nk_atr_' . $i])) { + if ($_POST['q_nk_val_' . $i] != '') { + $qd['lose_date'] .= $_POST['q_nk_atr_' . $i] . ':=:' . $_POST['q_nk_val_' . $i] . ':|:'; + } + } else { + $i = -2; + $qd['lose_date'] = trim($qd['lose_date'], ':|:'); } - } else { - $i = -2; - $qd['lose_date'] = trim($qd['lose_date'], ':|:'); + $i++; } - $i++; + Db::sql( + 'insert into quests (name, min_lvl, max_lvl, tr_date, act_date, win_date, lose_date, info, line, align, fast) values (?,?,?,?,?,?,?,?,?,?,?)', + [ + $qd['name'], + $qd['lvl'][0], + $qd['lvl'][1], + $qd['tr_date'], + $qd['act_date'], + $qd['win_date'], + $qd['lose_date'], + $qd['info'], + $qd['line'], + $qd['align'], + $qd['fast'], + ] + ); } - mysql_query( - 'INSERT INTO `quests` (`name`,`min_lvl`,`max_lvl`,`tr_date`,`act_date`,`win_date`,`lose_date`,`info`,`line`,`align`,`city`,`fast`) VALUES ( - "' . mysql_real_escape_string($qd['name']) . '","' . mysql_real_escape_string( - $qd['lvl'][0] - ) . '","' . mysql_real_escape_string($qd['lvl'][1]) . '", - "' . mysql_real_escape_string($qd['tr_date']) . '","' . mysql_real_escape_string( - $qd['act_date'] - ) . '","' . mysql_real_escape_string($qd['win_date']) . '", - "' . mysql_real_escape_string($qd['lose_date']) . '","' . mysql_real_escape_string( - $qd['info'] - ) . '","' . mysql_real_escape_string($qd['line']) . '", - "' . mysql_real_escape_string($qd['align']) . '","' . mysql_real_escape_string( - $qd['city'] - ) . '","' . mysql_real_escape_string($qd['fast']) . '")' - ); - } - ?> - + function addqnk() { + const dd = document.getElementById('qnk'); + adds[3]++; + dd.innerHTML = 'Атрибут: , значение: ' + dd.innerHTML; + } + -
|