View file moduls/favorit_add.php

File size: 1.34Kb
<?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']))
	 {
	      if (!empty($_POST['user_id']) && ($_POST['user_uid'] <> $_SESSION['auth_id']) && !empty($_POST['user_uid']))
	      {
	           if (mysql_num_rows(mysql_query("SELECT * FROM `q_favorits` WHERE `user_id` = '".function_sql($_POST['user_id'])."' AND `user_uid` = '".function_sql($_POST['user_uid'])."' LIMIT 1")) == 0)
		   {
		        if (mysql_query("INSERT INTO `q_favorits` (`user_id`, `user_uid`) VALUES ('".function_sql($_POST['user_id'])."', '".function_sql($_POST['user_uid'])."');")) echo 'В списке избранных [<a class="red" href="javascript:void(0)" title="Удалить из избранного" onclick="javascript:favorit_delete()">del</a>]';
		   }
	      }
	 }
?>