<?php
/*
*
* @author (Макс) Freedom <by_freedom@bk.ru>
* ICQ 286-0-666
*
*/
func::head($lang['delete_file']);
echo '<div class="container">';
$code = isset($_GET['code']) ? func::check($_GET['code']) : false;
if (empty($code)) {
header ('location: /');
die();
}
$query = DB::$dbs->query("SELECT * FROM `files` WHERE `code_del`= ? LIMIT 1", array($code));
if ($query -> rowCount () == 0) {
header ('location: /');
die();
}
$a = $query->fetch();

if ($a['code_del'] != $code) {
header ('location: /');
die();
}
if (isset($_GET['ok'])) {
unlink($_SERVER['DOCUMENT_ROOT'].'/'.$a['url']);
DB::$dbs->query("DELETE FROM files WHERE id = ?", array($a['id']));
func::msg($lang['ok_del'].'!');
func::foot();
die();
}
echo '<div class="form-group">'.$lang['delete_file'].'?<br/><a href="/delfile/'.$a['code_del'].'?ok">'.$lang['oks'].'</a> | <a href="/'.$a['id'].'">'.$lang['nots'].'</a></div>';
echo '</div>';
func::foot();
?>