<?php

include('functions.php');
include('db.inc.php');

if($round) {

	$mydb = new db();

	$stmt="SELECT file_name FROM kk_upload WHERE id='$id'";
	$result=$mydb->query($stmt);
    $row = mysql_fetch_object($result);

    $file_name = $row->file_name;


	$stmt="DELETE FROM kk_upload WHERE id='$id'";
	$result=$mydb->query($stmt);

    $s_dir = '/var/www/vhosts/konyvel.net/httpdocs/admin/upload/';
    unlink($s_dir.$file_name);

	header("Location:a_upload.php");

} else {

$title="torles";

	include('header.inc.php');

	$mydb = new db();

	$stmt="SELECT * FROM kk_upload WHERE id='$id'";

	$result=$mydb->query($stmt);

	printf("<H3>Törlés?</H3>");


	while($row = mysql_fetch_object($result)){

		for($field_index=0; $field_index<mysql_num_fields($result); $field_index++){
			$field_name=mysql_field_name($result, $field_index);
			$data[$field_name]=$row->$field_name;
		}

		generate_html_form('upload', $data, $PHP_SELF);
	}

	include('footer.inc.php');

}

?>