Hallo,
bei meinem Script tritt folgender Fehler auf: Wenn ich eine Datei downloaden möchte und auf einem Link klicke, bekomme ich folgende Meldung:
Warning: filesize(): Stat failed for ./gH34i7Uu89d9Siutf53gHuik/JUMANJI_06.01.29_20-15_sat1_120_TVOON_DE.wmv.otrkeyPolizeiruf_110_06.01.20_21-45_ard_90_TVOON_DE.wmv.otrkeyPolizeiruf_110_06.01.29_20-15_ard_90_TVOON_DE.wmv.otrkeyWetter_06.01.27_22-58_ard_2_TVOON_DE.wmv.otrkeyC_S_I__Miami_06.02.14_20-15_rtl_60_TVOON_DE.wmv.otrkeyDie_Super_Nanny_06.02.01_20-15_rtl_60_TVOON_DE.wmv.otrkeyDoppelter_Einsatz__Verraten_und_verkauft_06.02.02_20-15_rtl_120_TVOON_DE.wmv.otrkey (errno=36 - File name too long) in /var/www/vhosts/otrplanet.com/httpdocs/otrportal/download.php on line 33
Anstatt, dass eine Datei drinsteht, werden gleich mehrere dort eingefügt, was nicht sein soll.
Im Folgenden das Script von der downloads.php:
<?php
$directory = "./otrportal/gH34i7Uu89d9Siutf53gHuik/";
// DB COnnect
$dbConnect = mysql_connect("localhost", "BENUTZERNAME", "PASSWORT");
mysql_select_db('OTR_1', $dbConnect);
$sql = "select * from otr";
$handle=opendir ($directory);
$datum = array();
echo "<h3> The following files were found:</h3> \n\r"; while (false !==
($file = readdir ($handle))) {
if (substr ($file, strlen($file)-6, strlen($file)) == "otrkey"){
$temp=date ("d.m.Y", filemtime($directory.$file));
array_push($datum, $temp);
if (!isset($$temp)){
$$temp=array();
}
array_push($$temp, $file);
}
}
closedir($handle);
rsort($datum);
$datum=array_unique($datum);
foreach($datum as $tag){
echo "<h3> $tag</h3> \n";
sort($$tag);
echo "<ul> \n";
foreach ($$tag as $file){
$n = 0;
while($n < strlen($file)){
$fileName .= chr(ord( substr($file, $n, 1))+4);
$n++;
}
echo "<li> <a href='./otrportal/download.php?f=".urlencode($fileName)."'>".$entry."
$file (size:".sprintf("%01.2f", (filesize($directory.$file)/1024/1024))."mb )</a> </li> \n";
}
echo "</ul> \n";
}
echo "<br/> Delivered ".$row['downloads']." files with
".sprintf("%01.2f", ($row['bytes']/1024/1024))." mb this hour.<br/>
\n";
@mysql_close($dbConnect);
echo '</body> </html> ';
?>
Nun der Inhalt von der download.php:
<?php
/******** myOTR **********/
// text text text
// text text text
// text text text
// text text text
/******** SET HERE YOUR SECRET PATH TO THE OTRKEY FILES *******/
$secretFolderPath = './gH34i7Uu89d9Siutf53gHuik/'; // e.g. './mySecretFolder/' //do NOT forget the last slash /
setlocale(LC_TIME, "de_DE");
/******** END OF USER CONFIGURATION SETTINGS ******************/
/******** BUT DO NOT CHANGE ANYTHING BELOW HERE!! ***********************************************/
$fp = @fopen("./mbpermonth.txt", "r");
$trafficLimit = @fgets($fp);
@fclose($fp);
$string = urldecode($_REQUEST['f']);
while($n < strlen($string)){
$fileName .= chr(ord( substr($string, $n, 1))-4);
$n++;
}
if(filesize($secretFolderPath.$fileName) < 1){ exit; }
//nochmal zur doppelten sicherheit lokal den traffic zaehlen
$fileSize = (integer)round(( @filesize($secretFolderPath.$fileName) / pow( 4, 10 )));
//if next day, reset traffic limit
if(date("j", (@filemtime("./traffic.txt")-3600)) < date("j", time())){
//write daily log file
$fp = @fopen("./traffic.txt", "w+");
$log = @fgets($fp);
@fputs($fp, "0");
@fclose($fp);
$logString .= date("l, j.F y", time() - 82800).";".$log."\n";
$fp = fopen("trafficLog.csv", "w+");
$log = @fgets($fp);
fputs($fp, $log.$logString);
fclose($fp);
//delete traffic of today
//@unlink("./traffic.txt");
}
if(@file_exists("./traffic.txt")){
$fp = @fopen("./traffic.txt", "r+");
$count = @fgets($fp);
@fclose($fp);
if($trafficLimit != 0 && ($fileSize + $count) > ($trafficLimit/date("t", time()))){
echo "Sorry, daily traffic limit of this server is exeeded";
exit;
}
}else{ $count = 0; }
$count = $count + $fileSize;
$fp = @fopen("./traffic.txt", "w");
@fputs($fp, $count);
@fclose($fp);
//start download
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header('Content-Description: File Transfer');
header('Content-Type: application/otrkey');
header('Content-Length: '.@filesize($secretFolderPath.$fileName));
header("Content-Disposition: attachment; filename=".$fileName);
header("Content-Transfer-Encoding: binary");
@readfile($secretFolderPath.$fileName);
//for future versions, just leave it as it is
//create link to file
/*$time = time();
if(!is_dir("./tmp/")){
mkdir("./tmp/", 0777);
}
mkdir("./tmp/".$time, 0777);
symlink($_SERVER['DOCUMENT_ROOT']."/".$secretFolderPath.$fileName, "./tmp/".$time."/".$fileName);
header("Location: ./tmp/".$time."/".$fileName); */
?>
Ich hoffe, dass mir einer weiterhelfen kann.
Gruß Stefan
bei meinem Script tritt folgender Fehler auf: Wenn ich eine Datei downloaden möchte und auf einem Link klicke, bekomme ich folgende Meldung:
Warning: filesize(): Stat failed for ./gH34i7Uu89d9Siutf53gHuik/JUMANJI_06.01.29_20-15_sat1_120_TVOON_DE.wmv.otrkeyPolizeiruf_110_06.01.20_21-45_ard_90_TVOON_DE.wmv.otrkeyPolizeiruf_110_06.01.29_20-15_ard_90_TVOON_DE.wmv.otrkeyWetter_06.01.27_22-58_ard_2_TVOON_DE.wmv.otrkeyC_S_I__Miami_06.02.14_20-15_rtl_60_TVOON_DE.wmv.otrkeyDie_Super_Nanny_06.02.01_20-15_rtl_60_TVOON_DE.wmv.otrkeyDoppelter_Einsatz__Verraten_und_verkauft_06.02.02_20-15_rtl_120_TVOON_DE.wmv.otrkey (errno=36 - File name too long) in /var/www/vhosts/otrplanet.com/httpdocs/otrportal/download.php on line 33
Anstatt, dass eine Datei drinsteht, werden gleich mehrere dort eingefügt, was nicht sein soll.
Im Folgenden das Script von der downloads.php:
<?php
$directory = "./otrportal/gH34i7Uu89d9Siutf53gHuik/";
// DB COnnect
$dbConnect = mysql_connect("localhost", "BENUTZERNAME", "PASSWORT");
mysql_select_db('OTR_1', $dbConnect);
$sql = "select * from otr";
$handle=opendir ($directory);
$datum = array();
echo "<h3> The following files were found:</h3> \n\r"; while (false !==
($file = readdir ($handle))) {
if (substr ($file, strlen($file)-6, strlen($file)) == "otrkey"){
$temp=date ("d.m.Y", filemtime($directory.$file));
array_push($datum, $temp);
if (!isset($$temp)){
$$temp=array();
}
array_push($$temp, $file);
}
}
closedir($handle);
rsort($datum);
$datum=array_unique($datum);
foreach($datum as $tag){
echo "<h3> $tag</h3> \n";
sort($$tag);
echo "<ul> \n";
foreach ($$tag as $file){
$n = 0;
while($n < strlen($file)){
$fileName .= chr(ord( substr($file, $n, 1))+4);
$n++;
}
echo "<li> <a href='./otrportal/download.php?f=".urlencode($fileName)."'>".$entry."
$file (size:".sprintf("%01.2f", (filesize($directory.$file)/1024/1024))."mb )</a> </li> \n";
}
echo "</ul> \n";
}
echo "<br/> Delivered ".$row['downloads']." files with
".sprintf("%01.2f", ($row['bytes']/1024/1024))." mb this hour.<br/>
\n";
@mysql_close($dbConnect);
echo '</body> </html> ';
?>
Nun der Inhalt von der download.php:
<?php
/******** myOTR **********/
// text text text
// text text text
// text text text
// text text text
/******** SET HERE YOUR SECRET PATH TO THE OTRKEY FILES *******/
$secretFolderPath = './gH34i7Uu89d9Siutf53gHuik/'; // e.g. './mySecretFolder/' //do NOT forget the last slash /
setlocale(LC_TIME, "de_DE");
/******** END OF USER CONFIGURATION SETTINGS ******************/
/******** BUT DO NOT CHANGE ANYTHING BELOW HERE!! ***********************************************/
$fp = @fopen("./mbpermonth.txt", "r");
$trafficLimit = @fgets($fp);
@fclose($fp);
$string = urldecode($_REQUEST['f']);
while($n < strlen($string)){
$fileName .= chr(ord( substr($string, $n, 1))-4);
$n++;
}
if(filesize($secretFolderPath.$fileName) < 1){ exit; }
//nochmal zur doppelten sicherheit lokal den traffic zaehlen
$fileSize = (integer)round(( @filesize($secretFolderPath.$fileName) / pow( 4, 10 )));
//if next day, reset traffic limit
if(date("j", (@filemtime("./traffic.txt")-3600)) < date("j", time())){
//write daily log file
$fp = @fopen("./traffic.txt", "w+");
$log = @fgets($fp);
@fputs($fp, "0");
@fclose($fp);
$logString .= date("l, j.F y", time() - 82800).";".$log."\n";
$fp = fopen("trafficLog.csv", "w+");
$log = @fgets($fp);
fputs($fp, $log.$logString);
fclose($fp);
//delete traffic of today
//@unlink("./traffic.txt");
}
if(@file_exists("./traffic.txt")){
$fp = @fopen("./traffic.txt", "r+");
$count = @fgets($fp);
@fclose($fp);
if($trafficLimit != 0 && ($fileSize + $count) > ($trafficLimit/date("t", time()))){
echo "Sorry, daily traffic limit of this server is exeeded";
exit;
}
}else{ $count = 0; }
$count = $count + $fileSize;
$fp = @fopen("./traffic.txt", "w");
@fputs($fp, $count);
@fclose($fp);
//start download
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header('Content-Description: File Transfer');
header('Content-Type: application/otrkey');
header('Content-Length: '.@filesize($secretFolderPath.$fileName));
header("Content-Disposition: attachment; filename=".$fileName);
header("Content-Transfer-Encoding: binary");
@readfile($secretFolderPath.$fileName);
//for future versions, just leave it as it is
//create link to file
/*$time = time();
if(!is_dir("./tmp/")){
mkdir("./tmp/", 0777);
}
mkdir("./tmp/".$time, 0777);
symlink($_SERVER['DOCUMENT_ROOT']."/".$secretFolderPath.$fileName, "./tmp/".$time."/".$fileName);
header("Location: ./tmp/".$time."/".$fileName); */
?>
Ich hoffe, dass mir einer weiterhelfen kann.
Gruß Stefan