Download

Erstellt: 17.10.2022 Lesedauer ≤ 1 Min.

Dieses Skript prüft auf Vorhandensein einer Download-Datei und ermitelt Datei-Informationen.

Querverweis

Download-Modul

Das Skript

Stand: 21.10.2022

Ladefehler: $$$ file a $$$

<?php
function dlink($thefile,$thelink,$thetype){
if (
$thefile) {
    
$dlfile $_SERVER["DOCUMENT_ROOT"] . $thefile;
    (
$thelink) ? $linktext $thelink $linktext 'Downlaod';
    (
$thetype) ? $typ $thetype $type '';
    if (
file_exists($dlfile)){
        
$aktuell date ("d.m.Y, H:i"filemtime($dlfile)) . ' Uhr';               
        
$groesse filesize($dlfile);               
        
$dv 0;
        
$bt 'Bytes';
        while (
$groesse 1024) {
            
$groesse round($groesse 10242);
            ++
$dv;
        }
        switch (
$dv) {
            case 
: break;
            case 
$bt ' KB'; break;
            case 
$bt ' MB'; break;
            case 
$bt ' GB'; break;
            case 
$bt ' TB'; break;
        }  
        Return 
'<a title="Download" href="'.$thefile.'">'.$linktext.'</a> <small> Download mit Rechtsklick<br/>'.$typ.' vom '.$aktuell.', Größe: ' $groesse .$bt.'</small>';
    }
    else
      Return 
'<small>Momentan kein Download vorhanden.</small>';
} else
    Return 
'<mark>Kein Download eingetragen.</mark>';
}
?>