|
Posted by Toby Inkster on 10/11/05 10:02
Doug wrote:
> <!-- HTML page -->
> <a href="download.php?ver=2& file=somefile.exe?ver=2&
> name=somefile">somefile</a>
>
> <?php
> // This is download.php
> if (isset($_GET['ver']))
> {
> $vers = "{$_GET['name']}";
> require_once('./MyStuff/mysql_connect.php');
> $query2 = "INSERT INTO versiondl(Version, Date)
> VALUES('$vers', NOW())";
> $result = @mysql_query ($query2); // Run the query.
> $redirect = "./Download Files/{$_GET['file']}";
> header("Location: $redirect");
> }
> ?>
OK -- you should be able to cut that down and make it more efficient:
<!-- HTML page -->
<a href="download.php?file=somefile.exe&name=somefile">somefile</a>
<?php
// This is download.php
if (isset($_GET['name']))
{
require_once('./MyStuff/mysql_connect.php');
$query2 = sprintf("INSERT INTO versiondl(Version, Date)
VALUES('%s', NOW())", $_GET['name']);
$result = @mysql_query ($query2); // Run the query.
$redirect = "./Download Files/{$_GET['file']}";
header("Location: $redirect");
}
?>
That said, when you use a "Location" header, you should use a full,
absolute URL, including the "http://".
--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Navigation:
[Reply to this message]
|