View file book/add.php

File size: 5.1Kb
<?php
session_name("SID");
session_start();
include_once "../theme/index.php";
include_once"../conf.php";
include_once "../config.php";
include_once "../template/login2.php";

if (isset($_POST['mess'])) $mess = $_POST['mess'];

      $date = date("d F/H:i");
$date= str_replace("January","Января",$date);
$date = str_replace("February","Февраля",$date);
$date = str_replace("March","Марта",$date);
$date = str_replace("April","Апреля",$date);
$date= str_replace("May","Мая",$date);
$date = str_replace("June","Июня",$date);
$date = str_replace("July","Июля",$date);
$date = str_replace("August","Августа",$date);
$date = str_replace("September","Сентября",$date);
$date = str_replace("October","Октября",$date);
$date = str_replace("November","Ноября",$date);
$date = str_replace("December","Декабря",$date); 

$mess = str_replace('0:-)','<img src="../img/smiles/angel.png" height="20">',$mess);
$mess = str_replace('0:)','<img src="../img/smiles/angel.png" height="20">',$mess);
$mess = str_replace(':)','<img src="../img/smiles/smile.png" height="20">',$mess);
$mess = str_replace(':-)','<img src="../img/smiles/smile.png" height="20">',$mess);
$mess = str_replace('=)','<img src="../img/smiles/smile.png" height="20">',$mess);
$mess = str_replace(':(','<img src="../img/smiles/sad.png" height="20">',$mess);
$mess = str_replace(':-(','<img src="../img/smiles/sad.png" height="20">',$mess);
$mess = str_replace(';)','<img src="../img/smiles/wink.png" height="20">',$mess);
$mess = str_replace(';-)','<img src="../img/smiles/wink.png" height="20">',$mess);
$mess = str_replace(':-P','<img src="../img/smiles/tongue.png" height="20">',$mess);
$mess = str_replace(':P','<img src="../img/smiles/tongue.png" height="20">',$mess);
$mess = str_replace('8-)','<img src="../img/smiles/glasses.png" height="20">',$mess);
$mess = str_replace(':-D','<img src="../img/smiles/smile-big.png" height="20">',$mess);
$mess = str_replace(':D','<img src="../img/smiles/smile-big.png" height="20">',$mess);
$mess = str_replace('*KISSING*','<img src="../img/smiles/2kiss.png" height="20">',$mess);
$mess = str_replace(':-[','<img src="../img/smiles/blushing.png" height="20">',$mess);
$mess = str_replace('@=','<img src="../img/smiles/bomb.png" height="20">',$mess);
$mess = str_replace(":'(",'<img src="../img/smiles/crying.png" height="20">',$mess);
$mess = str_replace(":-'(",'<img src="../img/smiles/crying.png" height="20">',$mess);
$mess = str_replace('*devil*','<img src="../img/smiles/devil.png" height="20">',$mess);
$mess = str_replace('*DRINK*','<img src="../img/smiles/drink.png" height="20">',$mess);
$mess = str_replace('*rose*','<img src="../img/smiles/flower.png" height="20">',$mess);
$mess = str_replace(':-!','<img src="../img/smiles/gross.png" height="20">',$mess);
$mess = str_replace('*IN LOVE*','<img src="../img/smiles/in_love.png" height="20">',$mess);
$mess = str_replace('*JOKINGLY*','<img src="../img/smiles/joke.png" height="20">',$mess);
$mess = str_replace('*KISSED*','<img src="../img/smiles/kissed.png" height="20">',$mess);
$mess = str_replace(':*','<img src="../img/smiles/kissing.png" height="20">',$mess);
$mess = str_replace(':-*','<img src="../img/smiles/kissing.png" height="20">',$mess);
$mess = str_replace(':-/','<img src="../img/smiles/mad.png" height="20">',$mess);
$mess = str_replace('[:-}','<img src="../img/smiles/music.png" height="20">',$mess);
$mess = str_replace(':-|','<img src="../img/smiles/no_say.png" height="20">',$mess);
$mess = str_replace('*zloy*','<img src="../img/smiles/scream.png" height="20">',$mess);
$mess = str_replace(':-X','<img src="../img/smiles/shut-mouth.png" height="20">',$mess);
$mess = str_replace('*STOP*','<img src="../img/smiles/stop.png" height="20">',$mess);
$mess = str_replace('=-O','<img src="../img/smiles/surprised.png" height="20">',$mess);
$mess = str_replace('*THUMPS UP*','<img src="../img/smiles/thumb.png" height="20">',$mess);
$mess = str_replace('*TIRED*','<img src="../img/smiles/tired.png" height="20">',$mess);
$mess = str_replace("cookie","",$mess);
$mess = str_replace("mage()","",$mess);
$mess = str_replace("<script>","",$mess);
$mess = str_replace("<!","",$mess);
$mess = str_replace("<script>","",$mess);
$mess = str_replace("alert","",$mess);

$nick = htmlspecialchars(stripslashes($nick));
$uin = htmlspecialchars(stripslashes($uin));
$date = htmlspecialchars(stripslashes($date));
$text = htmlspecialchars(stripslashes($text));

$mess = str_replace("|","",$mess);
$mess = str_replace("||","",$mess);
$nick = str_replace("|","",$nick);
$nick = str_replace("||","",$nick);
$uin = str_replace("|","",$uin);
$uin = str_replace("||","",$uin);

$text=$uin.':||:'.$nick.':||:'.$mess.':||:'.$date.':||:';
$text=str_replace("\r\n", "", $text);

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

echo'<b>Сообщение добавлено!</b>';

header ("Location: index.php?".SID);

include_once "../theme/foot.php";

?>