View file add.php

File size: 1.39Kb
<?php
// coding by Felis

require_once('sys/kernel.php');
require_once('temp/cap.php');

if($op == true)
{
	if(!$_POST)
	{
		echo $fnc->alert('Сказать', '<form action="'.CFILE.'" method="post">Текст поста:<br />
		<textarea rows="3" cols="22" name="post">'.($u ? $fnc->get_author($u).', ' : NULL).'</textarea><br />
		<input type="checkbox" name="trans" /> Транслит<br />
		<input type="submit" value="Отправить" />
		</form>');
		echo $fnc->cont('<a href="rules.php?mode=smiles">Смайлы</a> | <a href="rules.php?mode=bbcode">BB-коды</a><br /><a href="main.php">На главную</a>');
	}
	elseif($usr['banned'] == 'y' and $time - $usr['ban_point'] < $usr['ban_term'])
	{
		echo $fnc->alert('Ошибка!', 'Вы забанены в чате..');
	}
	else
	{
		$prp = $db->prepare("INSERT INTO `posts` (`time`,`author`,`text`) VALUES (?,?,?)");
		$prp->bind_param('iis', $timepost, $author, $post);
		
		$timepost = $time;
		$author = $uid;
		$post = $_POST['trans'] ? $fnc->trans($fnc->out($_POST['post'])) : $fnc->out($_POST['post']);
		
		if(empty($post))
		{
			$prp->close();
			header('Location: '.CFILE);
		}
		
		if($prp->execute())
		{
			$prp->close();
			header('Location: main.php');
		}
	}
}
else
{
	echo $fnc->alert('Ошибка!', _AUTH_ERROR);
}

require_once('temp/foot.php');

// конец файла ./add.php