Вход Регистрация
Файл: region_clean/send.php
Строк: 402
<?
#######################################
## Mod By KoT (borispol) [76-75-072] ##
#######################################

require_once "start.php";
require_once 
"sid.php";

header("Cache-Control: no-cache");
if (
$ver == "wml"header ("Content-type:text/vnd.wap.wml; charset=utf-8");
else 
header("Content-Type:text/html; charset=UTF-8");

require_once 
"inc.php";
$link connect_db();
list(
$row$id$ps$fsize1$fsize2) = check_login($link);
require_once 
"version.php";
if (
$ver == "wml") {
echo 
$xml;
echo 
$dtd;
echo 
"<wml>
      <card id="
cabinet" title="Письма">
      <p>"
;
} else {
echo 
"<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      
<html xmlns="http://www.w3.org/1999/xhtml">
      <
head><link rel="stylesheet" type="text/css" href="css/$css.css"/>
      <
title>Письма</title>
      <
meta http-equiv="Content-Type" content="text/html; charset=utf-8"/></head><body>
      <
div align="left">n";
echo "
<div class = 'd1'>Отправка!</div>";
}

if (isset(
$_SESSION['do'])) unset($_SESSION['do']);
if (isset(
$_SESSION['go'])) unset($_SESSION['go']);
if (isset(
$_SESSION['time'])) unset($_SESSION['time']);

if (isset(
$rm) and !ctype_digit($rm)) { header('Location: index.php?isset=403'); }
$us = $row['user'];  
if (
$row["inv"] != 2) {
if (!@
$go) {
$times = getmicrotime();
mysql_query ("
Update users set onl='".$times."'room='letters' where id ='$id'");
if (
$ver !== "wml") {
if ((isset(
$rm)) and ($rm != "")) echo "<form method="POST" action="send.php?go=pn&amp;$ses&amp;rm=$rmname="auth">n";
else echo "
<form method="POST" action="send.php?go=pn&amp;$sesname="auth">n";}
$message = $topic = $towhom = "";
if (isset(
$im)) {
settype(
$im, 'integer');
$r = mysql_query ("SELECT FROM zapiski WHERE klu4 '".$im."'");
$a = mysql_fetch_array($r);
$towhom = $a ["towhom"];
$topic = $a ["topic"];
$message = $a ["message"];
}
else 
{
if (isset(
$who)) {
$r = mysql_query ("SELECT FROM zapiski WHERE klu4 '".$who."'");
$a = mysql_fetch_array($r);
$idwho = $a["idwho"];
$topic = $a["topic"];
$message = $a["message"];
$info = mysql_fetch_array(mysql_query ("Select user from users where id '".$idwho."'")); 
$towhom = $info["user"];
}
}
if (isset(
$tofr)) $towhom = $tofr;
if (
$message != "") {
if (strstr(
$message,"<img src="")) {
$tend strpos($message,""/>");  
$t = strlen($message);
$msgend = substr($message,$tend+3,$t);
$msgtemp = substr($message,0,$tend);
$t1 = strpos($msgtemp,"<img src="");
$msgfirst substr($msgtemp,0,$t1);
$t2 strlen($msgtemp);
$t3 strpos($msgtemp,"alt="");
$msgaver = substr($msgtemp,$t3+5,$t2);
$message = $msgfirst . $msgaver . $msgend;
}
if (strstr(
$message,"<a href="")) {
$tend strpos($message,"</a>");  
$t strlen($message);
$msgend substr($message,$tend+4,$t);
$tend2 strpos($message,"">");  
$msgtemp = substr($message,0,$tend2);
$t1 = strpos($msgtemp,"<a href="");
$msgfirst substr($msgtemp,0,$t1);
$t2 strlen($msgtemp);
$t3 strpos($msgtemp,"<a href="");
$msgaver = substr($msgtemp$t3 + 9, $t2);
$message = $msgfirst . $msgaver . $msgend;
}
}



/*
$tsmp = strtotime($row['date']);
$seconds = time() - $tsmp;
$days = $seconds/86400;
$days = round(intval($days), 1);

if (
$days < 0){
echo 'Дата регистрации: ' . 
$date;
echo '<br/>В чате уже дней: ' . 
$days;
echo '<br/>Чтобы написать письмо ты должен пробыть в чате не менее <b>1 (одного)</b> дня!<br/>';
echo "
<div class = 'd1'><a href="chatmail.php?$ses&amp;ref=$ref">Твоя почта</a><br/>n   
      
<a href="enter.php?$ses&amp;ref=$ref">Прихожая</a></div>n";   
break;

*/

if (
$row['posts'] < 50) {
echo 'Чтобы написать письмо у тебя должно быть не менее <b>50</b> постов!<br/>';
echo "
<div class = 'd1'><a href="chatmail.php?$ses&amp;ref=$ref">Твоя почта</a><br/>n   
      
<a href="enter.php?$ses&amp;ref=$ref">Прихожая</a></div>n";   
break;


echo 
$fsize1;

echo '<div class = "
d1">Для отправки письма ВСЕМ друзьям в поле Ник введи знак <b>*</b></div>';
echo '<br/>Ник или ID юзера:<br/>';
echo 
$fsize2;
if (
$ver == "wml") {

if (
$aga == "da") {
if (isset(
$who)) echo "<input name="towhom$refmaxlength="30" value="" title="komu"/><br/>n";
elseif (isset(
$tofr)) echo "<input name="towhom$refmaxlength="30" value="" title="komu"/><br/>n";
else echo "
<input name="towhom$refmaxlength="30" value="" title="komu"/><br/>n";
}
else
{
if (isset(
$who)) echo "<input name="towhom$refmaxlength="30" value="$towhomtitle="komu"/><br/>n";
elseif (isset(
$tofr)) echo "<input name="towhom$refmaxlength="30" value="$tofrtitle="komu"/><br/>n";
else echo "
<input name="towhom$refmaxlength="30" value="$totitle="komu"/><br/>n";
}

echo 
$fsize1;
echo 'Тема:<br/>';
echo 
$fsize2;
if (
$aga == "da") {
if (empty(
$topic)) {
$topic = "";
}
else
{
$topic = $topic;
}
}
else
{
if (empty(
$topic)) {
$topic = "";
}
else
{
$topic = str_replace("Re","",$topic);
$topic = "Re" . $topic;
}
}
if (
$alos == "da") {
$topic = "";
}
echo "
<input name="topic$refmaxlength="30" value="$topictitle="topic"/><br/>n"; 
echo 
$fsize1;
echo 'Письмо:<br/>';
echo 
$fsize2;

if (
$aga == "da") {
if (empty(
$message)) {
$message = "";
}
else
{
$message = $message;
}
}
else
{
$message = "";
}
echo "
<input name="message" maxlength="600" value="$messagetitle="message"/><br/>n";

echo 
$fsize1;

echo 'Отчет о прочтении:<br/>
      <select name="
ot4et">
      <option value="
0">Нет</option>
      <option value="
1">Да</option>
      </select><br/><br/>';


if ((isset(
$rm)) and ($rm != "")) echo "<anchor title="go">Отправить<go href="send.php?go=pn&amp;$ses&amp;rm=$rmmethod="post">n";
else echo "
<anchor title="go">Отправить<go href="send.php?go=pn&amp;$sesmethod="post">n";
echo "
<postfield name="towhom" value="$(towhom$ref)"/>n
      
<postfield name="topic" value="$(topic$ref)"/>n
      
<postfield name="message" value="$(message)"/>n
      
<postfield name="ot4et" value="$(ot4et$ref)"/>n
      
</go></anchor>n"; 
echo 
$fsize2;
echo '<br/>';
}
else
{

if (
$aga == "da") {
if (isset(
$who)) echo "<input name="towhom" maxlength="30" value="" title="komu"/><br/>n";
elseif (isset(
$tofr)) echo "<input name="towhom" maxlength="30" value="" title="komu"/><br/>n";
else echo "
<input name="towhom" maxlength="30" value="" title="komu"/><br/>n";
}
else
{
if (isset(
$who)) echo "<input name="towhom" maxlength="30" value="$towhomtitle="komu"/><br/>n";
elseif (isset(
$tofr)) echo "<input name="towhom" maxlength="30" value="$tofrtitle="komu"/><br/>n";
else echo "
<input name="towhom" maxlength="30" value="$totitle="komu"/><br/>n";
}
echo 
$fsize1;
echo 'Тема:<br/>';
echo 
$fsize2;
if (
$aga == "da") {
if (empty(
$topic)) {
$topic = "";
}
else
{
$topic = $topic;
}
}
else
{
if (empty(
$topic)) {
$topic = "";
}
else
{
$topic = str_replace("Re","",$topic);
$topic = "Re" . $topic;
}
}
if (
$alos == "da") {
$topic = "";
}
echo "
<input name="topic" maxlength="30" value="$topictitle="topic"/><br/>n"; 
echo 
$fsize1;
echo 'Письмо:<br/>';
echo 
$fsize2;

if (
$aga == "da") {
if (empty(
$message)) {
$message = "";
}
else
{
$message = $message;
}
}
else
{
$message = "";
}

if (isset(
$_GET['im'])) {
$from = mysql_fetch_array(mysql_query("SELECT `messageFROM `zapiskiWHERE `klu4` = '".mysql_real_escape_string(check($_GET['im']))."'"));
if (isset(
$_GET['im'])) $message = $from[0];
}


echo '<textarea name="
message" maxlength="600" value="" cols="22" rows="6">'.$message.'</textarea><br/>';

echo 'Отчет о прочтении:<br/>
      <select name="
ot4et">
      <option value="
0">Нет</option>
      <option value="
1">Да</option>
      </select><br/><br/>';

echo"
<input type="submit" class="ibutton" value="Отправить" name="enter"></form>n";
}

echo 
$fsize1;
echo 
$fsize2;
echo 
$fsize1;


echo 
$fsize2;

echo '<br/>';
if ((isset(
$rm)) and ($rm != "")) {
echo "
<div class = 'd1'><a href="chat.php?$ses&amp;rm=$rm$takep">В чат</a></div>";
}
echo "
<div class = 'd1'><a href="enter.php?$ses&amp;ref=$ref">Прихожая</a></div>";

include_once "
foot.php";
mysql_close (
$link);
exit;
}
$message = mysql_real_escape_string(check($message));
$topic = mysql_real_escape_string(check($topic));
if (
$towhom == "*") {
if (
$row["translit"] == 1) $topic = trun_to_rus($topic);
$fr = $row["friends"];
$time = time();
////////////
$data = date("H:i(d-M)"); ## дата
$data = str_replace("January","Января",$data);
$data = str_replace("February","Февраля",$data);
$data = str_replace("March","Марта",$data);
$data = str_replace("April","Апреля",$data);
$data = str_replace("May","Мая",$data);
$data = str_replace("June","Июня",$data);
$data = str_replace("July","Июля" ,$data);
$data = str_replace("August","Августа",$data);
$data = str_replace("September","Сентября",$data);
$data = str_replace("October","Октября",$data);
$data = str_replace("November","Ноября",$data);
$data = str_replace("December","Декабря",$data);
////////////
$msg = $message;
require_once "
smile.php";
$minpos = 1200; 
$nm = 1200;
for (
$j = 0; $j <= count($smiles) - 1; $j++) {
$tmpp = strpos($msg,$smiles[$j]);
if ((
$tmpp < $minpos) and ($tmpp !== false)) {
$minpos = $tmpp$nm = $j;
}
}
if (
$minpos != 1200) {
if (
$row["translit"] != 1) {
$st1 = substr($msg,0,$minpos+strlen($smiles[$nm]));
$st2 = substr($msg,$minpos+strlen($smiles[$nm]),strlen($msg)-strlen($st1));
$st1 = str_replace($smiles[$nm],$replaces[$nm],$st1);
$msg = $st1.$st2;
}
else
{
$st1 = substr($msg,0,$minpos);
$st2 = substr($msg,$minpos, strlen($smiles[$nm]));
$st3 = substr($msg,$minpos+strlen($smiles[$nm]),strlen($msg)-strlen($st1)-strlen($st2));
$st1 = trun_to_rus($st1);
$st2 = $replaces[$nm];
$st3 = trun_to_rus($st3);
$msg = $st1 . $st2 . $st3;
}

else if (
$row["translit"] == 1) $msg = trun_to_rus($msg);
Unset(
$smiles);
unset(
$replaces);   
if (
$row["level"] > 6) $msg = eregi_replace("((http://))((([a-z0-9-]+(.[a-z0-9-]+)*(.[a-z;]{2,3}))|(([0-9]{1,3}.){3}([0-9]{1,3})))((/|?)[a-z0-9~#%&'_+=:;?.-]*)*)", "<a href="\0">\3</a>", $msg);
$message $msg;  
$userm mysql_query ("select count(klu4) as num from friends where id ='$id';");
$usm mysql_fetch_array($userm);
$num $usm["num"];
if (!isset(
$s)) $s 0;
$mx round(($num/10) + 0.45);
if (
$s $mx$s $mx;
if (
$s == 0$s 1;
$ot = (($s 1) * 10) + 1;
$do $s 10;
if (
$do $num$do=$num;
$o $ot-1;
$n $ot;
if (
$do == 0$n=$o;
$r mysql_query ("select usid from friends where id ='$id' order by klu4 desc limit $o,$do");
for (
$i $ot$i <= $do$i++) {
$arr mysql_fetch_array($r);
$idtowhom $arr['usid'];
$ignornick mysql_fetch_array(mysql_query ("Select user from users where id='".$idtowhom."' LIMIT 1;"));
$kol rand(0,99999999);
mysql_query("Insert into zapiski set klu4='".$kol."', who ='".$us."', idwho ='$id', message = '".$message."', towhom = '".$ignornick[0]."', idtowhom = '".$idtowhom."', time = '".$time."', readd = '0', topic = '".$topic."', date='".$data."'");
mysql_query ("Update users set onl='".$time."', room='letters' where id ='$id'");
if (
mysql_error() != false)
continue;
$alls $alls "$ignornick[0], ";
}  

if (
$ver == "wml") {
echo 
$xml;
echo 
$dtd;
echo 
"<wml>
      <card id="
cabinet" title=">Письма">
      <p>"
;
} else {
echo 
"<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      
<html xmlns="http://www.w3.org/1999/xhtml">
      <
head><link rel="stylesheet" type="text/css" href="css/$css.css"/>
      <
title>Письма</title>
      <
meta http-equiv="Content-Type" content="text/html; charset=utf-8"/></head><body>
      <
div align="left">n";
}
echo 
$fsize1;
echo 'Твоё письмо успешно отправлено следующим пользователям: ' . 
$alls;
echo 
$fsize2;

echo "
<br/><div class = 'd1'><a href="enter.php?$ses&amp;ref=$ref">Прихожая</a></div>";

include_once "
foot.php";
mysql_close (
$link);
}
else
{
if (!ctype_digit(
$towhom)) {
$towhom = trim($towhom);
if (
$towhom == "") $towhom = 0;
$latuser = strtolower($towhom);
$ruser = rus_to_k($towhom);
if (
$ruser == $towhom) {
$latuser = mysql_real_escape_string($latuser);
$r = mysql_query ("Select id,avtootvet,user,sex,room,onl,vron,xstatus from users where latuser '".$latuser."'"); 
}
else 
{
$ruser = mysql_real_escape_string($ruser);
$r = mysql_query ("select id,avtootvet,user,sex,room,onl,vron,xstatus from users where ruser '".$ruser."'");
}
}
else 
{
$towhom = mysql_real_escape_string($towhom);
$r = mysql_query ("select id,avtootvet,user,sex,room,onl,vron,xstatus from users where id '".$towhom."'");
}
if (mysql_affected_rows() == 0) {
echo 
$fsize1;
echo 'Ошибка ввода или пользователь не существует!<br/>';
echo 
$fsize2;

echo "
<br/><div class = 'd1'><a href="enter.php?$ses&amp;ref=$ref">Прихожая</a></div>";

require_once "
foot.php";
mysql_close (
$link);
exit;
}
if (empty(
$topic)) {
if (
$ver == "xhtml") {
require_once "
obolochka.php";
}
echo 'Напиши тему письма!<br/>';
include_once "
foot.php";
exit;
}

$a = mysql_fetch_array($r);
$login = $a["user"];
$sex = $a["sex"];
$usid = $a["id"];
mysql_query ("
Select from ignor where usid='$id' and id='$usid'");
if (mysql_affected_rows() == true) {

echo 
$fsize1;
if (
$sex == "М") echo "<b>".col_n($login)."</bотправил тебя в игнор!<br/>n";
else  echo "
<b>".col_n($login)."</bотправила тебя в игнор!<br/>n";
echo 
$fsize2;
echo "
<br/><div class = 'd1'><a href="enter.php?$ses&amp;ref=$ref">Прихожая</a></div>";
include_once "
foot.php";
mysql_close (
$link);
exit;
}
else
{     
if (
$row["translit"] == 1) $topic = trun_to_rus($topic);
$time = time();
$data = date("H:i(d-M)"); 
$msg = $message;
if (
$row["level"] < 5) require_once "antirekl.php";
require_once "
smile.php";
$minpos = 1200; $nm = 1200;
for (
$j=0; $j <= count($smiles) - 1; $j++) {   
$tmpp = strpos($msg,$smiles[$j]);
if ((
$tmpp < $minpos) and ($tmpp !== false)) { 
$minpos = $tmpp$nm = $j;};};         
if (
$minpos != 1200) {
if (
$row["translit"] == 0) {
$st1 = substr($msg,0,$minpos+strlen($smiles[$nm]));
$st2 = substr($msg,$minpos+strlen($smiles[$nm]),strlen($msg)-strlen($st1));
$st1 = str_replace($smiles[$nm],$replaces[$nm],$st1);           
$msg = $st1.$st2;
}
else
{
$st1 = substr($msg,0,$minpos);
$st2 = substr($msg,$minpos, strlen($smiles[$nm]));
$st3 = substr($msg,$minpos+strlen($smiles[$nm]),strlen($msg)-strlen($st1)-strlen($st2));
$st1 = trun_to_rus($st1);
$st2 = $replaces[$nm];
$st3 = trun_to_rus($st3);
$msg = $st1.$st2.$st3;
}
}
else if (
$row["translit"] == 1) $msg = trun_to_rus($msg);          
Unset(
$smiles);
unset(
$replaces);

function ad_cut(
$str,$to) { 
$domains = array('http://','.ru','.su','4at','.mobi','.ws','.tv','.4ats','.tv','.name','.us','.biz','.info','.org','.net','.com','.wen','.in'); 
$replacer = array_fill(0,count($domains),$to); 
$result = array_combine($domains,$replacer); 
return strtr(
$str,$result); 
}

$content = ad_cut($content);
$topic = ad_cut($topic);

$avoriza = mysql_fetch_array(mysql_query("SELECT FROM `usersWHERE id '$usid'"));
$avtoriz = $avoriza['avtoriz'];

$fromid = mysql_fetch_array(mysql_query("SELECT FROM `usersWHERE `id` = '$id'"));
$fromus = $fromid['user'];

if (
$avtoriz != 0) {
echo 'Ты не можешь отправлять письма данному пользователю!<br/>
      <br/><a href = "
enter.php?'.$ses.'&amp;ref='.$ref.'">В прихожую</a><br/>';
break;
}

if (
$row["translit"] == 0) $msg = eregi_replace("((http://))((([a-z0-9-]+(.[a-z0-9-]+)*(.[a-z;]{2,3}))|(([0-9]{1,3}.){3}([0-9]{1,3})))((/|?)[a-z0-9~#%&'_+=:;?.-]*)*)", "<a href="\0">\3</a>",$msg);   
$message $msg;
$idtowhom $a['id'];
$avtootvet $a['avtootvet'];
$vron $a['vron'];
$onl $a['onl'];
$usid $a['id'];
$xstatus $a['xstatus'];
$mesxstatus $a['mesxstatus'];
$kol rand(0,99999999);
$time time();
//////////////

$data date("d F Y [H:i]"); ## дата
$data str_replace("January","Января",$data);
$data str_replace("February","Февраля",$data);
$data str_replace("March","Марта",$data);
$data str_replace("April","Апреля",$data);
$data str_replace("May","Мая",$data);
$data str_replace("June","Июня",$data);
$data str_replace("July","Июля" ,$data);
$data str_replace("August","Августа",$data);
$data str_replace("September","Сентября",$data);
$data str_replace("October","Октября",$data);
$data str_replace("November","Ноября",$data);
$data str_replace("December","Декабря",$data);
//////////////////
$times getmicrotime();
if (
$xstatus == 37) {

echo 
'<b>Заприщено писать людям с X-статусом</b> <img src="xstatus/37.gif" alt="xstatus"/> '.$mesxstatus.' <br/>';
echo 
"<div class = 'd1'><a href="chatmail.php?$ses&amp;ref=$ref">Твоя почта</a><br/>n   
      <a href="
enter.php?$ses&amp;ref=$ref">Прихожая</a></div>n";   
break;
}else{
mysql_query("Select readd from zapiski WHERE (who='".$us."') and (idwho ='$id') and (message = '".$message."') and (towhom = '".$login."')and(idtowhom = '".$idtowhom."')and(topic = '".$topic."')");
if (
mysql_affected_rows() === 0) {
mysql_query("Insert into zapiski set klu4='".$kol."', who ='".$us."', idwho ='$id', message = '".$message."', towhom = '".$login."', idtowhom = '".$idtowhom."', time = '".$times."', readd = '0', ot4et = '".$ot4et."', topic = '".$topic."', date='".$data."'");
}
}
if (
mysql_error() == false) {

if (
$xstatus == 37) {

echo 
'<b>Заприщено писать людям с X-статусом</b> <img src="xstatus/37.gif" alt="xstatus"/> '.$mesxstatus.' <br/>';
echo 
"<div class = 'd1'><a href="chatmail.php?$ses&amp;ref=$ref">Твоя почта</a><br/>n   
      <a href="
enter.php?$ses&amp;ref=$ref">Прихожая</a></div>n"
      include_once 
"foot.php";  
break;
}
echo 
$fsize1;
echo 
'Твоё сообщение для <a href="info.php?'.$ses.'&amp;nk='.$usid.'"><b>' col_n($login) . '</b></a> ';
echo 
$fsize2;
if (
$vron == 0) {
if (
$onl 100 time())
{
echo 
' <img src="icon/onn.gif" alt="."/>';
} else {
echo 
' <img src="icon/off.gif" alt="."/>';
}
}
elseif (
$vron == 1)
{
echo 
' <img src="icon/inv.gif" alt="."/>';
}
echo 
' успешно отправлено!<br/>';
if (
$avtootvet != '') {
echo 
$fsize1;
echo 
$divide;
echo 
'<b>Автоответчик</b>: <u>' $avtootvet '</u><br/>';
echo 
$fsize2;
}

echo 
$fsize1;
echo 
$fsize2;

echo 
'<br/>';
echo 
"<div class = 'd1'><a href="inbox.php?$ses&amp;ref=$ref">Входящие</a></div>";
if (
$mod) {
echo 
"<div class = 'd1'><a href="chatmail.php?$ses&amp;ref=$ref">Моя почта</a></div>";
}
echo 
"<br/><div class = 'd1'><a href="enter.php?$ses&amp;ref=$ref">Прихожая</a></div>";

include_once 
"foot.php";
}

else
{
echo 
$fsize1;
echo 
'Ошибка при отправке письма! Попробуй ещё раз.<br/>';
echo 
$fsize2;
echo 
"ERROR " mysql_error();

echo 
"<br/><div class = 'd1'><a href="enter.php?$ses&amp;ref=$ref">Прихожая</a></div>";

include_once 
"foot.php";
}
mysql_close ($link);
}
}
}

else
{
echo 
$fsize1;
echo 
'Ты не можешь писать письма, так как находишься в Полном Игноре.<br/>';
echo 
$fsize2;

echo 
"<br/><div class = 'd1'><a href="enter.php?$ses&amp;ref=$ref">Прихожая</a></div>";

include_once 
"foot.php";
}
?>
Онлайн: 1
Реклама