Просмотр файла guestbook/index.php

Размер файла: 11.02Kb
<?php
/////////////////////////////////////////////////////////////////////////////////
///                                                                           ///
///               Автор скрипта:     Гринько Роман                            ///
///                         ICQ:     405-623-516                              ///
///                      E-MAIL:     [email protected]                        ///
///                                                                           ///
///               ВНИМАНИЕ!!!ВНИМАНИЕ!!!ВНИМАНИЕ!!!                           ///
///                                                                           ///
///            Вы НЕ МОЖЕТЕ вносить изменение в код скрипта для его           ///
///            дальнейшего распространения!!! Вы НЕ ИМЕЕТЕ право              ///
///            снимать копирайт разработчика данного скрипта!!!               ///
///            Вы НЕ ИМЕЕТЕ право продавать данный скрипт!!!                  ///
///            Пожалуйста, СОБЛЮДАЙТЕ УСЛОВИЯ!!!                              ///
///            СПАСИБО ЗА ВНИМАНИЕ!                                           ///
///                                                                           ///
///                                                                           ///
///                                                                           ///
/////////////////////////////////////////////////////////////////////////////////


$name = 'Гостевая книга';
session_name("SID");
session_start();



include 'incfiles/config.php';
include 'incfiles/functions.php';
include 'header.php';

Error_Reporting(E_ALL &~E_NOTICE);
Error_Reporting(ERROR | WARNING);
include "conf.php";


function antimat($sms)
{
$anti=array("ХУЙ","ПИЗДА","ХРЕН","ПИЗДА","ЕБАТЬ","ЕБУТСЯ","ЛОХ","ПИЗДАБОЛ","хуй","пизда","хрен","пизда","ебать","ебутся","лох","пиздабол","Хуй","Пизда","Хрен","Пизда","Ебать","Ебутся","Лох","Пиздабол");

$sms = str_replace('anti[0]','[censure]',$sms);
$sms = str_replace('anti[1]','[censure]',$sms);
$smst = str_replace('anti[2]','[censure]',$sms);
$sms = str_replace('anti[3]','[censure]',$sms);
$sms = str_replace('anti[4]','[censure]',$sms);
$sms = str_replace('anti[5]','[censure]',$sms);
$sms = str_replace('anti[6]','[censure]',$sms);
$sms = str_replace('anti[7]','[censure]',$sms);
$sms = str_replace('anti[8]','[censure]',$sms);
$sms = str_replace('anti[9]','[censure]',$sms);
$sms = str_replace('anti[10]','[censure]',$sms);
$sms = str_replace('anti[11]','[censure]',$sms);
$sms = str_replace('anti[12]','[censure]',$sms);
$sms = str_replace('anti[13]','[censure]',$sms);
$sms = str_replace('anti[14]','[censure]',$sms);
$sms = str_replace('anti[15]','[censure]',$sms);
$sms = str_replace('anti[16]','[censure]',$sms);
$sms = str_replace('anti[17]','[censure]',$sms);
$sms = str_replace('anti[18]','[censure]',$sms);
$sms = str_replace('anti[19]','[censure]',$sms);
$sms = str_replace('anti[20]','[censure]',$sms);
$sms = str_replace('anti[21]','[censure]',$sms);
$sms = str_replace('anti[22]','[censure]',$sms);
$sms = str_replace('anti[23]','[censure]',$sms);
return $sms;
}

echo"<div class='a'><a href='index.php'>English</a>/<a href='index.php?site=ru'>Russian</a></div>
<div class='a'>" . $lang['31'] . "</div>
<p align='left'>";
if(isset($_GET['page']))
  {if(!preg_match("/[0-9]/i",$_GET['page'])) { echo "" . $lang['1'] . ""; exit;}}

