<?php
/*
*----------------------------phpMyBitTorrent V 2.0-beta4-----------------------*
*--- The Ultimate BitTorrent Tracker and BMS (Bittorrent Management System) ---*
*--------------   Created By Antonio Anzivino (aka DJ Echelon)   --------------*
*-------------               http://www.p2pmania.it               -------------*
*------------ Based on the Bit Torrent Protocol made by Bram Cohen ------------*
*-------------              http://www.bittorrent.com             -------------*
*------------------------------------------------------------------------------*
*------------------------------------------------------------------------------*
*--   This program is free software; you can redistribute it and/or modify   --*
*--   it under the terms of the GNU General Public License as published by   --*
*--   the Free Software Foundation; either version 2 of the License, or      --*
*--   (at your option) any later version.                                    --*
*--                                                                          --*
*--   This program is distributed in the hope that it will be useful,        --*
*--   but WITHOUT ANY WARRANTY; without even the implied warranty of         --*
*--   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          --*
*--   GNU General Public License for more details.                           --*
*--                                                                          --*
*--   You should have received a copy of the GNU General Public License      --*
*--   along with this program; if not, write to the Free Software            --*
*-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA --*
*--                                                                          --*
*------------------------------------------------------------------------------*
*------              ©2005 phpMyBitTorrent Development Team              ------*
*-----------               http://phpmybittorrent.com               -----------*
*------------------------------------------------------------------------------*
*-----------------   Sunday, September 14, 2008 9:05 PM   ---------------------*
*/
include("header.php");
function begin_frame($caption = "-", $align = "justify"){

print("<br /><table cellpadding=0 cellspacing=0 border=0 width=95% align=center>\n"
		."\t<tr>\n"
		."\t\t<TD class=frame_top_left><img src=images/frame_top_left.gif></TD>\n"
		."\t\t<TD class=frame_top align=center><b>$caption</b></TD>\n"
		."\t\t<TD class=frame_top_right><img src=images/frame_top_right.gif></TD>\n"
		."\t</tr>\n"
		."\t<tr>\n"
		."\t\t<TD class=frame_middle_left><span class=space></span></TD>\n"
		."\t\t<TD class=frame_middle width=100% align=$align valign=top><br>");
}

//ATTACH FRAME
function attach_frame($padding = 0) {
    print("\n");
}

//END FRAME
function end_frame() {
print("\t\t</td>\n"
		."\t\t<td class=frame_middle_right><span class=space></span></TD></td>\n"
		."\t</tr>\n"
		."\t<tr>\n"
		."\t\t<td class=frame_bottom_left><span class=space></span></TD></td>\n"
		."\t\t<td class=frame_bottom></TD></td>\n"
		."\t\t<td class=frame_bottom_right><span class=space></span></TD></td>\n"
		."\t</tr>\n"
		."</table>");
}

function bark($heading = "Error", $text, $sort = "Error") {
  OpenTable("$sort: $heading");
  begin_frame("<font color=red>$sort: $heading</font>", center);
  echo $text;
  end_frame();
  closeTable();
  die;
}

$id = $_POST["offerid"];
$res = mysql_query("SELECT userid, name from ".$db_prefix."_offers where id=$id");
$row = mysql_fetch_array($res);
if (getuserid($btuser) != $row["userid"] &&  !$user->admin )
bark("You`re not the owner");
else {
mysql_query("DELETE FROM ".$db_prefix."_offers WHERE id=$id");
mysql_query("DELETE FROM ".$db_prefix."_offervotes WHERE offerid=$id");
mysql_query("DELETE FROM ".$db_prefix."_comments WHERE offer=$id AND torrent=0");
if (getuserid($btuser) != $row["userid"]){
$msg = "Your offer $row[name] was deleted by ".$user->name."";
$added = sqlesc(get_date_time());
$userid = $row["userid"];
mysql_query("INSERT INTO messages1 (sender, receiver, `msg`, added) VALUES(0, $userid, $msg, $added)") or sqlerr(__FILE__, __LINE__);}

header("Refresh: 0; url=offers.php");
}
?>
