Просмотр файла adm/addpost.php

Размер файла: 2.24Kb
<?php
include_once "../config.php";
include_once "../inc/inc.php";
include_once "../inc/func.php";
include_once "../inc/user.php";
if ($dostup != '1') {
    echo "ПАШШШШШШШОЛНАХУЙ";
    include_once "../themes/$theme/foot.php";
    exit;
} else {
    $thema = (int)$thema;
    if ($thema == 0) {
        header ("Location: forum.php?thema=$thema");
        exit;
    } 
    if ($kto == 'guest') {
        header ("Location: forum.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: forum.php");
            exit;
        } 
        $msg = htmlspecialchars(stripslashes($msg));
        if (strlen($msg) <= 2) {
            header("Location: forum.php?thema=$thema");
            exit;
        } 
        if (strlen($msg) >= 1025) {
            header("Location: forum.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: forum.php?thema=$thema&info=postok");
        exit;
    } 
} 

?>