View file book/add.php

File size: 4.92Kb
<?php
#-----------------------------------------------------#
#          ********* WAP-MOTORS *********             #
#             Made by   :  VANTUZ                     #
#               E-mail  :  [email protected]         #
#                 Site  :  http://pizdec.ru           #
#             WAP-Site  :  http://visavi.net          #
#                  ICQ  :  36-44-66                   #
#  Вы не имеете право вносить изменения в код скрипта #
#-----------------------------------------------------#   
//-------------------------------------//
//------Mod by Energetik------//
//--http://energetik.h2m.ru--//
//-------------------------------------//
require_once"../template/start.php";
require_once"../template/regglobals.php";
require_once"../template/config.php";
require_once"../template/functions.php";
require_once"../template/antidos.php";
require_once"../template/gzip.php";
require_once"../template/header.php";
require_once"../template/setbook.php";

if (!($_SESSION['log']!="" && md5($_SESSION['par'])!="" && md5($_SESSION['par'])==$provpar && $_SESSION['log']==$provlog )){

if($_SESSION['press_kod']!=$provkod){
$press_kod=rand(1000,9999); $_SESSION['press_kod'] = "$press_kod";
header ("Location: index.php?isset=kodbookadd&".SID); exit;}}

if (isset ($_GET['msg']) or isset ($_GET['name'])){
header ("Location: index.php?isset=posts&".SID); exit;}

if ($config_bookadds=="0" && $log==""){
header ("Location: index.php?isset=posts&".SID); exit;}

if ($provlog==$_SESSION['log'] && $provpar==md5($_SESSION['par']) && $_SESSION['log']!="" && md5($_SESSION['par'])!=""){
$name=$log;
}else{
if($config_bookadds=="1"){$name=$config_guestsuser;}}

if(strlen(trim($msg))<6 || $name==""){header ("Location: index.php?isset=posts&".SID); exit;}

//-----Новый антифлуд-----//
if($config_floodstime > 0){
if(flooder($ip, $php_self) == TRUE ){header ("Location: index.php?isset=antiflood&".SID); exit;}
$flood_file = fopen(BASEDIR."local/flood.dat", "a+");
flock ($flood_file,LOCK_EX);
fputs ($flood_file,"$sitetime|$ip|$php_self|\r\n");
fflush($flood_file);
flock ($flood_file,LOCK_UN);
fclose($flood_file);}

//-----Карантин-----//
if($config_karantin > 0){
if($udata[6]+$config_karantin>$sitetime){header ("Location: index.php?isset=karantin&".SID); exit;}}

$brow=check($brow);
$msg=wordwrap($msg,150,' ',1);
$msg=substr($msg,0,1200);
$msg=check($msg);
$name=check($name);
$msg=no_br($msg,"<br>");
$guestname=htmlspecialchars(utf_substr($guestname,0,10));
	
if(!isset($_SESSION['guestname']) or $_SESSION['guestname']!=$guestname) $_SESSION['guestname']=$guestname;

/////////////////////////////////
if($trans=="y"){$msg=transliter($msg);}
$msg = antimat($msg);
$msg = smiles($msg);

if ($mgq==0){$msg="$msg";}
if ($mgg==1){$msg="[big] $msg [/big]";}
if ($mgg==2){$msg="[small] $msg [/small]";}
if ($mgg==3){$msg="[b] $msg [/b]";}
if ($mgg==4){$msg="[i] $msg [/i]";}
if ($mgg==5){$msg="[u] $msg [/u]";}
if ($mgg==6){$msg="[del] $msg [/del]";}
if ($mgg==7){$msg="[code] $msg [/code]";}
if ($mgg==8){$msg="[blue] $msg [/blue]";}
if ($mgg==9){$msg="[red] $msg [/red]";}
if ($mgg==10){$msg="[green] $msg [/green]";}
if ($mgg==11){$msg="[yellow] $msg [/yellow]";}

/////////////////////////////////
$text=$msg.'|'.$name.'||'.$sitetime.'|'.$brow.'|'.$ip.'|||'.$guestname.'||';
$text=no_br($text);

$fp=fopen("../local/book.dat","a+");
flock ($fp,LOCK_EX);
fputs ($fp,"$text\r\n");
fflush($fp);
flock ($fp,LOCK_UN);
fclose($fp);

/////////////////////////////////
$f = file("../local/local.dat"); 
$u = explode("|",$f[0]);
$u[0]++;
$t=$u[0].'|'.$u[1].'|'.$u[2].'|'.$u[3].'|'.$u[4].'|'.$u[5].'|'.$u[6].'|'.$u[7].'|'.$u[8].'|'.$u[9].'|'.$u[10].'|';

$fp = fopen(BASEDIR."local/local.dat","a+");
flock ($fp,LOCK_EX);
ftruncate ($fp,0);
fputs ($fp,$t);
fflush($fp);
flock ($fp,LOCK_UN);
fclose($fp);
///////////////////////////

$file=file(BASEDIR."local/book.dat"); $i = count($file);
if ($i>=$config_maxpostbook) {
$fp=fopen(BASEDIR."local/book.dat","w");
flock ($fp,LOCK_EX);
unset($file[0],$file[1]);
fputs($fp, implode("",$file));
flock ($fp,LOCK_UN);
fclose($fp);}

if ($provlog==$_SESSION['log'] && $provpar==md5($_SESSION['par']) && $_SESSION['log']!="" && md5($_SESSION['par'])!=""){
	
//---Запись в профиль---//
$ufile = file_get_contents(BASEDIR."local/profil/$log.prof"); 
$udata = explode(":||:",$ufile);

$udata[14]=$ip;
$udata[9]++;
$udata[36]++;
$udata[41]++;

for ($u=0; $u<$config_userprofkey; $u++){
$utext.=$udata[$u].':||:';}

if($udata[0]!="" && $udata[1]!="" && $udata[4]!="" && $utext!=""){
$fp=fopen(BASEDIR."local/profil/$log.prof","a+");
flock($fp,LOCK_EX);   
ftruncate($fp,0);                                                                 
fputs($fp,$utext);
fflush($fp);
flock($fp,LOCK_UN);
fclose($fp);  
unset($utext);}}

header ("Location: index.php?isset=addon&".SID);
?>