Location: PHPKode > scripts > Linker IMG > linker-img/download.php
<?php

//=====================================
// LINKER Category Engine
//=====================================
// Filename : download.php
// Path  : Main directory
// last update : 2002/07/13
// Desc : Download file
//=====================================

//=====================================
// Info File include
//=====================================

include ("./function/base_info.php");
include ("./function/main_func.php");
include ("./function/$Sdb_type.php");


//=====================================
// DB_LAYER
//=====================================

$db = new DB_Sql($Sdb_host,$Sdb_user,$Sdb_pass,$Sselect_db);


//=====================================
// Get data
//=====================================

$temp_table = ($type =="wait") ? "LINKER_WAIT" : "LINKER_LINK";
$db->query("select upfile from $temp_table where sid='$sid'");

if ($db->numrow) $row = $db->nrecord();
$upfile = unserialize(stripslashes($row[upfile]));


if (file_exists("upfile/$upfile[1]")) {

$upfile[6] += 1;
$tmp_upfile = serialize($upfile);
if ($type <> "wait") $db->query("update LINKER_LINK set upfile='$tmp_upfile' where sid='$sid'");


//=====================================
// Print file
//=====================================

Header("Content-type: application/octet-stream"); 
Header("Content-Length: $upfile[2]"); 
Header("Content-Disposition: attachment; filename=$upfile[0]");
Header("Cache-Control:no-cache"); 

@readfile("upfile/$upfile[1]");


}

?>
Return current item: Linker IMG