View file moduls/photo_my_delete_comm.php

File size: 2.51Kb
<?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']))
	 {
	      $cid = intval($_POST['cid']);
	      $sql = mysql_query("SELECT * FROM `q_photo_comm` WHERE `id_comm` = '".$cid."' AND `uid_user` = '".$_SESSION['auth_id']."' LIMIT 1;");
	      $arr_comm = mysql_fetch_array($sql);
	      
	      $page = isset($_GET['page']) ? $_GET['page'] : NULL;
	      switch($page)
	      {
	      case 'update':
	      mysql_query("UPDATE `q_photo` SET `all_comm` = `all_comm` - '1' WHERE `id_photo` = '".$arr_comm['id_foto']."';");
	      if (mysql_query("DELETE FROM `q_photo_comm` WHERE `id_comm` = '".$cid."' AND `uid_user` = '".$_SESSION['auth_id']."';")) echo '<div>Комментарий удален!</div>';
	      break;
	      
	      default:
	      ?>
	      <div class="box_bg" style="width: 350px;">
	      <div class="box_title">
	      <div class="left" style="padding-top: 2px; padding-left: 10px;">Удалить комментарий</div><div class="box_close right b-modal_close arcticmodal-close"></div>
	      </div>
	      <div class="clear"></div>
	      <div class="box_conetnt">
	      <div style="padding: 10px;">
	      <div id="photo_del_comm_status">
	      <div>Вы действительно хотите удалить этот комментарий?</div>
	      <div style="padding: 10px 0;">
	      <?php echo function_smile(htmlspecialchars(function_bigword($arr_comm['msg'], 45), ENT_QUOTES)); ?>
	      </div>
	      <div style="padding-bottom: 10px; text-align: center;">
	      <input type="submit" class="submit" onclick="javascript:photo_delete_comm_update('<?php echo $cid; ?>')" value="Удалить" />
	      </div>
	      </div>
	      </div>
	      <div class="box_footer">
	      <div class="right"><button class="submit_red b-modal_close arcticmodal-close">Отмена</button></div>
	      </div>
	      <div class="clear"></div>
	      </div>
	      <?php
	      break;
	      }
	 }
?>