Просмотр файла mini-chat/add.php

Размер файла: 3.05Kb
<? 
//////////////////////////////////////////////////////////////////////////////////////////
/////
/////                        ********* MINI-CHAT *********
/////
/////                            Made by   :  VANTUZ
/////                              E-mail  :  [email protected]
/////                                Site  :  http://pizdec.ru
/////                            WAP-Site  :  http://wapstop.ru 
/////                            WAP-Site  :  http://visavi.net 
/////                            WAP-Site  :  http://banzaj.net
/////                                 ICQ  :  36-44-66
/////
//////////////////////////////////////////////////////////////////////////////////////////////
//      ВЫ НЕ ИМЕЕТЕ ПРАВО ВНОСИТ ИЗМЕНЕНИЯ В КОД СКРИПТА ДЛЯ ДАЛЬНЕЙШЕГО РАСПРОСТРАНЕНИЯ   //
//////////////////////////////////////////////////////////////////////////////////////////////
Error_Reporting(E_ALL & ~E_NOTICE);
Error_Reporting (ERROR | WARNING);
function myErrorHandler ($errno, $errstr, $errfile, $errline) {}
set_error_handler("myErrorHandler"); 
extract($HTTP_GET_VARS);
extract($HTTP_POST_VARS);
extract($HTTP_COOKIE_VARS);
extract($HTTP_SERVER_VARS);
extract($HTTP_SESSION_VARS);
//////////////////////////////////////////////////////////////////////////////////////
ini_set('arg_separator.output','&amp;');
session_name("SID");
session_start();
require"config.php";
$u1=getenv('HTTP_USER_AGENT');
$brow=strtok($u1,'/');
if (getenv("HTTP_X_FORWARDED_FOR"))
 { $ip=getenv("HTTP_X_FORWARDED_FOR"); }
   else { $ip=getenv("REMOTE_ADDR"); }

$ip=htmlspecialchars(stripslashes($ip));
$brow=htmlspecialchars(stripslashes($brow));

$date=date("d.m.y");
$time=date("H:i"); 

$name=$_POST['name']; $msg=$_POST['msg']; $email=$_POST['email'];
if ($name == "" || strlen($name) > $maxname) {header ("Location: say.php?names"); exit;}
if ($msg == "" || strlen($msg) > $maxmsg) {header ("Location: say.php?posts");  exit;}
if (!eregi("^([0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-wyz][a-z](fo|g|l|m|mes|o|op|pa|ro|seum|t|u|v|z)?)$", $email) and $email != "") {header ("Location: say.php?vvv"); exit;}
include 'antiflood.php';
if (CheckIP ()) {header ("Location: index.php?antiflood"); exit;}
// обрезаем лишние символы в емайле/имени/сообщении
$email=substr($email,0,30);
$msg=stripslashes($msg);
$msg=htmlspecialchars($msg);
$msg=str_replace("|"," ",$msg);
$name=stripslashes($name);
$name=htmlspecialchars($name);
$name=str_replace("|"," ",$name);
$text="$msg|$name|$email|$date|$time|$brow|$ip|";
$text=str_replace("\r\n", "", $text);


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

$file=file("chat.dat"); $i = count($file);
if ($i>=$maxmeschat) {
$fp=fopen("chat.dat","w");
flock ($fp,LOCK_EX);
unset($file[0]);
fputs($fp, implode("",$file));
flock ($fp,LOCK_UN);
fclose($fp);
}

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



?>