View file includes/comm_reply.php

File size: 1.51Kb
<?php

if ($u['id']) {
    $comm_r = mysql_query("SELECT `id`, `id_".$type."`, `id_user` FROM `".$type."_comm` WHERE `id` = '$id'");
    $comm = mysql_fetch_assoc($comm_r);
    if ($comm['id_user']) {
        if ($ok) {
            if (TIME > $_SESSION['antispam']) {
				$text = check($_POST['text']);
                if ($text) {
                    mysql_query("INSERT INTO `".$type."_comm` SET `id_".$type."` = '".$comm['id_'.$type]."', `id_user` = '$u[id]', `text` = '$text', `time` = '".TIME."'");
                    $_SESSION['antispam'] = TIME + $config['antispam'];
                    redirect('?act=comm&id='.$comm['id_'.$type]);
                } else {
                    redirect('?act=comm_reply&id='.$id);
                }
            } else {
                error($lang['antispam'].' '.$config['antispam'].' sec.');
                nav('?act=comm&amp;id='.$comm['id_'.$type]);
            }
        } else {
            tp($lang['reply']);
            echo '<div class="body"><form name="form" action="?act=comm_reply&amp;id='.$id.'&amp;ok=1" method="post">
             '.bbpanel('form', 'text').'<textarea name="text" cols="" rows="3">[b]'.username($comm['id_user'], 0).'[/b], </textarea><br />';
            echo '<input name="submit" type="submit" value="Ok" />
            </form>
			<a href="?act=comm&amp;id='.$comm['id_'.$type].'">Назад</a>&raquo; ответить
			</div>';
        }
    } else {
        redirect('?');
    }
} else {
    redirect('login.php');
}


?>