View file system/comm_reply.php

File size: 1.33Kb
<?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']) {
				if ($_POST['text']) {
					$text = check($_POST['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 {
					error('Вы не заполнили поле.');
					nav('?act=comm_reply&amp;id='.$id);
				}
			} else {
				error('Антиспам. Разрешено писать раз в '.$config['antispam'].' сек.');
				nav('?act=comm&amp;id='.$comm['id_'.$type]);
			}
		} else {
			tp('Ответ на сообщение');
			echo '<form action="?act=comm_reply&amp;id='.$id.'&amp;ok=1" method="post">
			Сообщение(max250):<br /><textarea name="text" cols="" rows="3">[b]'.login_simple($comm['id_user']).'[/b], </textarea><br />';
			echo '<input name="submit" type="submit" value="Ok" />
			</form>';
			nav('?act=comm&amp;id='.$comm['id_'.$type]);
		}
	} else {
		redirect('?');
	}
} else {
	redirect('login.php');
}


?>