View file profile/present_del.php

File size: 805B
<?php
require_once $_SERVER['DOCUMENT_ROOT']."/includes/start.php";
if(isset($_SESSION['auth']) and $_SESSION['auth']==1){
echo $_up;

$id = $_GET['id'];

if(eregi("[^0-9]" , $_GET['id'])){

header ("Location: /profile/?"); exit;

}


$query = mysql_fetch_assoc(mysql_query("SELECT `id` FROM `presents` WHERE `id`='$id'"));
if(!$query){
header ("Location: /profile/?"); exit;
}

$present = mysql_fetch_assoc(mysql_query("SELECT `id_user` FROM `presents` WHERE `id`='$id'"));

if($present['id_user']=='' or $present['id_user']!==$usr['id']){

header ("Location: /profile/presents.php?"); exit;

}

mysql_query("DELETE FROM `presents` WHERE `id` = '$id'");

header ("Location: /profile/presents.php?"); exit;

echo $_down;

}else{

header ("Location: ?"); exit;

}

?>