M
matibaski
Guest
Hallo, liebe Freunde.
Ich habe wieder einmal ein Problem mit PHP.
Für meine Seite machte ich ein Downloadportal, mit Login, usw.
Am Anfang sieht man alle Downloads in einer Liste, sowie die Anzahl aller Downloads, die online sind.
Wenn man einen Download anklickt, dann erscheint eine Beschreibung, und ein Link für den Download.
Dem Parser sage ich, dass er es downloaden soll, wenn download=xx erscheint. xx ist die ID der Downloads.
Doch da gibt es ein Problem:
Wenn man auf Download starten klickt, dann erscheinen folgende Fehler:
Also der Fehler ist irgendwo beim Header. Doch ich finde keinen. Ich hoffe, jemand kann mir helfen.
MfG, matibaski
Ich habe wieder einmal ein Problem mit PHP.
Für meine Seite machte ich ein Downloadportal, mit Login, usw.
Am Anfang sieht man alle Downloads in einer Liste, sowie die Anzahl aller Downloads, die online sind.
Wenn man einen Download anklickt, dann erscheint eine Beschreibung, und ein Link für den Download.
Dem Parser sage ich, dass er es downloaden soll, wenn download=xx erscheint. xx ist die ID der Downloads.
Doch da gibt es ein Problem:
Wenn man auf Download starten klickt, dann erscheinen folgende Fehler:
Hier ist mein Code:Warning: Cannot modify header information - headers already sent by (output started at /home/httpd/vhosts/paradoxe.de/subdomains/matibaski/httpdocs/MyB/_private/downloads.php:63) in /home/httpd/vhosts/paradoxe.de/subdomains/matibaski/httpdocs/MyB/_private/downloads.php on line 91
Warning: filesize() [webhosting24 - Login]: open_basedir restriction in effect. File(/_private/Downloads/MyB Admintool - V.2.zip) is not within the allowed path(s): (/home/httpd/vhosts/paradoxe.de/subdomains/matibaski/httpdocs:/tmp) in /home/httpd/vhosts/paradoxe.de/subdomains/matibaski/httpdocs/MyB/_private/downloads.php on line 93
Warning: Cannot modify header information - headers already sent by (output started at /home/httpd/vhosts/paradoxe.de/subdomains/matibaski/httpdocs/MyB/_private/downloads.php:63) in /home/httpd/vhosts/paradoxe.de/subdomains/matibaski/httpdocs/MyB/_private/downloads.php on line 93
Warning: Cannot modify header information - headers already sent by (output started at /home/httpd/vhosts/paradoxe.de/subdomains/matibaski/httpdocs/MyB/_private/downloads.php:63) in /home/httpd/vhosts/paradoxe.de/subdomains/matibaski/httpdocs/MyB/_private/downloads.php on line 96
Warning: readfile() [webhosting24 - Login]: open_basedir restriction in effect. File(/_private/Downloads/MyB Admintool - V.2.zip) is not within the allowed path(s): (/home/httpd/vhosts/paradoxe.de/subdomains/matibaski/httpdocs:/tmp) in /home/httpd/vhosts/paradoxe.de/subdomains/matibaski/httpdocs/MyB/_private/downloads.php on line 98
Warning: readfile(/_private/Downloads/MyB Admintool - V.2.zip) [webhosting24 - Login]: failed to open stream: Operation not permitted in /home/httpd/vhosts/paradoxe.de/subdomains/matibaski/httpdocs/MyB/_private/downloads.php on line 98
PHP:
if(!isset($_GET['show']))
{
// Auslesen der Einträge
$sql = "SELECT
Name,
Url,
Klicks,
Viesvs,
Inhalt,
ID
FROM
downloads
ORDER BY
ID DESC
";
$result = mysql_query($sql) OR die(mysql_error());
// Ausgeben der Anzahl von Einträgen
echo "Downloads gesamt: " . mysql_num_rows($result) . "</p><br /><br />\n";
// Titel der Downloads ausgeben
while($row = mysql_fetch_assoc($result))
{
echo "- <a href=\"index.php?site=downloads&show=".$row['ID']."\">".$row['Name']."</a><br />";
}
}
else
{
$sql = "SELECT
ID,
Name,
Url,
Inhalt,
Klicks
FROM
downloads
WHERE
ID = '".$_GET['show']."'
LIMIT 1;
";
$result = mysql_query($sql) OR die(mysql_error());
$row = mysql_fetch_assoc($result);
echo '<p><fieldset style="border:1px solid grey">';
echo '<legend>'.$row['Name'].'</legend>';
echo nl2br($row['Inhalt']).'<br />';
echo '<div style="width:100%; height:1px; border-top:1px solid black; border:0px;"></div><br />';
echo '<div style="float:left;">';
echo '<a href="index.php?site=downloads&show='.$row['ID'].'&download='.$row['ID'].'">Download hier</a></div>';
echo '</fieldset></p>';
echo '<p><a href="index.php?site=downloads">Zurück</a></p>';
// Download starten
if(isset($_GET['download']))
{
// Download auswählen
$sql = "SELECT
ID,
Name,
Klicks,
Url,
Inhalt
FROM
downloads
WHERE
ID = '".$_GET['download']."'
LIMIT 1;
";
$result = mysql_query($sql) OR die(mysql_error());
$row = mysql_fetch_assoc($result);
// Ausgabe des Downloads
$file = '/_private/Downloads/'.$row['Url'];
// Dateityp
header( 'Content-type: application/octet-stream' );
// Grösse der Datei
header( 'Content-Length: ' . filesize( $file ) );
// Dateiname
$dateiname = basename( $file );
header( 'Content-Disposition: attachment; filename="' . $dateiname . '"' );
// Ausgeben der Datei
readfile( $file );
}
}
MfG, matibaski