Сваляне на txt файл?

Код:
<?
$file = "http://web-tourist.net/text.txt";
$contents = file_get_contents($file);
$ex = explode("/",$file);
$cfile = fopen(end($ex), "w+");
$s = fwrite($cfile, $contents);
?>
 
Ама аз нещо като редирект ли как да го обесня..
Код:
<?php
include "config.php";
if (!isset($_GET['id']) || !is_numeric($_GET['id'])) { die ("Грешка"); }
$id = (int)$_GET['id'];
$nums = mysql_query("SELECT * FROM `asd` WHERE `id`='$id'");
while ($row = mysql_fetch_assoc($nums)) {
$url=$row[link];
$sql = "UPDATE `asd` SET downloaded=downloaded+1 where id='$row[id]'";
mysql_query($sql);
header("Location: $url");
}
?>
Сваля $url и под него ли .. не знам :?
 
Код:
$file = "test.txt";
header("Content-Disposition: attachment; filename=" . $file);
header("Content-Type: plain/text");
header("Content-Description: File Transfer");
header("Content-Length: " . filesize($file));
 

Back
Горе