File size: 1.76Kb
<?php
/**********************************************/
/* Автор скрипта: Александр Есин */
/* E-Mail: [email protected] ([email protected]) */
/* ICQ: 6464729 */
/* Site: http://ticlove.ru */
/**********************************************/
?>
<?php define ('SECURED', true); ?>
<?php require (dirname(__FILE__).'/../_inc/sql.php'); ?>
<?php require (dirname(__FILE__).'/../_inc/config.php'); ?>
<?php require (dirname(__FILE__).'/../_inc/function.php'); ?>
<?php
if (!empty($_SESSION['auth_id']) && (intval($_POST['user_id']) == $_SESSION['auth_id']))
{
$page = isset($_GET['page']) ? $_GET['page'] : NULL;
switch ($page)
{
case 'day':
if ($_POST['day_vip'] > 0) echo 'С Вашего счёта будет списано <span style="font-weight: bold; color: #ff6633;">'.(COST_VIP_DAY * $_POST['day_vip']).'</span> монет.';
break;
case 'activ':
$day = intval($_POST['day_vip']);
$user_id = intval($_POST['user_id']);
if ($day < 0 or $day > 10) $day = 0;
if ($day > 0 && $user_id > 0)
{
$sql = mysql_query("SELECT * FROM `q_users` WHERE `id_user` = '".$user_id."' LIMIT 1;");
$user_array = mysql_fetch_array($sql);
if ($user_array['balans'] < (COST_VIP_DAY * $day)) echo 'balans';
else
{
if (mysql_query("INSERT INTO `q_vip` (`id_user`, `time`) VALUES ('".$user_id."', '".(time() + ($day * 24 * 3600))."');") && mysql_query("UPDATE `q_users` SET `balans` = `balans` - '".(COST_VIP_DAY * $day)."', `vip_status` = '1' WHERE `id_user` = '".$user_id."';")) echo 'true';
}
}
break;
}
}
?>