Файл: in4at/send.php
Строк: 234
<?php
##################################################################################################
## Script name : In4at ##
## Version : Final ##
## Made by : XPYCT(Сергей Мищенко) ##
## E-mail : bce-ok@bk.ru ##
## ICQ : 447-50-50-62 ##
## Site : http://vkontakte.ru/id31604521 ##
## Внимание! Скрипт распространяется бесплатно! Модификация W4at by XPYCT ##
##################################################################################################
define('REQ_2_chat', true);
require('4at_set.php');
require('db_con.php');
require('style.php');
if ($py !== spy_code) require('us_info.php');
require('func.php');
$us=$row['user'];
if(!@$go){
echo head;
if ($vv!=0) echo '<div class="d0"><b>Написать</b></div>';
else echo '<card id="send" title="Написать"><p>';
if($row["posts"]<500){
echo $fsize1; echo 'Вы не можете отправлять письма!<br/><b>Вам нужно иметь хотя бы 500 постов!</b><br/>';
echo "<a href="chatmail.php?$wp">Ваша почта</a><br/>n";
echo '<a href="enter.php?'.$wp.'">Пpuxoжaя</a><br/>';
echo $fsize2;
}else{
$message = $topic = $towhom = "";
if (isset($im)){
$im=intval($im);
$r = mysql_query("SELECT idtowhom,topic,message FROM zapiski WHERE klu4 = '".$im."'");
$a = mysql_fetch_array($r);
$nk = $a['idtowhom'];
$topic = $a['topic'];
$message = $a['message'];
} elseif (isset($who)){
$who=intval($who);
$r = mysql_query("SELECT idwho,topic FROM zapiski WHERE klu4 = '".$who."'");
$a = mysql_fetch_array($r);
$nk = $a['idwho'];
$topic = 'RE: '.$a['topic'];
}
if (isset($nk)){
$fid2us = mysql_fetch_array(mysql_query("Select user from users where id = '".$nk."' LIMIT 1;"));
$towhom = $fid2us['user'];
}
if ($vv!=0){
if ((isset($rm))&&($rm!="")) echo"<form action="send.php?$wp&rm=$rm&go=send" method="post">";
else echo "<form action="send.php?$wp&go=send" method="post">";
}
echo $fsize1;
echo 'Кому:<br/>';
echo $fsize2;
echo "<input name="towhom$ref" maxlength="30" value="$towhom" title="komu"/><br/>n";
echo $fsize1;
echo 'Тема:<br/>';
echo $fsize2;
echo "<input name="topic$ref" maxlength="30" value="$topic" title="topic"/><br/>n";
echo $fsize1;
echo 'Письмо:<br/>';
echo $fsize2;
echo "<input name="message$ref" maxlength="600" value="$message" title="message"/><br/>n";
if ($vv!=0){
echo "<input class="ibutton" type="submit" value="Отправить"/><br/></form>";
echo $fsize1;
} else {
echo $fsize1;
if ((isset($rm))&&($rm!=""))echo "<anchor title="go">Отправить<go href="send.php?go=pn&$wp&rm=$rm" method="post">n";
else echo "<anchor title="go">Отправить<go href="send.php?go=pn&$wp" method="post">n";
echo "<postfield name="towhom" value="$(towhom$ref)"/>n";
echo "<postfield name="topic" value="$(topic$ref)"/>n";
echo "<postfield name="message" value="$(message$ref)"/>n";
echo '</go></anchor><br/>';
}
echo '<i>Для отправки письма ВСЕМ друзьям в поле Кому введите знак *</i><br/>';
echo divide;
if ((isset($rm))&&($rm!="")) echo "<a href="chat.php?$wp&rm=$rm">В чат</a><br/>n";
echo "<a href="chatmail.php?$wp">Ваша почта</a><br/>n";
echo '<a href="enter.php?'.$wp.'">Пpuxoжaя</a><br/>';
echo $fsize2;
}
echo foot;
mysql_close($link);
exit;
}
$protected = $towhom.$message.$topic;
if (eregi("'",$protected)) { header('Location: http://'.chat_adr.'/error.php');die; }
$towhom = check($towhom);
$message = check($message);
$topic = check($topic);
if ($towhom!=='*'){
if (!ctype_digit($towhom)){
$towhom=trim($towhom);
if($towhom=='')$towhom=0;
$latuser=strtolower($towhom);
$ruser = rus_to_k($towhom);
if($ruser==$towhom){
$r = mysql_query("Select id,user,avtootvet,room,onl from users where latuser = '".$latuser."' LIMIT 1;");
} else {
$r = mysql_query("select id,user,avtootvet,room,onl from users where ruser = '".$ruser."' LIMIT 1;");
}
} else {
$r = mysql_query("select id,user,avtootvet,room,onl from users where id = '".$towhom."' LIMIT 1;");
}
if (mysql_affected_rows() == 0){
echo head;
if ($vv!=0) echo '<div class="d0"><b>Не найдено</b></div>';
else {
if ((isset($rm))&&($rm!="")) echo "<card id="error" title="Не найдено" ontimer="send.php?$wp&rm=$rm"><timer value="10"/><p>";
else echo "<card id="error" title="Не найдено" ontimer="send.php?$wp"><timer value="10"/><p>";
}
echo $fsize1;
echo '<b>Нет такого юзера!</b><br/>';
echo divide;
echo '<a href="send.php?'.$wp.'">Назад</a><br/>';
echo $fsize2;
echo foot;
mysql_close ($link);
exit;
}
$a = mysql_fetch_array($r);
$idtowhom=$a['id'];
$touser=$a['user'];
$qi=mysql_query("Select who from ignor where user= '".$idtowhom."'");
while($ia=mysql_fetch_array($qi)){
$ignor[]=$ia[0];}
if (in_array($id, $ignor)){
echo head;
if ($vv!=0) echo '<div class="d0"><b>Ошибка!</b></div>';
else {
if ((isset($rm))&&($rm!="")) echo "<card id="error" title="Ошибка!" ontimer="send.php?$wp&rm=$rm"><timer value="10"/><p>";
else echo "<card id="error" title="Ошибка!" ontimer="send.php?$wp"><timer value="10"/><p>";
}
echo $fsize1;
echo '<b>Вы в игноре у '.$touser.'</b><br/>
Сообщение не доставлено!<br/>';
echo divide;
echo '<a href="send.php?'.$wp.'">Назад</a><br/>';
echo $fsize2;
echo foot;
mysql_close($link);
exit;
}
if ($row['translit']==1) $topic = trun_to_rus($topic);
$time = time();
$data = date("H:i(d-M)");
$msg = $message;
if($row['level']>4){
$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);
}
require('smile.php');
$minpos = 1200;$nm = 1200;
for ($j=0;$j<=count($smiles)-1;$j++){
$tmpp = strpos($msg,$smiles[$j]);
if (($tmpp < $minpos)&&($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);
$message = $msg;
$avtootvet=$a['avtootvet'];
$room=$a['room'];
$onl=$a['onl'];
$kol = rand(0,99999999);
$time = time();
$data = date("d M Y [H:i]");
$times = getmicrotime();
$lastm=mysql_fetch_array(mysql_query("Select time from zapiski WHERE idwho ='".$id."' order by time desc LIMIT 1;"));
mysql_query("Select readd from zapiski WHERE (who='".$us."')and(idwho ='".$id."')and(message = '".$message."')and(towhom = '".$towhom."')and(idtowhom = '".$idtowhom."')");
if (mysql_affected_rows()===0 and ($time-$lastm[0]) > 30){
$msg=strtolower($message);
if (substr_count($msg, '.ru')!=0||substr_count($msg, '.com')!=0||substr_count($msg, '.ua')!=0||substr_count($msg, '.mobi')!=0||substr_count($msg, '.ws')!=0||substr_count($msg, '.su')!=0||substr_count($msg, '.us')!=0||substr_count($msg, '.biz')!=0||substr_count($msg, '.kz')!=0||substr_count($msg, '.lv')!=0||substr_count($msg, '.lt')!=0||substr_count($msg, '.net')!=0||substr_count($msg, '.org')!=0||substr_count($msg, '.info')!=0){
$fi = fopen("syst/reklama.dat", "a+");
@flock($fi,LOCK_EX);
$dat = date ("d/m/y");
$vrem = date ("H:i");
$lst = "$us ($dat $vrem): $towhom, $message";
fwrite($fi, "$lstn");
fwrite($fi, "************n");
fflush($fi);
flock($fi,LOCK_UN);
fclose($fi);
}
mysql_query("Insert into zapiski set klu4='".$kol."', who ='".$us."', idwho ='".$id."', message = '".$message."', towhom = '".$towhom."', idtowhom = '".$idtowhom."', time = '".$times."', readd = '0', topic = '".$topic."', date='".$data."'")&&mysql_query("Update users set onl='".$times."', room='letters' where id ='".$id."' LIMIT 1;");
} else {
echo head;
if ($vv!=0) echo '<div class="d0"><b>Ошибка</b></div>';
else {
if ((isset($rm))&&($rm!="")) echo "<card id="error" title="Ошибка" ontimer="send.php?$wp&rm=$rm"><timer value="20"/><p align="center">";
else echo "<card id="error" title="Ошибка" ontimer="send.php?$wp"><timer value="20"/><p>";
}
echo $fsize1;
echo '<b>Ошибка при отправке письма!</b><br/>
Вы пишите слишком часто или ваши сообщения повторяются.<br/>
Попробуйте повторить позже.<br/>';
echo divide;
echo '<a href="send.php?'.$wp.'">Назад</a><br/>';
echo $fsize2;
echo foot;
mysql_close ($link);
exit;
}
echo head;
if ($vv!=0) echo '<div class="d0"><b>Отправлено!</b></div>';
else {
if ((isset($rm))&&($rm!="")) echo "<card id="done" title="Отправлено!" ontimer="chat.php?$wp&rm=$rm"><timer value="30"/><p align="center">";
else echo "<card id="done" title="Отправлено!" ontimer="chatmail.php?$wp"><timer value="300"/><p>";
}
echo $fsize1;
echo 'Ваше сообщение для <b>'.$touser.'</b> успешно отправлено!<br/>';
if (($onl+300>time())&&($room!="")){
if ($room=='letters'){
echo divide;
echo "В данный момент я нахожусь в <a href="chatmail.php?$wp">записках</a><br/>n";
} else if ($room=='holl'){
echo divide;
echo "В данный момент я нахожусь в <a href="enter.php?$wp">прихожей</a><br/>n";
}else{
$roomselect = mysql_query("Select name from rooms where rm=$room");
$rooms = mysql_fetch_array($roomselect);
$roomname=$rooms['name'];
echo divide;
echo 'В данный момент я нахожусь в комнате: '.$roomname.'<br/>';
if($room==9)echo "<a href="anlim.php?$wp&rm=$room">Войти в комнату</a><br/>";
else echo "<a href="chat.php?$wp&rm=$room">Войти в комнату</a>";
echo ' или ';
echo "<a href="inside.php?$wp&rm=$room&nk=$idtowhom">Написать мне в чате</a><br/>";
}
}else{
if($avtootvet){
echo divide;
echo 'Автоответчик: '.$avtootvet.'<br/>';
}
}
echo divide;
if (isset($rm)) echo "<a href="chat.php?$wp&rm=$rm">В чат</a><br/>";
echo '<a href="chatmail.php?'.$wp.'">Ваша почта</a><br/>';
echo '<a href="enter.php?'.$wp.'">Пpuxoжaя</a><br/>';
echo $fsize2;
mysql_close ($link);
echo foot;
} else {
if($row['level']<2) {
echo head;
if ($vv!=0) echo '<div class="d0"><b>Ошибка!</b></div>';
else echo "<card id="done" title="Ошибка" ontimer="chatmail.php?$wp"><timer value="15"/><p>";
echo $fsize1;
echo '<b>Вы пока не можете делать рассылки!</b><br/>';
echo '<a href="chatmail.php?'.$wp.'">Ваша почта</a><br/>';
echo '<a href="enter.php?'.$wp.'">Пpuxoжaя</a><br/>';
echo $fsize2;
echo foot;
mysql_close ($link);
exit;
} else {
if ($row['translit']==1) $topic = trun_to_rus($topic);
$fr = $row['friends'];
$time = time();
$data = date("H:i(d-M)");
$msg = $message;
if($row['level']>4){
$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);
}
require('smile.php');
$minpos = 1200;$nm = 1200;
for ($j=0;$j<=count($smiles)-1;$j++){
$tmpp = strpos($msg,$smiles[$j]);
if (($tmpp < $minpos)&&($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);
$message = $msg;
$alls="";
if (strpos ($fr,"|") !== false){
$s1 = substr($fr,0,strpos($fr,"|"));
while (strpos ($fr,"|") !== false){
$name = $s1;
$fr = substr ($fr, strpos($fr,"|")+1, strlen($fr)-strlen($s1)+1);
$s1 = substr($fr,0,strpos($fr,"|"));
$w = mysql_query("select id,user from users where user = '".$name."'");
if (mysql_affected_rows() == 0) continue;
$b = mysql_fetch_array($w);
$idtowhom=$b['id'];
$towhom=$b['user'];
$kol = rand(0,99999999);
mysql_query("Insert into zapiski set klu4='".$kol."', who ='".$us."', idwho ='".$id."', message = '".$message."', towhom = '".$towhom."', 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."$towhom, ";
}
}
echo head;
if ($vv!=0) echo '<div class="d0"><b>Отправлено!</b></div>';
else {
if ((isset($rm))&&($rm!="")) echo "<card id="done" title="Отправлено" ontimer="chat.php?$wp&rm=$rm"><timer value="15"/><p align ="center">";
else echo "<card id="done" title="Отправлено" ontimer="chatmail.php?$wp"><timer value="15"/><p>";
}
}
echo $fsize1;
echo 'Ваше письмо успешно отправлено следующим пользователям: '.$alls.'<br/>';
if (isset($rm)) echo "<a href="chat.php?$wp&rm=$rm">В чат</a><br/>";
echo '<a href="chatmail.php?'.$wp.'">Ваша почта</a><br/>';
echo '<a href="enter.php?'.$wp.'">Пpuxoжaя</a><br/>';
echo $fsize2;
echo foot;
mysql_close ($link);
}
?>