http://www.geton.atropos.ru
Гостевая книга
\n"; $post_date=date("D d.m.Y"); $post_time=date("H:i"); $guestbook="gb.txt"; $fh=fopen($guestbook, "a"); fclose($fh); ?>
Имя *:     E-mail:
Сообщение*:

Некорректные сообщения будут удалены
Поля, помеченные *, обязательны для заполнения.

0): if ($HTTP_POST_VARS["add_name"]!=""){ if ($HTTP_POST_VARS["add_comment"]!=""){ $add_name=$HTTP_POST_VARS["add_name"]; $add_email=$HTTP_POST_VARS["add_email"]; $add_comment=$HTTP_POST_VARS["add_comment"]; $REMOTE_ADDR=$HTTP_SERVER_VARS["REMOTE_ADDR"]; add_comment($add_name, $add_email, $add_comment, $REMOTE_ADDR); // print "Ваше сообщение успешно добавлено. Нажмите для продолжения

\n"; } else{ print "Вы не ввели комментарий. Нажмите для продолжения"; } } endif; if (filesize($guestbook)==0): if ($HTTP_POST_VARS["add_name"]!=""){ if ($HTTP_POST_VARS["add_comment"]!=""){ $add_name=$HTTP_POST_VARS["add_name"]; $add_email=$HTTP_POST_VARS["add_email"]; $add_comment=$HTTP_POST_VARS["add_comment"]; $REMOTE_ADDR=$HTTP_SERVER_VARS["REMOTE_ADDR"]; // print "Ваше сообщение успешно добавлено. Нажмите для продолжения

\n"; add_comment1($add_name, $add_email, $add_comment, $REMOTE_ADDR); } else{ print "Вы не ввели комментарий. Нажмите для продолжения"; } } endif; print "
\n"; //print "
\n"; //for ($i=1; $i<=22; $i+=1): //print "\n"; //endfor; //print "
\n"; print "
\n"; function add_comment($add_name, $add_email, $add_comment, $REMOTE_ADDR){ GLOBAL $post_date, $post_time, $guestbook; $stripped_comment=strip_tags($add_comment); $stripped_comment=str_replace("|"," ",$stripped_comment); $stripped_comment=str_replace("\r\n"," ",$stripped_comment); $stripped_comment=str_replace('\"',"",$stripped_comment); $stripped_comment=str_replace("\'","",$stripped_comment); $stripped_comment=str_replace("\`","",$stripped_comment); $stripped_name=strip_tags($add_name); $stripped_name=str_replace("|"," ",$stripped_name); $stripped_name=str_replace('\"',""",$stripped_name); $stripped_name=str_replace("\'","’",$stripped_name); $stripped_name=str_replace("\`","‘",$stripped_name); $stripped_email=strip_tags($add_email); $stripped_email=str_replace("|"," ",$stripped_email); $stripped_email=str_replace('\"',"",$stripped_email); $stripped_email=str_replace("\'","",$stripped_email); $stripped_email=str_replace("\`","",$stripped_email); $contents="\n$post_date|$post_time|$stripped_name|$stripped_email|$stripped_comment|$REMOTE_ADDR"; $contents1="$post_date|$post_time|$stripped_name|$stripped_email|$stripped_comment|$REMOTE_ADDR"; $fh=fopen($guestbook,"a"); $check=0; $comments_array=file($guestbook); while (list($line_num, $line)=each($comments_array)): if ($contents1!=$line): $check=1; else: $check=0; endif; endwhile; if ($check==1): $wr=fwrite($fh,$contents); endif; fclose($fh); } function add_comment1($add_name, $add_email, $add_comment, $REMOTE_ADDR){ GLOBAL $post_date, $post_time, $guestbook; $stripped_comment=strip_tags($add_comment); $stripped_comment=str_replace("|"," ",$stripped_comment); $stripped_comment=str_replace("\r\n"," ",$stripped_comment); $stripped_comment=str_replace('\"',"",$stripped_comment); $stripped_comment=str_replace("\'","",$stripped_comment); $stripped_comment=str_replace("\`","",$stripped_comment); $stripped_name=strip_tags($add_name); $stripped_name=str_replace("|"," ",$stripped_name); $stripped_name=str_replace('\"',""",$stripped_name); $stripped_name=str_replace("\'","’",$stripped_name); $stripped_name=str_replace("\`","‘",$stripped_name); $stripped_email=strip_tags($add_email); $stripped_email=str_replace("|"," ",$stripped_email); $stripped_email=str_replace('\"',"",$stripped_email); $stripped_email=str_replace("\'","",$stripped_email); $stripped_email=str_replace("\`","",$stripped_email); $contents="$post_date|$post_time|$stripped_name|$stripped_email|$stripped_comment|$REMOTE_ADDR"; $fh=fopen($guestbook,"a"); $wr=fwrite($fh,$contents); fclose($fh); $events=fopen($guestbook, "r"); while (! feof($events)): $event=fgets($events, 4096); list($date, $time, $name, $mail, $message)=explode("|",$event); print "
"; print " $date ($time)"; print " $name
"; print "
\n"; print "
"; print " $message

"; print "
\n"; print "
 
\n"; endwhile; } $comments_array=file($guestbook); while (list($line_num, $line)=each($comments_array)): $comments[$line_num]=$line; $num=$line_num+1; endwhile; if (filesize($guestbook)>0): $a=$num; $pages=$a/$p; $pages1=$a%$p; SetType($pages,"integer"); if ($pages1!=0): $pages+=1; endif; print "
"; for ($i=1; $i<=$pages; $i+=1): GLOBAL $p, $a; print "[$i] "; $a-=$p; endfor; print "
"; print "
 
\n"; if ($page>1): if ($page<=$pages): $page1=$s; $k=$page1-$p; endif; if (($page*$p)>$num): $k=0; $page1=$num-(($page-1)*$p); endif; endif; if ($page==1): $page1=$num; $k=$page1-$p; endif; if ($page==0): $page1=$num; $k=$page1-$p; endif; if ($k<0): $k=0; endif; for ($i=$page1; $i>$k; $i-=1): list($date, $time, $name, $mail, $message, $ip, $answer)=explode("|",$comments[$i-1]); print "
"; print " $date ($time)"; print " $name
"; print "
\n"; for ($z=1; $z<=22; $z+=1): $message=str_replace("[::$z::]","",$message); $answer=str_replace("[::$z::]","",$answer); endfor; print "
"; $message=str_replace("","
",$message); $message=str_replace("",""",$message); $message=str_replace("","'",$message); $message=str_replace("","`",$message); if ($answer==""): print " $message

"; endif; if ($answer!=""): $answer=str_replace("","
",$answer); $answer=str_replace("",""",$answer); $answer=str_replace("","'",$answer); $answer=str_replace("","`",$answer); print " $message
"; print " Ответ: $answer"; endif; print "
\n"; print "
 
\n"; endfor; endif; //echo "
Last modified: ".date("D F d. Y, H:i",getlastmod()); //print "
\n"; //print "" ?>