huhu ich hätt da mal nen problem:
<?php
// (c) 2005 by user-182
// http://FrankyOnline.de/
// Dieser Vermerk darf nicht entfernt werden
function dlfile($file, $filename=''{
GLOBAL $_SERVER;
// Get filename
if(empty($filename)) $filename = basename($file);
// Convert filename
$translate = array('ß' => 'ss', 'ä' => 'ae', 'ö' => 'oe', 'ü' => 'ue', 'Ä' => 'Ae', 'Ö' => 'Oe', 'Ü' => 'Ue';
foreach($translate as $char => $trans) $filename = str_replace($char, $trans, $filename);
$filename = preg_replace('/[^a-z0-9_\-@. ]{1}/i', '_', $filename);
// Get Browser
if(preg_match('/MSIE [0-9]\.[0-9]/', $_SERVER['HTTP_USER_AGENT'])) $browser = 'ie';
elseif(preg_match('/Opera\/[0-9]\.[0-9]/', $_SERVER['HTTP_USER_AGENT'])) $browser = 'opera';
else $browser = 'unknown';
// Get Filesize
$filesize = (@filesize($file))?filesize($file):'';
// Send header
header('Content-Type: '.(($browser=='ie'||$browser=='opera'?'application/octetstream':'application/octet-stream');
header('Content-disposition: '.(($browser=='ie'?'inline':'attachment'.'; filename="'.$filename.'"';
if(isset($filesize)) header('Content-Length: '.$filesize);
if($browser == 'ie' header('Pragma: public';
else header('Pragma: no-cache';
header('Expires: 0';
// Read file
if($fp = fopen($file, 'r'){
while(!feof($fp)) echo fgets($fp, 4096);
fclose($fp);
}else echo 'Error while reading';
}
include("../*****<- db halt"
$abfrage = "SELECT * FROM galerie WHERE id='".$_GET['ordner']."'";
$ergebnis = mysql_query($abfrage) or die( mysql_error() );
while ($obj = mysql_fetch_array($ergebnis)){
$abfrage = "SELECT * FROM bild WHERE id='".$_GET['id']."'";
$ergebnis = mysql_query($abfrage) or die( mysql_error() );
while ($row = mysql_fetch_array($ergebnis))
{
$downloads = $row[downloads]+1;
$eintrag = "UPDATE bild SET downloads = $downloads WHERE id = '".$_GET['id']."'";
$eintragen = mysql_query($eintrag) OR die(mysql_error());
dlfile('bilder/$obj[ordnername]/$row[bild]';
}
}
?>
hab auch ma probiert das ich in dlfile nen richtigen dateinamen angegeben hab aber trotzdem kommt (also mit richtigen dateinamen die letzten 2 fehler nicht)
Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/xxx/httpdocs/xx/xxx/bild_downloaden.php:1) in /var/www/vhosts/xxx/httpdocs/xx/xxx/bild_downloaden.php on line 26
Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/xxx/httpdocs/xx/xxx/bild_downloaden.php:1) in /var/www/vhosts/xxx/httpdocs/xx/xxx/bild_downloaden.php on line 28
Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/xxx/httpdocs/xx/xxx/bild_downloaden.php:1) in /var/www/vhosts/xxx/httpdocs/xx/xxx/bild_downloaden.php on line 29
Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/xxx/httpdocs/xx/xxx/bild_downloaden.php:1) in /var/www/vhosts/xxx/httpdocs/xx/xxx/bild_downloaden.php on line 31
Warning: fopen() [function.fopen]: Unable to access bilder/$ordnername/$row[bild] in /var/www/vhosts/xxx/httpdocs/xx/xxx/bild_downloaden.php on line 34
Warning: fopen(bilder/$ordnername/$row[bild]) [function.fopen]: failed to open stream: No such file or directory in /var/www/vhosts/xxx/httpdocs/xx/xxx/bild_downloaden.php on line 34
Error while reading
sieht jemand nen fehler? Vielen user-158k und Liebe Grüße
//achja und wie kann ich am besten machen das ich in der klammer dlfile() auch variablen nutzen kann? oder soll ich einfach die funktion auflösen und es so nutzen?