Ich habe jetzt nochmal ne Stunde gesucht... Es gibt zwar nen Haufen Download Scripte, aber ich hab immer noch keines gefunden, das nach einem betimmten Trafficvolumen das Downloadfile blockt.
Nun gibt es viele files, die die Anzahl der Downloads zählen - aber auch hier habe ich kein Script gefunden, das nach zB. 30 Downloads das Downloadfile blockiert.
Ich habe jetzt ein Script gefunden, das sich "Download Logger" nennt. Dieser Code erlaubt angeblich nur Downloads von einer von mir definierten Seite aus, was ja sehr wünschenswert wäre.
Hier ist der Code des Programms:
Code: Alles auswählen
<?php
$domain = "(www.mydomain.com)"; // The allowed IP or URL. Build your own regex if you need to.
$download_path = "/download"; // The directory were your download files reside.
$download_files = array ("1.exe", // List all your download files here.
"2.zip",
"3.rar");
$download_page = "/downloads.php"; // Your download page.
$log = TRUE; // Log access from disallowed referers or not.
$log_file_all = "stats/allowed.log"; // The filename of the download log file.
$log_file_dis = "stats/disallowed.log"; // The filename of the disallowed log file.
function is_allowed ($ref, $file) {
global $domain;
global $download_files;
return ((preg_match ($domain, $ref)) && (in_array ($file, $download_files)));
}
function log_access ($ref, $ip, $time, $file, $log_file) {
global $domain;
if (empty($ref)) {
die ("<html><head><title>$domain</title></head><body><h2>Please enable sending of referer.<br>Bitte aktivieren Sie das Mitsendes des Referers.</body></html>");
}
$f = fopen ($log_file, "a");
fwrite ($f, "$time, $ip, $ref, $file\n");
fclose ($f);
}
if (is_allowed ($HTTP_REFERER, $argv[0])) {
if ($log) {
log_access ($HTTP_REFERER, $HTTP_SERVER_VARS['REMOTE_ADDR'], time(), $argv[0], $log_file_all);
}
header ("Location: $download_path/$argv[0]");
} else {
if ($log) {
log_access ($HTTP_REFERER, $HTTP_SERVER_VARS['REMOTE_ADDR'], time(), $argv[0], $log_file_dis);
}
header ("Location: $download_page");
}
?>
ich möchte jetzt einfach noch eine Variable definieren, die sich pro Download um den Wert 1 erhöht. Bei einem Wert von 30 soll der Download dann blockiert werden...
Kann mir da jemand helfen? (bin absoluter PHP Laie)
Und noch ne Frage...
Verursacht dieses Script irgendwie extra Belastung für meinen Download Traffic?
Falls sich jemand Zeit für dieses Problem hier nimmt - schon mal vielen Dank im Voraus!
