Файл: modules/blog/write.php
Строк: 54
<?php
/**
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) 2013, Taras Chornyi, Sergiy Mazurenko, Ivan Kotliar
* @link http://perf-engine.net
* @package PerfEngine
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
if(!User::logged()) redirect('/');
$locate = 'in_blogs';
if(isset($_GET['write']))
{
$text = input($_POST['text']);
$name = input($_POST['name']);
$tags = input($_POST['tags']);
if(!empty($text) && !empty($name) && !empty($tags) && antiflood('blogs', 'text', $text) == false)
{
$db->query("INSERT INTO `blogs` SET `name` = '$name', `text` = '$text', `tags` = '$tags', `user_id` = '".User::Id()."', `time` = '". time() ."'");
$db->query("UPDATE `users` SET `balance` = '".(User::profile('balance')+1)."' WHERE `id` = '". User::Id() ."'");
// print_r($db->errorInfo());
redirect('/blog/note/'.$db->lastInsertId());
}
}
$title = _t('write_note').' | '._t('blogs');
include_header($title);
Template::div('title', $title);
echo '<div class="post">
<form action="/blog/write?write" method="post">
'. _t('name').':<br/>
<input type="text" name="name" /><br/>
'. _t('message').':<br/>
<textarea name="text" rows="5" cols="26"></textarea><br/>
'. _t('blog_tags') .':<br/>
<input type="text" name="tags" /><br/>
<input type="submit" value="'. _t('send') .'" />
</form></div>';
echo '<div class="block">'
. NAV.' <a href="/blog">'. _t('blogs').'</a><br/>'
.HICO.' <a href="/">'._t('home').'</a>
</div>';
include_footer();
?>