<?php
chdir("../");
include "inc/functions.inc.php";
$mysql = new mysql(DB_MAIN);
if(!isset($_POST['message']) || !isset($_POST['subject']))
{
header("Location: ".SITE_URL."Blogs/Post&berror");
} else {
$sel = $mysql->select(PRE."blogs", "userid='".$_COOKIE['user']."'", "id", "DESC", "1");
while($a = mysql_fetch_assoc($sel))
{
$postid = $a['postid']+1;
}
$mysql->insert(PRE."blogs", array("postid", "userid", "subject", "message", "date", "cat"), array($postid, $_COOKIE['user'], strip_tags($_POST['subject']), strip_tags($_POST['message']), time(), $_POST['cat']));
header("Location: ".SITE_URL."Blogs/View/".$_COOKIE['user']);
}
?>