$dsp=mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_dlg` WHERE `id_dg` = "'.mysql_real_escape_string((int)$_GET['talk']).'" AND `qid` = "0" ORDER BY `page` DESC LIMIT 1'));
$dsp=($dsp['page']+1);
mysql_query('INSERT INTO `dungeon_dlg` (`id_dg`,`page`,`qid`,`type`) VALUES ("'.mysql_real_escape_string((int)$_GET['talk']).'","'.mysql_real_escape_string((int)$dsp).'","0","1")');
$dsp=mysql_query('SELECT * FROM `dungeon_dlg` WHERE `id_dg` = "'.mysql_real_escape_string((int)$_GET['talk']).'" AND `qid` = "0"');
while($dpl=mysql_fetch_array($dsp)){
$dact=mysql_fetch_array(mysql_query('SELECT `id` FROM `dungeon_dlg` WHERE `id_dg` = "'.mysql_real_escape_string((int)$_GET['talk']).'" AND `qid` > "0" AND `action` LIKE "%go|'.$dpl['page'].'%" LIMIT 1'));