<?php
include("postget.php");
include_once("common.php");
checklevel(4,$_REQUEST['clientid']);
if(!$id){print("No ID Specified.");exit();}
if($choice=='yes') {

	$query = "SELECT * FROM hd_downloads WHERE id='".$id."'";
	$result = mysql_query ($query);
	$data = mysql_fetch_array ($result);
	$order = $data['position'];
	$query = "UPDATE hd_downloads SET position = position-1 WHERE position >'".$order."'";
	$result = mysql_query ($query);

	$query = "DELETE FROM hd_downloads WHERE id='".$id."'";
	if(!mysql_query($query,$db_link)){
		messagetop(_ERROR,mysql_error(),'downloads_admin.php',0); 
	}else{
		if ($config[56][1]==0){
			@unlink($config[75][1].'/'.$data[file]);
		}
		messagetop(_THE_CHANGES_WHERE_MADE_SUCCESSFULLY,'','downloads_admin.php',1);
	}

}else{
	
	include("head_template.php");
	echo '
<div class="container">
	<div class="row">


<table width="98%" class="table table-bordered">
		<tr>
		<td align="center" width="100%">
';
	echo ucfirst(_DOWNLOADS);
echo '
		</td>
		</tr>
';	
echo '
			<tr valign="top">
				<td>

';


	print("<br><table cellspacing='0' cellpadding='0' border='0'><tr>");

	redbutton("downloads_delete.php?id=".$id."&choice=yes",_DELETE." ".substr($text,0,10)."");
	yellowbutton("downloads_admin.php",_RETURN);
	
	print("</tr></table>");

echo '
		</td>
		</tr>
		</table>
</div>
</div>
';
	include("foot_template.php");
}

?>