Code: Alles auswählen
function makedlcode ($string) {
$timestamp = time();
if ($string=="letztestunde") {
$timestamp=$timestamp-3600;
}
$datum = date("dmY",$timestamp);
$uhrzeit = date("H",$timestamp);
$timecode="$datum$uhrzeit";
$code="$timecode" . "DEIN_PASSWORT";
$code=md5($code);
$code = substr($code, 4, 8);
if ($string=="ausgabe") {
echo $code;
}
else {
return $code;
}
} // function makedlcode
https://domain.de/download.php?id=<?=$id?>&codestring=<? makedlcode(ausgabe); ?>
und in der download.php siehts dann noch so aus:
Code: Alles auswählen
if ($_GET[codestring]!=makedlcode(jetzt) AND $_GET[codestring]!=makedlcode(letztestunde)) {
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://domain.de");
exit;
}
