49 lines
2.8 KiB
PHP
49 lines
2.8 KiB
PHP
<?php
|
|
/*
|
|
|
|
ßäðî äëÿ îáðàáîòêè äàííûõ.
|
|
Îáðàáîòêà ïîåäèíêîâ, îáðàáîòêà çàÿâîê, îáðàáîòêà áîòîâ, îáðàáîòêà ïåùåð, îáðàáîòêà òóðíèðîâ, îáðàáîòêà âðåìåííûõ ãåíåðàöèé
|
|
|
|
*/
|
|
|
|
define('GAME',true);
|
|
|
|
include('_incl_data/__config.php');
|
|
include('_incl_data/class/__db_connect.php');
|
|
include('_incl_data/class/__user.php');
|
|
//include('_incl_data/class/bot.logic.php');
|
|
|
|
|
|
if( $u->info['admin'] > 0 ) {
|
|
|
|
$itm = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_dlg` WHERE `id` = "'.mysql_real_escape_string($_GET['pid']).'" LIMIT 1'));
|
|
if(isset($itm['id'])) {
|
|
if($itm['qid'] == 0) {
|
|
if(isset($_POST['newdata'])) {
|
|
mysql_query('UPDATE `dungeon_dlg` SET `text` = "'.mysql_real_escape_string($_POST['newdata']).'" WHERE `id` = "'.mysql_real_escape_string($itm['id']).'" LIMIT 1');
|
|
die('<script>window.close();</script>');
|
|
}elseif(isset($_GET['delete']) && $_GET['delete'] == 'true') {
|
|
//Óäàëÿåì ñàìó ñòðàíèöó äèàëîãà
|
|
mysql_query('DELETE FROM `dungeon_dlg` WHERE `id` = "'.mysql_real_escape_string($itm['id']).'" LIMIT 1');
|
|
//Óäàëÿåì îòâåòû ñòðàíèöû äèàëîãà
|
|
mysql_query('DELETE FROM `dungeon_dlg` WHERE `qid` = "'.mysql_real_escape_string($itm['id']).'"');
|
|
die('<script>window.close();</script>');
|
|
}
|
|
echo '<form method="post" action="?pid='.$itm['id'].'"><b>Íîìåð äèàëîãà: '.$itm['id'].'</b><br><textarea name="newdata" rows="20" cols="100">'.$itm['text'].'</textarea><br><input type="submit" value="Ñîõðàíèòü"></form><div><a href="?pid='.((int)$_GET['pid']).'&delete=true">Óäàëèòü ñòðàíèöó äèàëîãà</a></div>';
|
|
}else{
|
|
if(isset($_POST['newdata'])) {
|
|
mysql_query('UPDATE `dungeon_dlg` SET `text` = "'.mysql_real_escape_string($_POST['newdata']).'",`action` = "'.mysql_real_escape_string($_POST['newdata2']).'",`tr` = "'.mysql_real_escape_string($_POST['newdata3']).'",`sort` = "'.mysql_real_escape_string((int)$_POST['newdata4']).'" WHERE `id` = "'.mysql_real_escape_string($itm['id']).'" LIMIT 1');
|
|
die('<script>window.close();</script>');
|
|
}elseif(isset($_GET['delete']) && $_GET['delete'] == 'true') {
|
|
//Óäàëÿåì ñàìó ñòðàíèöó äèàëîãà
|
|
mysql_query('DELETE FROM `dungeon_dlg` WHERE `id` = "'.mysql_real_escape_string($itm['id']).'" LIMIT 1');
|
|
die('<script>window.close();</script>');
|
|
}
|
|
echo '<form method="post" action="?pid='.$itm['id'].'"><b>Íîìåð âàðèàíòà îòâåòà: '.$itm['id'].'</b><br><textarea name="newdata" rows="3" cols="100">'.$itm['text'].'</textarea><br>Äåéñòâèÿ:<textarea name="newdata2" rows="5" cols="100">'.$itm['action'].'</textarea><br>Òðåáóåò:<textarea name="newdata3" rows="5" cols="100">'.$itm['tr'].'</textarea><br>Ïðèîðèòåò âûâîäà: <input name="newdata4" type="text" value="'.$itm['sort'].'"><br><input type="submit" value="Ñîõðàíèòü"></form><div><a href="?pid='.((int)$_GET['pid']).'&delete=true">Óäàëèòü âàðèàíò îòâåòà</a></div>';
|
|
}
|
|
}else{
|
|
echo 'Äèàëîã íå íàéäåí.';
|
|
}
|
|
}
|
|
|
|
?>
|