Hallo!
Wollte ein PHP-Script zum Dateidownload (Quelle+Anleitung: trimr.de/1576) auf meiner Website einbauen, doch es kommt diese Fehlermeldung: Parse error: syntax error, unexpected '&', expecting '(' in /users/hugoheim/www/others/omsi/downloads.php on line 3
Hier noch der Code:
[code]<?php
$Datei = array();
$Datei[1] = "bild1.jpg";
$Datei[2] = "bild2.jpg";
$Datei[3] = "word.doc";
$Datei[4] = "bild4.jpg";
$ERR = "ERROR: Die gesuchte Datei befindet sich nicht (mehr) im Download-Verzeichnis!";
extract($_GET);
$Verzeichnis = "./downloads/";
$Down_Name = $Datei[$file];
$Down_File = $Verzeichnis.$Datei[$file];
if(!file_exists($Verzeichnis.$Down_Name)||!$Down_Name)
{
echo "
<script type='text/javascript' language='JavaScript'>
<!--
alert('$ERR');
//-->
</script>
";
exit;
}
$size = filesize($Down_File);
clearstatcache();
$Countverz = $Verzeichnis."counter";
$GS = 0;
if(!is_dir($Countverz)) mkdir("$Countverz",0777);
$DownStat = "$Countverz/DownStat.txt";
if(!file_exists($DownStat))
{
$fp = fopen($DownStat,"a");
fputs($fp,"Gesamt:0\n");
fclose($fp);
}
$DownStatfile = file($DownStat);
$found = 0;
for($i=0;$i<count($DownStatfile);$i++)
{
list($D,$C) = split(":",chop($DownStatfile[$i]));
if($D == "Gesamt") continue;
if($D == $Datei[$file])
{
$C++;
$found = 1;
}
$SP = "$D:$C\n";
$GS = $GS + $C;
}
if(!$found) $SP .= $Datei[$file].":1\n";
$SP .= "Gesamt:$GS\n";
$fp = fopen($DownStat,"w");
flock($fp,2);
fputs($fp,$SP);
flock($fp,3);
fclose($fp);
header("Content-type: application/octet-stream");
header("Content-disposition: attachment; filename=".$Down_Name);
header("Content-Length: $size");
header("Pragma: no-cache");
header("Expires: 0");
readfile($Down_File);
close();
?>[/code]
Vielen Dank für jede Hilfe die kommt
Jakob