View file moduls/top.php

File size: 1.24Kb
<?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']))
	 {
	      $user_id = intval($_POST['user_id']);
	      if (!empty($user_id))
	      {
	           $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_UP_ANKETA) echo 'balans';
	           else
	           {
	                if (mysql_query("UPDATE `q_users` SET `top_search` = '".time()."', `top_up` = '".time()."' WHERE `id_user` = '".$user_id."';") && mysql_query("UPDATE `q_users` SET `balans` = `balans` - '".COST_UP_ANKETA."' WHERE `id_user` = '".$user_id."';")) echo 'ok';
	           }
	      }
	 }
 ?>