I have a file which reads how many uploads a user has. Then it has to give a link to
another file which allows him to download the file but there's my problem. When I used these files as just files which weren't included into index page (to use ?id=page browsing) they worked fine but now when they are included they don't work at all.
I'll give you the code for them so you can see what I have.
Download.php
//start of php
$getdownloads = mysql_query("SELECT * FROM downloads WHERE `userid` = '".$_SESSION['id']."' ORDER BY id DESC");
while($row = mysql_fetch_assoc($getdownloads))
{
print(" <div id=\"download\">
<a href=\"?i=dlfile&id=$row[id]\">$row[title]</a> - Downloaded $row[count] Times <br>
<img src=\"http://upload.snowmoon.uni.cc/image/$row[id].png\"><br>
<input size=\"60\" value=\"http://upload.snowmoon.uni.cc/image/$row[id].png\" style=\"font-size: 7pt;\" onclick=\"selectAll(this);\" type=\"text\"></div><br>");
}
//end of php
This gets the file info and puts it in links. When I didn't include them into index page the link was downloadfile.php?&id=fileid but now none of ways I've tried don't work so this was the most right way to do it in my opinion.downloadfile.php
include "config.php";
$x ="SELECT * from downloads where id='$id'";
$result = mysql_query($x) or die
("Could not execute query : $x." . mysql_error());
while ($row = mysql_fetch_array($result))
{
$id = $row["id"];
$FileURL = $row["url"];
$Count = $row["count"];
header('Location: '.$FileURL);
$x ="update downloads set Count=Count+1 where id='$id'";
$result = mysql_query($x) or die
("Could not execute query : $x." . mysql_error());
}
This gets the file url, increases the download count and gives the file for download.I think the problem is where it has to get the id from url. But thats what I think.
Any ideas?
Thanks, Matt.
