Просмотр файла postnewmsg.php

Размер файла: 2.37Kb
<?php
/*
Proton wapforum v5
Запрещается убирать копирайты для дальнейшего распростанения скрипта!
В случае обнаружения ошибок обращайтесь к автору!
Приходите за новыми скриптами: http://svoboda.v1p.su/script удачи! :)
*/
include 'config.php';
include 'functions.php';
$razdel=$_POST['razdel'];
$part_id=part_gaga($razdel);
if (empty($part_id)) {
include 'head.php';
echo 'Такого раздела не существует!<br/>'; exit($end); }
$tema=$_POST['tema'];
$page=ceil(msg($razdel,$tema)/$vsego);
$topic_id=topic_gaga($tema);
if (empty($topic_id)) {
include 'head.php';
echo 'Такой темы не существует!<br/>'; exit($end); }
if (!empty($_SESSION['rand']))
{
$_SESSION['rand']='';
$_SESSION['text']='';
$mes=$_POST['mes'];
$mes=substr($mes,0,750);
$tema=substr($tema,0,50);
if (empty($mes)) {
include 'head.php';
echo 'Нужно заполнить форму!<br/>'; exit($end); }
$mes=bb_code($mes);
$mes=smile($mes);
$time=time();
$brows=$_SERVER['HTTP_USER_AGENT'];
$ip=$_SERVER['REMOTE_ADDR'];
if (!empty($id)) {
$user=$id; } else {
$user=$nick; }
$mes_id=newmes();
$buff=file_get_contents("msg.dat");
$fopen=fopen("msg.dat","w");
fputs($fopen,"$razdel#/#/#$tema#/#/#$mes_id#/#/#$user#/#/#$time#/#/#$brows#/#/#$ip#/#/#$mes#/#/#\r\n"."$buff");
fclose($fopen);
if (!empty($status)) {
$file=file('users.dat');
$count=count($file);
for($i=0;$i<$count;$i++)
{
$ex=explode('#/#/#',$file[$i]);
if ($ex[0]==$id)
{
$post=trim($ex[6])+1;
$string=str_replace($ex[0].'#/#/#'.$ex[1].'#/#/#'.$ex[2].'#/#/#'.$ex[3].'#/#/#'.$ex[4].'#/#/#'.$ex[5].'#/#/#'.$ex[6].'#/#/#'.$ex[7].'#/#/#'.$ex[8].'#/#/#'.$ex[9].'#/#/#'.$ex[10].'#/#/#'.$ex[11].'#/#/#'.$ex[12].'#/#/#'.$ex[13].'#/#/#'.$ex[14].'#/#/#',$ex[0].'#/#/#'.$ex[1].'#/#/#'.$ex[2].'#/#/#'.$ex[3].'#/#/#'.$ex[4].'#/#/#'.$ex[5].'#/#/#'.$post.'#/#/#'.$ex[7].'#/#/#'.$ex[8].'#/#/#'.$ex[9].'#/#/#'.$ex[10].'#/#/#'.$ex[11].'#/#/#'.$ex[12].'#/#/#'.$ex[13].'#/#/#'.$ex[14].'#/#/#',file_get_contents("users.dat"));
$fopen=fopen("users.dat","w");
fputs($fopen,$string);
fclose($fopen);
}
}
}
$_SESSION['text'].='Ваше сообщение успешно добавлено!<br/>';
}
else
{
$_SESSION['text'].='Сообщение не добавлено!<br/>';
}
header("location:msg.php?razdel=$razdel&tema=$tema&page=$page");
?>