View file modules/pages/delete.php

File size: 1.35Kb
<?php
$title_main = $lang['deleting_file'].' - GOload '.$lang['title'];
require_once SYS.'/header.php';

$id = abs(intval($_GET['id']));
$file = $db->query('SELECT * FROM `file` WHERE `id` = '.$id)->fetch_assoc();

if (!isset($admin) && $file['user'] != $user['id'] or $file == 0) {
	go('/');
}

if (isset($_REQUEST['da'])) {
	$db->query('DELETE FROM `file` WHERE `id` = '.$id);
	$db->query('DELETE FROM `komm` WHERE `file` = '.$id);
	unlink(H.'/files/'.$file['file']); 
	go('/file');
}

echo '
	  <div class="block col-md-8">
		 <h6 class="round_title">
			<a class="left" onclick="window.history.back();">
			   <img src="/assets/img/left.svg" alt="back">
			</a>
			<div class="title back"><a href="/">'.$title.'</a> | '.$lang['deleting_file'].'</div>
		 </h6>

		 <div class="delete-alert-body">
			<div class="delete-alert-question">'.$lang['delete_file'].'?</div>
			<div class="delete-alert-option-body">
			   <button type="button" class="del-but">
				  <a class="del-but-opt" href="/file'.$id.'">'.$lang['cancel_btn'].'</a>
			   </button>
			   <button type="button" class="del-but">
				  <a href="?da" class="del-but-opt">'.$lang['delete_btn'].'</a>
			   </button>
			</div>
		 </div>
	  </div>
';
echo '
	  <div class="block col-md-8">
		 <div class="title">'.$lang['nav'].'</div>
		 <div class="link">
			<a href="/">'.$lang['go_home'].'</a>
		 </div>
	  </div>

';

?>