Просмотр файла send.php

Размер файла: 4.5Kb
<?php
list($msec,$sec)=explode(chr(32),microtime());
$headtime=$sec+$msec;
header("Content-type: text/html; charset=utf-8");
Header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
Header("Cache-Control: no-cache, must-revalidate");
Header("Pragma: no-cache");
Header("Last-Modified: ".gmdate("D, d M Y H:i:s")."GMT");
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="style.css">
<title>SMS-BWC</title>
</head><body  topmargin="0" leftmargin="0">
<small>';
$tim=date("H:i");
$savestat="on"; // on - записывать сообщения в файл sms_send.txt, off - не записывать
$nomer=trim(stripslashes(htmlspecialchars($_POST['nomer'])));
$nomer=str_replace('$','$$',$nomer);
$nomer=str_replace('`','``',$nomer);
$nomer=str_replace('\*','\\',$nomer);
$msg=trim(stripslashes(htmlspecialchars($_POST['msg'])));
$msg=str_replace('$','$$',$msg);
$msg=str_replace('`','``',$msg);
$msg=str_replace('\*','\\',$msg);
$nick=trim(stripslashes(htmlspecialchars($_POST['nick'])));
$nick=str_replace('$','$$',$nick);
$nick=str_replace('`','``',$nick);
$nick=str_replace('\*','\\',$nick);
$operator=trim(stripslashes(htmlspecialchars($_POST['operator'])));
$operator=str_replace('$','$$',$operator);
$operator=str_replace('`','``',$operator);
$operator=str_replace('\*','\\',$operator);
$ot_kogo=trim(stripslashes(htmlspecialchars($_POST['ot_kogo'])));
$ot_kogo=str_replace('$','$$',$ot_kogo);
$ot_kogo=str_replace('`','``',$ot_kogo);
$ot_kogo=str_replace('\*','\\',$ot_kogo);
$error='';
if(strlen($nomer)<11) $error.='- Введённый номер неверен или пуст! Введите федеральный номер в формате: <font color="#ff0000">7902ххххххх</font>!<br>';
if(strlen($msg)>170) $error.='- Сообщение слишком большое!<br>';
if(strlen($nick)>20) $error.='- Подпись слишком большая!<br>';
if(empty($msg)) $error.='- Не написано сообщение!<br>';
if(empty($nick)) $error.='- Нет подписи!<br>';
if(!empty($error))
{
echo '<div class="error">
<span style="color: #ff0000">Ошибка!</span><br>
'.$error.'</div>
<div class="logo">
&#187; <a href="./">Назад</a><br>
<center><b>&copy;Усть-Илимск</b><br>';
list($msec,$sec)=explode(chr(32),microtime());
echo round(($sec+$msec)-$headtime,4).' sec</center></div>
</small>
</body></html>';
exit();
}
function antispam($file,$num) { $workfile=file($file); $rvalue=$workfile[$num]; return ($rvalue); }
$lastmsg=antispam("time.txt",0);
if($tim==$lastmsg)
{
echo '<div class="error">
<span style="color: #ff0000">Ошибка!</span><br>
Часто нельзя отправлять! Попробуйте через 30 секунд!</div>
<div class="logo">
&#187; <a href="./">Назад</a><br>
<center><b>&copy;Усть-Илимск</b><br>';
list($msec,$sec)=explode(chr(32),microtime());
echo round(($sec+$msec)-$headtime,4).' sec</center></div>
</small>
</body></html>';
exit();
}
echo '<div class="logo">
<center><b>SMS-Центр</b><br>
<img src="bwc_1.png" alt=""><br>
******</center></div>
<div class="form">
SMS от: '.$nick.'<br>
Номер: +'.$nomer.'<br>
Сообщение: '.$msg.'<br>';
include_once 'utf_to_win.php';
$subject=$ot_kogo.' '.$nick;
$subject=utf_to_win($subject);
$nick=utf_to_win($nick);
$header="Content-Type: text/plain; charset=utf-8\r\n";
$header.="X-sender: $nomer <$operator>\r\n";
$header.="Content-Transfer-Encoding: 8bit\r\n";
$header.="Date: ". date("r")."\r\n";
$header.="From: $nomer <$operator>\r\n";
$to=$nomer.$operator;
mail($to,$subject,$msg,$header);
echo '<span style="color: #ffffff">Успешно отправлено!</span></div>
<div class="logo">
&#187; <a href="./">Назад</a><br>
<center><b>&copy;Усть-Илимск</b><br>';
list($msec,$sec)=explode(chr(32),microtime());
echo round(($sec+$msec)-$headtime,4).' sec</center></div>
</small>
</body></html>';
$anti_spam=fopen("time.txt","w");
$time=date("H:i");
$time=str_replace("\r\n","",$time);
$time=str_replace("\n","",$time);
fputs ($anti_spam,$time);
fclose($anti_spam);
if ($savestat=="off") { if(!file_exists("sms_send.txt")) { $sms_send=fopen("sms_send.txt","w"); fclose($sms_send); } }
if($savestat=="on") { $sms_send=fopen("sms_send.txt","a"); $date=date("d-m-Y"); $save="$date | +$nomer | $msg | $nick\n"; fwrite($sms_send,$save); fclose($sms_send); }
?>