mydog
-
Posts
2 -
Joined
-
Last visited
Never
Posts posted by mydog
-
-
I've been trying to get this to work for some time actually.. And it doesn't want to work it seems. OH and I am very new to this site, and PHP. I know the basics of it though.
[code]<head>
<title>Downloading $file</title>
<?php
/*make sure you change all links to this page to download.php?file=none or it will try to find a file*/
$id=$_GET['id']; //this will get the file in the url
switch (id){
case 0:$dl=minigame.exe;break;
};
{
//redirect the page to the file in 1 second
echo '<meta http-equiv="refresh" content="1;url=$dl";>';
//this will add 1 to the downloads
$f=fopen('downloads.txt',"r");
$num=fread($f,filesize('downloads.txt'));
fclose($f);
$num++;
$f=fopen('downloads.txt',"w");
fwrite($f,$num);
fclose($f);
}
?>
</head>[/code]
I have tried many variations and I put in the switch statement myself to see if it would work.. and it didn't. The problem here is that when it goes to get the file, it returns $dl in the address bar. When it should be the file. Thanks in adv. If I'm breaking any rules sorry I'm new ;)
PHP Problems :(
in PHP Coding Help
Posted