error_reporting (E_ALL); include "config.php"; $shapka="
"; // Block questions $rand_zag=array( "Сидит дед, во сто шуб одет. Кто его раздевает, тот слёзы проливает.", "Летит - кричит, сядет - молчит, кто его убьет - свою кровь прольет"); // Block answers $rand_qwe=array( "лук", "комар"); // For number defence (4) $maxkey=4; // Symbol in code - may be changed $absrand="2334435";// Random number if (isset($_GET['image'])) { $st="R0lGODlhCgAMAIABAFNTU////yH5BAEAAAEALAAAAAAKAAwAAAI"; function imgwr($st,$num){ if ($num=="0") {$len="63"; $number=$st."WjIFgi6e+QpMP0jin1bfv2nFaBlJaAQA7";} if ($num=="1") {$len="61"; $number=$st."UjA1wG8noXlJsUnlrXhE/+DXb0RUAOw==";} if ($num=="2") {$len="64"; $number=$st."XjIFgi6e+QpMPRlbjvFtnfFnchyVJUAAAOw==";} if ($num=="3") {$len="64"; $number=$st."XjIFgi6e+Qovs0RkTzXbj+3yTJnUlVgAAOw==";} if ($num=="4") {$len="64"; $number=$st."XjA9wG8mWFIty0amczbVJDVHg9oSlZxQAOw==";} if ($num=="5") {$len="63"; $number=$st."WTIAJdsuPHovSKGoprhs67mzaJypMAQA7";} if ($num=="6") {$len="63"; $number=$st."WjIFoB6vxmFw0pfpihI3jOW1at3FRAQA7";} if ($num=="7") {$len="61"; $number=$st."UDI4Xy6vtAIzTyPpg1ndu9oEdNxUAOw==";} if ($num=="8") {$len="63"; $number=$st."WjIFgi6e+QpMP2slSpJbn7mFeWDlYAQA7";} if ($num=="9") {$len="64"; $number=$st."XjIFgi6e+QpMP0jinvbT2FGGPxmlkohUAOw==";} header("Content-type: image/gif"); header("Content-length: $len"); echo base64_decode($number); } if (array_key_exists("image", $_REQUEST)) { $num=$_REQUEST["image"]; for ($i=0; $i<10; $i++) {if (md5($i+$absrand)==$num) {imgwr($st,$i); die();}} } exit;} $rnd_do=array("плюс","минус","умножить"); if (isset($_GET['event'])) { if ($_GET['event']=="add") { if (isset ($_POST['name']) & isset ($_POST['msg']) & isset ($_POST['email'])) {$name=$_POST['name']; $msg=$_POST['msg']; $email=$_POST['email'];} else {exit;} sleep(1); if ($antispam=="2") { $bada="$shapka $back The image verification code you entered is incorrect!"; if (isset($_POST['usernum'])) {$usernum=$_POST['usernum'];} else {print"$bada"; exit;} if (isset($_POST['chek'])) {$chek=$_POST['chek'];} else {print"$bada"; exit;} $dt=explode("|",$chek); if ($dt[1]==0) {$number=$dt[0]+$dt[2];} if ($dt[1]==1) {$number=$dt[0]-$dt[2];} if ($dt[1]==2) {$number=$dt[0]*$dt[2];} if ($usernum!=$number) {print"$bada"; exit;}} if ($antispam=="3") { $qwe=$_POST['qwe']; $answer=$_POST['answer']; if (strtolower($rand_qwe[$qwe])!=strtolower($answer)) {print"$shapka $back Bad answer! Try again."; exit;}} if ($antispam=="4") { $bada="$shapka $back The image verification code you entered is incorrect!!"; if (isset($_POST['usernum'])) {$usernum=$_POST['usernum'];} else {print"$bada"; exit;} if (isset($_POST['xkey'])) {$xkey=$_POST['xkey'];} else {print"$bada"; exit;} $userkey=md5("$usernum+$absrand"); if ($userkey!=$xkey) {print"$bada"; exit;}} if ($name == "" || strlen($name) > $maxname) {print "$shapka $back The name field is empty or too long!"; exit;} if ($msg == "" || strlen($msg) > $maxmsg) {print "$shapka $back The message field is empty or too long! Max $maxmsg characters."; exit;} $msg=str_replace("|","I",$msg); $name=wordwrap($name,24,' ',1); $msg=wordwrap($msg,75,' ',1); $today=mktime(); // производим запись данных в файл по шаблону: собщение|имя|емайл|дата|время|МКТАЙМ| $text="$msg|$name|$email|$date|$time|$today|"; $text=str_replace(" ",' ',$text); $text=str_replace("&",'&',$text); $text=str_replace(">",'>',$text); $text=str_replace("<",'<',$text); $text=str_replace("\"",'"',$text); $text=preg_replace("/\n\n/",'',$text);
$text=preg_replace("/\n/",'
',$text);
$text=preg_replace("/\\\$/",'$',$text);
$text=preg_replace("/\r/",'',$text);
$text=stripslashes($text);
$text=preg_replace("/\\\/",'\',$text);
$text=str_replace("\r\n","
",$text);
$text=str_replace("\n\n",'
',$text);
$text=str_replace("\n",'
',$text);
// Вырезаем 3 и более ентеров
do {$text=str_replace("
","
",$text);} while (preg_match("/
/i",$text));
// Вырезаем 3 и более пробелов подряд
do {$text=str_replace(" "," ",$text);} while (preg_match("/ /i",$text));
$text=str_replace("\t",' ',$text);
$text=str_replace("\r",' ',$text);
$text=str_replace(' ',' ',$text);
if ($antiflud=="1") { // функция АНТИФЛУД здесь!
$linesn = file("guest.dat"); $in=count($linesn);
if ($in > 0) {
$lines=file("guest.dat"); $i=count($lines)-1; $itogo=$i; $dtf=explode("|",$lines[$i]);
$txtback="$dtf[0]|$dtf[1]|$dtf[2]|$dtf[3]|"; $lastmsg=$dtf[5];
$dtb=explode("|",$text);
$txtflud="$dtb[0]|$dtb[1]|$dtb[2]|$dtb[3]|";
$today=mktime();
if (($lastmsg+30)>$today) {
$eshe=($lastmsg+30)-$today; print"$back You are too fast! Wait $eshe seconds!"; exit;}
if ($txtflud==$txtback) {print"$back This message already exist!"; exit;} }
}
$fp=fopen("guest.dat","a+");
flock ($fp,LOCK_EX);
fputs($fp,"$text\r\n");
flock ($fp,LOCK_UN);
fclose($fp);
@chmod("guest.dat", 0644);
if ($sendmail=="1") {
$headers=null;
$headers.="Content-Type: text/plain; charset=charset=utf-8\r\n";
$headers.="From: ".$name." <".$email.">\r\n";
$headers.="X-Mailer: PHP/".phpversion()."\r\n";
$host=$_SERVER["HTTP_HOST"]; $self=$_SERVER["PHP_SELF"];
$allmsg = $gname.chr(13).chr(10).'New message in DM guestbook: http://'.$host.$self.chr(13).chr(10).'Name: '.$name.chr(13).chr(10).'E-mail: '.$email.chr(13).chr(10).'Message: '.$msg.chr(13).chr(10);
mail("$adminemail", "$gname (message)", $allmsg, $headers);
}
print "$shapka
|
";
include ('/home/admin/web/dancemelody.com/public_html/left-noadbox.php');
print " |
$gname
"; } } // считываем данные в память $lines=file("guest.dat"); $maxi=count($lines)-1; $maxpage=ceil(($maxi+1)/$qq); if ($page>$maxpage) {$page=$maxpage;} if ($maxi>"-1") { // Выводим qq сообщений на текущей странице $maxpage=ceil(($maxi+1)/$qq); if ($page>$maxpage) {$page=$maxpage;} if ($msginout=="1") { $fm=$qq*($page-1); if ($fm>$maxi) {$fm=$maxi-$qq;} $lm=$fm+$qq; if ($lm>$maxi) {$lm=$maxi+1;} } else { $fm=$maxi-$qq*($page-1); if ($fm<"0") {$fm=$qq;} $lm=$fm-$qq; if ($lm<"0") {$lm="-1";} } do { $dt = explode("|", $lines[$fm]); if ($msginout=="1") {$fm++; $num=$maxi-$fm+2;} else {$fm--; $num=$fm+2;} if (strlen($dt[0])>5) { if ($smile!="0") { $dt[0]=str_replace(":-))",$s1,$dt[0]); $dt[0]=str_replace(":-)",$s2,$dt[0]); $dt[0]=str_replace(":-P",$s3,$dt[0]); $dt[0]=str_replace("8-)",$s4,$dt[0]); $dt[0]=str_replace(":-(",$s5,$dt[0]); $dt[0]=str_replace(":-O",$s6,$dt[0]); $dt[0]=str_replace(";-)",$s7,$dt[0]); $dt[0]=str_replace(":roll:",$s8,$dt[0]); $dt[0]=str_replace(":rf:",$s9,$dt[0]); $dt[0]=str_replace("8-(",$s10,$dt[0]); $dt[0]=str_replace("`-(",$s11,$dt[0]);} $dt[0]=str_replace("[RB]","", $dt[0]); $dt[0]=str_replace("[/RB]","", $dt[0]); $dt[0]=str_replace("|","|",$dt[0]); if ($liteurl=="0") {$dt[0]=eregi_replace("((https?|ftp)://[[:alnum:]_=/-]+(\\.[[:alnum:]_=/-]+)*(/[[:alnum:]+&._=/~%]*(\\?[[:alnum:]?+&;_=/%]*)?)?)", "\\1", $dt[0]);} print"
"; } else {print" The guestbook is emprty. Add message. ";} // if $maxi > "-1" print " | ";
include ('/home/admin/web/dancemelody.com/public_html/right-noadbox.php');
print " |