<?php
include("db_functions.inc.php");
include("config.inc.php");
$get_id = intval($_GET['id']);
$select_link = yasDB_select("SELECT `id`, `file` FROM `downgames` WHERE `id` = $get_id");
if($select_link->num_rows == 1) {
	$result = $select_link->fetch_array(MYSQLI_ASSOC);
	$file = str_replace("../ourgames/games/", "", $result['file']);
	$file = str_replace(" ", "", $file);
	yasDB_update("UPDATE `downgames` SET `downloadtimes` = `downloadtimes` + 1 WHERE id = {$result['id']}");
	header("Cache-Control: public");
    header("Content-Description: File Transfer");
    header("Content-Disposition: attachment; filename=".$file);
    header("Content-Type: application/zip");
    header("Content-Transfer-Encoding: binary");
	//ob_clean();
	//flush();
	readfile($result['file']);
}
$select_link->close();
?>