Ah ... got that fixed ... now I just have one more ... hopefully only one more ... problem. I've never been quite sure on how to pull in a URL variable without having a pre-defined array. I'm having a problem getting it in, because my normal methods of $name=$_GET['name'] aren't working. Well, here's the script if you think you can help. $name is passed in through the url, and is used to find the filename via a MySQL database, with fields 'id', 'name', and 'file.'
<?php
/*************************************
* FetchIt v0.1 *
* by Nite Phire *
* ================================== *
* [url]http://dissonance.ketsukaiten.net/[/url] *
* [email]nitephire@ketsukaiten.net[/email] *
*************************************/
// Pulls in config file.
include ($_SERVER['DOCUMENT_ROOT'] . '/fetchconfig.php');
// Connects to MySQL.
$connect = mysql_connect ($mysqlhost, $mysqluser, $mysqlpassword)
or die ("Wrong host, username, or password.");
mysql_select_db ($database)
or die ("Could not select database.");
$name = $_GET['name'];
$query = mysql_query ('SELECT * FROM ' . $tableprefix . 'fetchit WHERE name="' . $name . '"');
$info = mysql_fetch_assoc ($query);
$file = $info['file'];
$downloads = ($info['downloads']+1);
mysql_query ('UPDATE ' . $tableprefix . 'fetchit SET downloads="' . $downloads . '"
WHERE name="' . $name . '"')
or die ('Could not update download information.');
// Tells them its getting it and redirects them to the file.
print ('<head>
<meta http-equiv="refresh" content="3; url=' . $file .'" />
</head>
<body>
Retrieving file from server...<br />
<br />
If this is taking too long, click <a href="' . $file . '">here</a>
</body>');
// Closed connection.
mysql_close ($connect);
?>