Размер файла: 2.82Kb
<?php
include '../../config.php';
include '../../templates/run.php';
include '../../templates/func.php';
$title_page = 'Массовая рассылка монет';
$m_polozhenie = 'В админке';
include '../../themes/'.$themes.'.php';
if (isset($_SESSION['sespass']) && isset($passw) && $_SESSION['sespass'] == $passw && ($status == '1'))
{
$login_log = $login;
$login_in = "$_POST[login_in]";
$monets = "$_POST[monets]";
#$msg = "$_POST[msg]";
$msg = filter($_POST['msg']);
if ($login_in=="")
{
$err = "1";
}
if ($monets=="")
{
$err = "5";
}
if ($msg=="")
{
$err = "2";
}
if ($_POST[imgrand]=="")
{
$err = "3";
}
if ($_POST[imgrand]!="$_SESSION[rand]")
{
$err = "4";
}
if(!empty($err))
{
header ("Location: mail_monet.php?err=$err&".session_name()."=".session_id()."");
}
else
{
$ot_kogo = $login_in;
$date = date('d.m.Y / H:i:s', time() + ($sdvigclock*3600));
$msg = smiles($msg);
$msg = antimat($msg);
$msg = bbcodes($msg);
$msg = str_replace("\r\n", '<br />', $msg);
$file = @file('../../data/nicks.php');
array_splice($file, 0, 2);
array_splice($file, -2, 2);
$komu = $file;
for($i=0; $i <= sizeof ($komu); $i++)
{
if(file_exists('../../data/inbox/'.trim($komu[$i]).'.php'))
{
$inbox_f = @file('../../data/inbox/'.trim($komu[$i]).'.php');
$inbox_count = count($inbox_f) - 2;
if($inbox_count < $kolmesls + 2)
{
$mes_to_inbox_file = "$ot_kogo|$date|$msg|1\r\n";
for($iii=2;
$iii < $inbox_count;
$iii++)
{
$mes_to_inbox_file .= $inbox_f[$iii];
}
$mes_to_inbox_file = trim($mes_to_inbox_file);
write_to_file('../../data/inbox/'.trim($komu[$i]).'.php', "<?php\r\n/*\r\n$mes_to_inbox_file\r\n*/\r\n?>");
user_data('../../data/users/'.trim($komu[$i]).'.php');
$new_ls = $new_ls + 1;
$monet = $monet + $monets;
$str_to_user_file = str_user_data();
write_to_file('../../data/users/'.trim($komu[$i]).'.php', "<?php\r\n/*\r\n$str_to_user_file\r\n*/\r\n?>");
}
}
}
$date = date('d.m.Y / H:i:s', time() + ($sdvigclock*3600));
$adm_log_f = @file('../../data/adm_log.php');
$adm_log_count = count($adm_log_f) - 2;
$mes_to_adm_log = "$login_log|$date|Отправил сообщение с монетами в Массовой рассылке монет\r\n";
for($i=2; $i < $adm_log_count; $i++)
{
$mes_to_adm_log .= $adm_log_f[$i];
}
$mes_to_adm_log = trim($mes_to_adm_log);
$adm_log_file = fopen('../../data/adm_log.php','w');
flock ($adm_log_file,LOCK_EX);
fputs($adm_log_file,"<?php\r\n/*\r\n$mes_to_adm_log\r\n*/\r\n?>");
fflush ($adm_log_file);
flock ($adm_log_file,LOCK_UN);
fclose($adm_log_file);
header ("Location: mail_monet.php?mailing=1&".session_name()."=".session_id()."");
}
}
else
{
echo'<p class="err">Ошибка!!! Вы не авторизованы. Войдите в личный кабинет.</p>';
}
include '../../templates/foot.php';
?>