Redirect

From: Date: Mon, 08 Jan 2001 18:58:06 +0000
Subject: Redirect
Groups: php.general 
Request: Send a blank email to php-general+get-33281@lists.php.net to get a copy of this message
Is there a way to redirect to a physical path and not a virtual one? My goal is to make all our files for download not accessible from a direct URL. This would help prevent other sites from linking directly to files stored on my server... Example: /home/ftp/file.zip instead of http://www.combatfs.com/ftp/file.zip Below is an example of my code. It pulls info from the DB then adds +1 to count and redirects to the url for download. <?php $connection = mysql_connect ("localhost", "****", "*****"); if ($connection == false){ echo mysql_errno().": ".mysql_error()."<BR>"; exit; } $query = "select * from warbirds_db WHERE FileID ='$FileID'"; $result = mysql_db_query ("combatfs", $query); if ($result){ $numOfRows = mysql_num_rows ($result); for ($i = 0; $i < $numOfRows; $i++){ $FileID = mysql_result ($result, $i, "FileID"); $FileType = mysql_result ($result, $i, "FileType"); $FileURL = mysql_result ($result, $i, "FileURL"); $FileCount = mysql_result ($result, $i, "FileCount"); } $Count = ($FileCount + 1); $update_query = "UPDATE warbirds_db SET FileCount = '$Count' WHERE FileID = '$FileID'"; $update_result = mysql_db_query ("combatfs", $update_query); header("Location: http://www.combatfs.com/ftp/$FileType/$FileURL"); } else{ echo mysql_errno().": ".mysql_error()."<BR>"; } mysql_close (); ?>

« previous php.general (#33281) next »