Размер файла: 1.97Kb
<?php
include_once "../config.php";
include_once "../inc/inc.php";
include_once "../inc/func.php";
include_once "../inc/user.php";
$thema = (int)$thema;
if ($thema == 0) {
header ("Location: index.php?thema=$thema");
exit;
}
if ($kto == 'guest') {
header ("Location: index.php?thema=$thema");
exit;
}
if ($kto == 'user') {
$query = "SELECT tema_nomer FROM " . $pref . "tema WHERE id=" . $thema;
$ids = implode(mysql_fetch_assoc(mysql_query($query)));
if ($ids == '') {
header ("Location: index.php");
exit;
}
$msg = htmlspecialchars(stripslashes($msg));
if (strlen($msg) <= 2) {
header("Location: index.php?thema=$thema");
exit;
}
if (strlen($msg) >= 1025) {
header("Location: index.php?thema=$thema");
exit;
}
$zapros2 = 'INSERT INTO ' . $pref . 'tema_random_' . $ids . ' (login, id_user, data, datatext, msg, ip, brow) VALUES ("' . $login . '", ' . (int)$usdata['id'] . ', ' . time() . ', "' . vrem() . ' - ' . data() . '", "' . $msg . '", "' . ip() . '", "' . brow() . '");';
mysql_query($zapros2);
$query = "SELECT * FROM " . $pref . "tema WHERE id=" . $thema;
$res = mysql_fetch_array(mysql_query($query));
$all_posts = $res['all_post'] + 1;
$in_razd = $res['in_razd'];
$name_tema = $res['name_tema'];
$query = "UPDATE " . $pref . "tema SET all_post=" . $all_posts . ", last_post='" . $login . "', last_post_id=" . (int)$usdata['id'] . ", data_last=" . time() . ", data_last_post=" . time() . " WHERE tema_nomer=" . $ids;
mysql_query($query) or die ('ERROR');
$query = "UPDATE " . $pref . "forum SET last_theme_id=" . $thema . ", last_theme='" . $name_tema . "', last_autor='" . $login . "', last_autor_id=" . (int)$usdata['id'] . ", last_time='" . data() . " - " . vrem() . "' WHERE id=" . $in_razd;
mysql_query($query) or die ('ERROR');
header ("Location: index.php?thema=$thema&info=postok");
exit;
}
?>