View file adm_panel/sends.php

File size: 3.46Kb
<?
//17.06.14
//by Saint (dcms-fiera)
/*
- Спецом для : 

- Незнакомка19
- VENERA

- For Social 
- time() = 600 
*/



//название столбцов в таблице
//баллы
$tab_balls = 'balls';
//монеты
$tab_money = 'money';
//рейтинг
$tab_rating = 'rating';




//обьявляем константу
define('H', $_SERVER['DOCUMENT_ROOT'].'/');

//подключаем файлы ядра
foreach (array('start', 'compress', 'sess', 'settings', 'db_connect', 'ipua', 'fnc', 'user') as $inc) 
require_once H."sys/inc/{$inc}.php";

 



//Для гл.админов и выше ,если нет выкидываем
if ( $user['level']  < 3)
exit(header('Location: /'));

$set['title']='Рассылка рессурсов';
include_once H.'sys/inc/thead.php';
title();
aut();

//встраиваем дизайн 
?>
<style>
.form_a{
    border: 1px #dcdcdc solid;
	padding: 10px;
	width: 95%;
	border-radius: 6px;
	-moz-border-radius: 6px;
}
.form_a_bottom{
	padding: 10px;
	width: 98%;
	border: 1px solid #fff;
	border-radius: 6px;
	-moz-border-radius: 6px;
	background: #FF982A;

}
.form_a_bottom{
	background: #5EB8FE;
	padding: 10px;
	width: 98%;
	border: 1px solid #fff;
	border-radius: 6px;
	-moz-border-radius: 6px;
}

.form_a_
{
	border: 1px solid #F0F0F0;
	padding: 10px;
	background: #fff;
}
.inp{
    border: 1px #dcdcdc solid;
	padding: 10px;
	width: 95%;
	border-radius: 6px;
	-moz-border-radius: 6px;
}
</style>
<?






if (isset($_POST['save']) and isset($_POST['msg']))
{

//фильтруем сообщение
$msg = mysql_escape_string($_POST['msg']);

//фильтруем отправителя
$id_kont = 	(int) $_POST['id_kont'];
$balls   = 	(int) $_POST['balls'];
$money   = 	(int) $_POST['money'];
$rating  = 	(int) $_POST['rating'];

$id_user = 0;


//всякие проверки
if (strlen2($msg) > 999 )	 $err='Сообщение превышает 999 символа';
if ($id_kont < 0 )	 		 $err='Слишком короткий ID отправителя';
if ($balls < 0 )	  		 $err='Слишком малов баллов';
if ($money < 0 )			 $err='Слишком малов монет';
if ($rating < 0 ) 	 		 $err='Слишком малов рейтингa';

 

if (!isset($err))
{


if ($msg != null)
mysql_query("INSERT INTO `mail` (`id_user`, `id_kont`, `msg`, `time`) values('". $id_user ."', '".$id_kont."', '".$msg."', '".time()."')");
 
$us = get_user($id_kont);

mysql_query("UPDATE `user` SET 
`$tab_balls` = '".($us[$tab_balls] + $balls)."',
`$tab_rating` = '".($us[$tab_rating] + $rating)."',
`$tab_money` = '".($us[$tab_money] + $money)."' 
WHERE `id` = '". $us['id'] ."' LIMIT 1");
exit(header('Location: ?msg_yes'));
}

if (isset($_GET['msg_yes'])) msg('Все ок :)))');
 

}
//вывод ошибок если таковые есть)
err();

//Форма ввода
echo"
<div class='form_a_'>
<form method='post' action=''>
Сообщение:<br /><textarea name='msg' class='form_a'></textarea><br />
Кому -> [id]:<br /><input type='text' name='id_kont' value='1' class='inp'/><br />


Баллы :<br /><input type='text' name='balls' value='0' class='inp'/><br />
Монеты :<br /><input type='text' name='money' value='0' class='inp'/><br />
Рейтинг :<br /><input type='text' name='rating' value='0' class='inp'/><br />


<input value='Отправить' name='save' type='submit' class='form_a_bottom'/>
</form>
<a href='//dcms-fiera.ru/id1619'>by Saint</a>

</div>
";
 

 

include_once H.'sys/inc/tfoot.php';