########################################################################################################################################################
   function smiles($smiles)
{
$smiles=str_replace('*1*','<img src="smiles/smile.gif" alt=":-)" />',$smiles);
$smiles=str_replace('*2*','<img src="smiles/smile.gif" alt=":)" />',$smiles);
$smiles=str_replace('*3*','<img src="smiles/sad.gif" alt=":-)" />',$smiles);
$smiles=str_replace('*4*','<img src="smiles/sad.gif" alt=":(" />',$smiles);
$smiles=str_replace('*5*','<img src="smiles/biggrin.gif" alt=":-D" />',$smiles);
$smiles=str_replace('*6*','<img src="smiles/biggrin.gif" alt=":D" />',$smiles);
$smiles=str_replace('*7*','<img src="smiles/sleza.gif" alt=.sleza." />',$smiles);
$smiles=str_replace('*8*','<img src="smiles/bebe.gif" alt=".clock." />',$smiles);
$smiles=str_replace('*9*','<img src="smiles/chmok.gif" alt=".chmok." />',$smiles);
$smiles=str_replace('*10*','<img src="smiles/warning.gif" alt=".warning." />',$smiles);
 return $smiles;
}

########################################################################################################################################################

switch($_GET['act']){

#############################################################################################
 case add:

$_SESSION['kod']=rand(1000,9999);

echo"<form action=\"index.php?act=added&site=" . $lang['0'] . "\" method=\"POST\">
" . $lang['2'] . "<br />
<input name=\"name\" /><br />
" . $lang['3'] . "<br />
<textarea name=\"text\" rows=\"5\" cols=\"25\"></textarea><br />
" . $lang['4'] . " [<font color='#f00000'>$_SESSION[kod]</font>]<br />
<input name=\"kod\" maxlength=\"4\" /><br />
<input type=\"submit\" name=\"\" value=\"" . $lang['5'] . "\" />
</form>
-<a href=\"index.php?act=sm\">" . $lang['6'] . "</a><br />
-<a href=\"index.php\">" . $lang['7'] . "</a><br />";


break;
#############################################################################################
  case added:
echo "$verx";

if(!isset($_SESSION['spam_i']) && !isset($_SESSION['spam_h']) && !isset($_SESSION['spam_s']) && !isset($_SESSION['spam'])) {
$_SESSION['spam_i']=date("i");
$_SESSION['spam_h']=date("H");
$_SESSION['spam_s']=date('s');


$_SESSION['spam_h']=ceil($_SESSION['spam_h']/3600);
$_SESSION['spam_i']=ceil($_SESSION['spam_i']/60);
$_SESSION['spam']=ceil($_SESSION['spam_h']+$_SESSION['spam_i']+$_SESSION['spam_s']);
}
#------------------------------------------------------
$new_date_h=ceil(date("H")/3600);
$new_date_i=ceil(date("i")/60);
$new_date_s=ceil(date("s"));
$new_date=ceil($new_date_h+$new_date_i+$new_date_s);

$spam_date=(ceil($new_date-$_SESSION['spam']))+20;
#------------------------------------------------------
/////

$name=$_POST['name'];
$text=$_POST['text'];
$new_date=date("H:i d");
$month=date("M");
switch ($month) {
case "Jan": $month = "" . $lang['33'] . ""; break;
case "Feb": $month = "" . $lang['34'] . ""; break;
case "Mar": $month = "" . $lang['35'] . ""; break;
case "Apr": $month = "" . $lang['36'] . ""; break;
case "May": $month = "" . $lang['37'] . ""; break;
case "Jun": $month = "" . $lang['38'] . ""; break;
case "Jul": $month = "" . $lang['39'] . ""; break;
case "Aug": $month = "" . $lang['40'] . ""; break;
case "Sep": $month = "" . $lang['41'] . ""; break;
case "Oct": $month = "" . $lang['42'] . ""; break;
case "Nov": $month = "" . $lang['43'] . ""; break;
case "Dec": $month = "" . $lang['44'] . ""; break;
}
$new_date="$new_date $month";
$user_agent = getenv("HTTP_USER_AGENT");



  if($_SESSION['kod'] == $_POST['kod']) {
  if(empty($name) or empty($text) or !preg_match("/[a-zа-я]/i",$name) or !preg_match("/[a-zа-я]/i",$text))
  {
  echo "<font color=\"#f00000\">";

    if(empty($name) or !preg_match("/[a-zа-я]/i",$name))
    {
      if(empty($name)) echo "" . $lang['10'] . "<br />";

        else {       echo "" . $lang['11'] . "<br />";}

    }


    if(empty($text) or !preg_match("/[a-zа-я]/i",$text) )
      if(empty($text)) echo "" . $lang['12'] . "<br />";
      else {
           echo "" . $lang['13'] . "<br />";
           }
  echo "</font><br /><a href='index.php?act=add'>" . $lang['14'] . "</a><br />";

  }

  else
  {
$text=stripslashes(htmlspecialchars($text, ENT_QUOTES));
$new_date=stripslashes(htmlspecialchars($new_date, ENT_QUOTES));
$name=stripslashes(htmlspecialchars($name, ENT_QUOTES));

  $sms="$name:|:$new_date:|:$text
";
$sms=antimat($sms);

  $fp=@fopen($file,"a+");
  @fwrite($fp,$sms);
  fclose($fp);



if(@fwrite) echo "" . $lang['15'] . " <a href=\"index.php\">" . $lang['16'] . "</a>.<br />";
else { echo "" . $lang['32'] . ""; }
}}
else {
echo "<font color=\"#f00000\">" . $lang['17'] . "</font><br /><a href='index.php?act=add'>" . $lang['18'] . "</a><br />"; }

break;

#############################################################################################
case sm:
echo "
.1. = <img src=\"smiles/smile.gif\"/><br />
.2. = <img src=\"smiles/sad.gif\"/><br />
.3. = <img src=\"smiles/sad.gif\"/><br />
.4. = <img src=\"smiles/biggrin.gif\"/><br />
.5. = <img src=\"smiles/biggrin.gif\"/><br />
.6. = <img src=\"smiles/sleza.gif\"/><br />
.7. = <img src=\"smiles/bebe.gif\"/><br />
.8. = <img src=\"smiles/chmok.gif\"/><br />
.9. = <img src=\"smiles/warning.gif\"/><br /><br />
-<a href=\"index.php?act=add\">" . $lang['19'] . "</a><br />
-<a href=\"index.php\">" . $lang['20'] . "</a><br />";
break;
#############################################################################################
default:
//страница
if(isset($_GET[page]))  {$page=$_GET[page];}
else                    {$page=1;}

//переменные для цикла
$zak=$page*$msg_str;           #от какого сообщения
$nach=$zak-$msg_str;           #до какого сообщения
$page_kol=ceil($msg_vsego/$msg_str);
//цикл
echo "-<a href='index.php?act=add'>" . $lang['21'] . "</a><br>";
for($i = $nach;$i < $zak & $i < $msg_vsego;$i++)
{


list($name,$date,$text)=explode(":|:",$msg[$i]);
$text = antimat($text);   // Антимат (я включил сам)
$text = smiles($text);

echo'<table class=post>';
       echo'<tr><td class=p_t>'.$name.' - '.$date.'</td></tr>';
       echo '<tr><td class=p_m>';
  
       echo '<font size="2px">'.$text.'</font>';
  
       echo '</td></tr></table>';






}
echo"<br />";
if($page>1) echo "-<a href=\"index.php?page=".($page-1)."\">" . $lang['22'] . "</a><br />";
if($page<$page_kol) echo "-<a href=\"index.php?page=".($page+1)."\">" . $lang['23'] . "</a><br />";
$hrb=ceil($page_kol-$page);
if($hrb>1) echo "-<a href=\"index.php?page=".$page_kol."\">" . $lang['24'] . "</a><br />";
if($page>2) echo "-<a href=\"index.php\">" . $lang['25'] . "</a><br />";

if($pok_stat=1) {
echo"<br />";
if($pok_stat_vezde=1){ echo "" . $lang['26'] . "$msg_vsego " . $lang['30'] . "$page_kol";}
if($pok_stat_vezde=0)
{
if($page=1)echo "" . $lang['27'] . "$msg_vsego " . $lang['30'] . "$page_kol";
}
}
echo "<br /><br />";
if($page_kol>3)
echo "" . $lang['28'] . " <form action=\"index.php\" method=\"GET\">
<input name=\"page\" value=\"$page\" size=\"3\" maxlength=\"4\" />
<input type=\"submit\" name=\"\" value=\"" . $lang['29'] . "\" />
</form>";
}
include 'incfiles/footer.php';
?>