$value ) {$$key=$value;}} $PARAMS = (isset($HTTP_POST_VARS)) ? $HTTP_POST_VARS : $HTTP_GET_VARS; foreach( $PARAMS as $key => $value ) {$$key=$value;} include("config.inc.php"); function p ($string){ $string = str_replace('\"','"',$string); $string = str_replace("\'",""",$string); $string = str_replace("\&","&",$string); return $string; } function vm($mail) { if (eregi("^[a-z0-9]+([-_\.]?[a-z0-9])+@[a-z0-9]+([-_\.]?[a-z0-9])+\.[a-z]{2,4}", $mail)) { return true;} else { return false;} } function replace ($string){ $string = ereg_replace("<","<",$string); $string = ereg_replace(">",">",$string); $string = ereg_replace('\\\"',""",$string); $string = ereg_replace('\\"',""",$string); $string = ereg_replace("::","::",$string); $string = ereg_replace("!","!",$string); $string = ereg_replace("\r\n","
",$string); $string = ereg_replace("\n","
",$string); $string = ereg_replace("%","%",$string); $string = ereg_replace("^ +","",$string); $string = ereg_replace(" +$","",$string); $string = ereg_replace(" +"," ",$string); return $string; } if(empty($user_ip)){if (getenv('HTTP_X_FORWARDED_FOR')) {$user_ip=getenv('HTTP_X_FORWARDED_FOR'); } else{$user_ip=getenv('REMOTE_ADDR'); }} else{$user_ip=getenv('REMOTE_ADDR'); } if(15 < strlen($user_ip)){list($user_ip,$user_ip1,$user_ip2,$user_ip3)=explode(", ", $user_ip);} $ip = $user_ip; if ($action == "gost") { include("config.inc.php"); $adres = "action=gost"; $t_mha = @file("$dtemplates/index_top.htm"); for($mha = 0 ; $mha < count($t_mha); $mha++){ $t_mha[$mha] = str_replace("%title%","Гостевая книга.",$t_mha[$mha]); echo "$t_mha[$mha]";} echo"
Гостевая книга компании 'РН-Охрана'

"; function error() { include ("config.inc.php"); $t_error = @file("$dtemplates/gost_error.htm"); $tmp = @file("$dlogs/gosterrors.tmp"); for ($tm = 0; $tm < count($tmp); $tm++) { list($er1,$er2,$er3,$er4,$er5,$er6,$er7,$er8,$er9)=explode("::", $tmp[$tm]); } for($e = 0 ; $e < count($t_error); $e++) { if ($er1 == "yes") { $t_error[$e] = str_replace("%error1%","$e1",$t_error[$e]); } if ($er1 == "") { $t_error[$e] = str_replace("%error1%",$e1,$t_error[$e]);} if ($er2 == "yes") { $t_error[$e] = str_replace("%error2%","$e2",$t_error[$e]); } if ($er2 == "") { $t_error[$e] = str_replace("%error2%",$e2,$t_error[$e]);} if ($er3 == "yes") { $t_error[$e] = str_replace("%error3%","$e3",$t_error[$e]); } if ($er3 == "") { $t_error[$e] = str_replace("%error3%",$e3,$t_error[$e]);} if ($er4 == "yes") { $t_error[$e] = str_replace("%error4%","$e4",$t_error[$e]); } if ($er4 == "") { $t_error[$e] = str_replace("%error4%",$e4,$t_error[$e]);} if ($er5 == "yes") { $t_error[$e] = str_replace("%error5%","$e5",$t_error[$e]); } if ($er5 == "") { $t_error[$e] = str_replace("%error5%",$e5,$t_error[$e]); } if ($er6 == "yes") { $t_error[$e] = str_replace("%error6%","$e6",$t_error[$e]); } if ($er6 == "") { $t_error[$e] = str_replace("%error6%",$e6,$t_error[$e]); } if ($er7 == "yes") { $t_error[$e] = str_replace("%error7%","$e7",$t_error[$e]); } if ($er7 == "") { $t_error[$e] = str_replace("%error7%",$e7,$t_error[$e]); } if ($er8 == "yes") { $t_error[$e] = str_replace("%error8%","$e8",$t_error[$e]); } if ($er8 == "") { $t_error[$e] = str_replace("%error8%",$e8,$t_error[$e]); } if ($er9 == "yes") { $t_error[$e] = str_replace("%error9%","$e9",$t_error[$e]); } if ($er9 == "") { $t_error[$e] = str_replace("%error9%",$e9,$t_error[$e]); } echo $t_error[$e];}} if ($add == "yes") { $t_form = @file("$dtemplates/gost_form.htm"); for($f = 0 ; $f < count($t_form); $f++){ $t_form[$f] = str_replace("%adres%",$adres,$t_form[$f]); $t_form[$f] = str_replace("%name%",$c_name,$t_form[$f]); $t_form[$f] = str_replace("%mail%",$c_mail,$t_form[$f]); $t_form[$f] = str_replace("%city%",$c_city,$t_form[$f]); $t_form[$f] = str_replace("%homepage%",$c_homepage,$t_form[$f]); $t_form[$f] = str_replace("%add_button%",$add_b,$t_form[$f]); echo $t_form[$f];}} if ($add == "$add_b"){ if($message != ""){ $f = $mlwim; $message = trim($message); for( $i=0; eregi("\r\n\r\n",$message); $i++) {$message = ereg_replace("\r\n\r\n","\r\n",$message);} for( $i=0; eregi("\n\n",$message); $i++) {$message = ereg_replace("\n\n","\n",$message);} for( $i=0; eregi(" ",$message); $i++){$message = ereg_replace(" "," ",$message);} for( $i=0; eregi(" ",$message); $i++){$message = ereg_replace(" "," ",$message);} $e = explode(" ",$message); for ($a = 0; $a < sizeof($e); $a++) { $o = strlen($e[$a]); $b = 0; $q = $o; while($q > 0) { $s[$b] = substr ($e[$a], $f*$b, $f); $q = $q - $f; $b++; } for ($c=0; $c < sizeof($s); $c++) { $h[] = $s[$c]; } $s=""; } for ($d = 0; $d < sizeof($h); $d++) { $r .= $h[$d]." "; } $message = $r; } $name = replace($name);$message = replace($message);$mail = replace($mail);$city = replace($city);$homepage = replace($homepage); $date = time(); include ("config.inc.php"); if (strlen($name) > $mname) { $error = "yes"; $er2 = "yes"; } if (strlen($mail) > $mmail) { $error = "yes"; $er3 = "yes"; } if (strlen($city) > $mcity) { $error = "yes"; $er4 = "yes"; } if (strlen($homepage) > $mhomepage) { $error = "yes"; $er5 = "yes"; } if (strlen($message) > $mmessage) { $error = "yes"; $er6 = "yes"; } if ($mail != "") { if (vm($mail)) { } else { $error = "yes"; $er7 = "yes"; } } $autof = @file("$autochange"); for ($au=0; $au < count($autof); $au++) { list($autochange3,$autochange2)=explode("::", $autof[$au]); if ($auchname == "yes") { $name = eregi_replace("$autochange3","$autochange2","$name"); } if ($auchcity == "yes") { $city = eregi_replace("$autochange3","$autochange2","$city"); } if ($auchmail == "yes") { $mail = eregi_replace("$autochange3","$autochange2","$mail"); } if ($auchhomepage == "yes"){ $homepage = eregi_replace("$autochange3","$autochange2","$homepage"); } if ($auchmessage == "yes") { $message = eregi_replace("$autochange3","$autochange2","$message"); } $name = eregi_replace("\n","","$name"); $city = eregi_replace("\n","","$city"); $mail = eregi_replace("\n","","$mail"); $homepage = eregi_replace("\n","","$homepage"); $message = eregi_replace("\n","","$message"); $name = eregi_replace("\r\n","","$name"); $city = eregi_replace("\r\n","","$city"); $mail = eregi_replace("\r\n","","$mail"); $homepage = eregi_replace("\r\n","","$homepage"); $message = eregi_replace("\r\n","","$message");} $general=@file($gostbase); $lines=count($general); $all_messages = $lines; $ban = @file("$banlist"); for ($fbo = 0; $fbo < count($ban); $fbo++){ $ban[$fbo] = ereg_replace("\n","",$ban[$fbo]); list($banip,$banmessage)= spliti ("\::",$ban[$fbo]); if (ereg("^$banip$",$ip)) { $error = "yes"; $er9 = "yes"; }} for ($i=0; $i < $lines; $i++){ list($t1,$messageold,$t2,$t3,$t4,$t5,$t6)=explode("::", $general[$i]); if ($messageold == "$message") { $error = "yes"; $er8 = "yes"; }} if ($name == "" or $message == "") { $er1 = "yes"; } if ($name == "" or $message == "" or $error == "yes"){ $tmp_gb = @fopen("$dlogs/gosterrors.tmp","w+"); $er1 = replace($er1); $er2 = replace($er2); $er3 = replace($er3); $er4 = replace($er4); $er5 = replace($er5); $er6 = replace($er6); $er7 = replace($er7); $er8 = replace($er8); $er9 = replace($er9); @fputs ($tmp_gb,"$er1::$er2::$er3::$er4::$er5::$er6::$er7::$er8::$er9::\n"); @fclose ($tmp_gb); error(); $t_form = @file("$dtemplates/gost_form.htm"); for($f = 0 ; $f < count($t_form); $f++){ $t_form[$f] = str_replace("%adres%",$adres,$t_form[$f]); $t_form[$f] = str_replace("%name%",$name,$t_form[$f]); $t_form[$f] = str_replace("%mail%",$mail,$t_form[$f]); $t_form[$f] = str_replace("%city%",$city,$t_form[$f]); $t_form[$f] = str_replace("%homepage%",$homepage,$t_form[$f]); $t_form[$f] = str_replace("%add_button%",$add_b,$t_form[$f]); echo $t_form[$f];} $t_mha = @file("$dtemplates/index_end.htm"); for($mha = 0 ; $mha < count($t_mha); $mha++){ $t_mha[$mha] = str_replace("%mtime%",$mtime,$t_mha[$mha]); $t_mha[$mha] = str_replace("%c_name%",$c_name,$t_mha[$mha]); $t_mha[$mha] = str_replace("%c_mail%",$c_mail,$t_mha[$mha]); $t_mha[$mha] = str_replace("%host%",$host_stat_day,$t_mha[$mha]); $t_mha[$mha] = str_replace("%hit%",$hit_stat_day,$t_mha[$mha]); $t_mha[$mha] = str_replace("%user%",$user_online,$t_mha[$mha]); echo "$t_mha[$mha]";} exit;} if ($name != "" and $message != ""){ if ($iwe == "yes"){ $body = $nmig; $b_mail = $mail; $b_city = $city; $b_homepage = $homepage; $body = str_replace("%name%",$name,$body); if ($b_mail != "") { $body = str_replace("%mail%","$b_mail",$body); } if ($b_mail == "") { $body = str_replace("%mail%","none",$body); } if ($b_city != "") { $body = str_replace("%city%",$b_city,$body); } if ($b_city == "") { $body = str_replace("%city%","none",$body); } if ($b_homepage != ""){ $body = str_replace("%homepage%","$b_homepage",$body);} if ($b_homepage == ""){ $body = str_replace("%homepage%","none",$body); } $body = str_replace ("%date%","".date("d.m.Y",$date)."","$body"); $body = str_replace ("%message%","$message","$body"); $body = str_replace ("%ip%","$ip","$body"); $from="\"Гостевая книга\" <$noos>"; $headers="Content-Type: text/html; charset=windows-1251\n"; $headers.="From: $from"; $newm = "Новое сообщение в гостевой книге"; @mail($moa,$newm,$body,$headers); } if ($homepage != ""){ $homepage = eregi_replace("http:\/\/","",$homepage); $homepage = eregi_replace("www.","",$homepage); } $fp = @fopen($gostbase,"a"); @fputs ($fp,"$name::$message::$mail::$city::$homepage::$date::$ip::\n"); @fclose ($fp); }} if ($action="gost" and $add != "yes"){ $general=@file($gostbase); $lines=count($general); if ($lines == "0"){ $t_center = @file("$dtemplates/gost_center.htm"); for($c = 0 ; $c < count($t_center); $c++){ $t_center[$c] = str_replace("%adres%",$adres,$t_center[$c]); $t_center[$c] = str_replace("%line%",$line,$t_center[$c]); $t_center[$c] = str_replace("%page%",$page,$t_center[$c]); echo $t_center[$c];} include("$dtemplates/gost_empty.htm");} $all_messages = $lines; $pmessages = @file($gostbase); if ($page == "") { $page = 1; } $first = count($pmessages) - ($onlyg * ($page - 1)); $second = count($pmessages) - ($onlyg * $page) + 1; if ($second < 1) { $second = 1; } $pages = (int) ((count($pmessages) + $onlyg) / $onlyg); if ($addpage_abs == 0) {$addpage_abs = $addpage; } if ($adpage == yes) {$addpage_abs = $addpage_abs + $addpage;} if ($adpage == no) {$addpage_abs = $addpage_abs - $addpage;} $addpageno_abs = $addpage_abs - $addpage; $line = "Страницы: "; if ($addpageno_abs >= $addpage){ $line .= " << ";} $line .= "|"; for ($onlyg = 1; $onlyg <= $pages; $onlyg++) { if ($addpage_abs >= $onlyg and $addpageno_abs < $onlyg){ if ($onlyg != $page) { $line .= " $onlyg |"; } if ($onlyg == $page) { $line .= " $onlyg |"; }}} if ($addpage_abs < $onlyg-1){ $adp=$addpage_abs+1; $line .= " еще>> ";} if ($all_messages != "0"){ if($all_messages <= $addpage){$line = "Страница: | 1 |";} else{$line = $line;} $t_center = @file("$dtemplates/gost_center.htm"); for($c = 0 ; $c < count($t_center); $c++){ $t_center[$c] = str_replace("%adres%",$adres,$t_center[$c]); $t_center[$c] = str_replace("%line%",$line,$t_center[$c]); $t_center[$c] = str_replace("%page%",$page,$t_center[$c]); echo $t_center[$c];}} for ( $i = $first-1; $i >= $second-1; $i--){ list($name,$message,$mail,$city,$homepage,$date,$ip,$answer)=explode("::", $general[$i]); $id = $i; $id++; $date = date("$mdate",$date); $t_mha = @file("$dtemplates/gost_message.htm"); $message = p($message); for($mha = 0 ; $mha < count($t_mha); $mha++){ $t_mha[$mha] = str_replace("%name%",$name,$t_mha[$mha]); if ($city != "") { $t_mha[$mha] = str_replace("%city%","$cp $city",$t_mha[$mha]); } if ($city == "") { $t_mha[$mha] = str_replace("%city%","",$t_mha[$mha]); } if ($mail != "") { $t_mha[$mha] = str_replace("%mail%","\"написать",$t_mha[$mha]);} else{ $t_mha[$mha] = str_replace("%mail%"," ",$t_mha[$mha]);} if ($homepage != ""){ $t_mha[$mha] = str_replace("%homepage%","\"перейти",$t_mha[$mha]);} if ($homepage == ""){ $t_mha[$mha] = str_replace("%homepage%"," ",$t_mha[$mha]); } $t_mha[$mha] = str_replace("%message%",$message,$t_mha[$mha]); $t_mha[$mha] = str_replace("%date%",$date,$t_mha[$mha]); if (strlen($answer) != "1"){ $t_mha[$mha] = str_replace("%admin%","$yn:",$t_mha[$mha]); $t_mha[$mha] = str_replace("%answer%","$answer",$t_mha[$mha]);} if (strlen($answer) == "1"){ $t_mha[$mha] = str_replace("%admin%","",$t_mha[$mha]); $t_mha[$mha] = str_replace("%answer%","",$t_mha[$mha]);} $t_mha[$mha] = str_replace("%id%",$id,$t_mha[$mha]); echo $t_mha[$mha];}echo "
";} if ($all_messages != "0"){ $t_bottom = @file("$dtemplates/gost_bottom.htm"); for($b = 0 ; $b < count($t_bottom); $b++){ $t_bottom[$b] = str_replace("%line%",$line,$t_bottom[$b]); $t_bottom[$b] = str_replace("%page%",$page,$t_bottom[$b]); $t_bottom[$b] = str_replace("%all_messages%",$all_messages,$t_bottom[$b]); echo $t_bottom[$b];}}} $t_mha = @file("$dtemplates/index_end.htm"); for($mha = 0 ; $mha < count($t_mha); $mha++){ $t_mha[$mha] = str_replace("%mtime%",$mtime,$t_mha[$mha]); $t_mha[$mha] = str_replace("%c_name%",$c_name,$t_mha[$mha]); $t_mha[$mha] = str_replace("%c_mail%",$c_mail,$t_mha[$mha]); $t_mha[$mha] = str_replace("%host%",$host_stat_day,$t_mha[$mha]); $t_mha[$mha] = str_replace("%hit%",$hit_stat_day,$t_mha[$mha]); $t_mha[$mha] = str_replace("%user%",$user_online,$t_mha[$mha]); echo "$t_mha[$mha]";} exit;} ?>