programmieren:php:programme:entpacken
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen RevisionVorhergehende ÜberarbeitungNächste Überarbeitung | Vorhergehende Überarbeitung | ||
programmieren:php:programme:entpacken [08/10/2020 14:36] – conny | programmieren:php:programme:entpacken [01/04/2021 14:16] (aktuell) – conny | ||
---|---|---|---|
Zeile 19: | Zeile 19: | ||
<code php| entpack.php> | <code php| entpack.php> | ||
<?PHP | <?PHP | ||
+ | // Entpack Kommandos: https:// | ||
+ | echo "< | ||
+ | |||
if (!is_callable(' | if (!is_callable(' | ||
die( "EXEC muss in der PHP.INI zugelassen sein." ); | die( "EXEC muss in der PHP.INI zugelassen sein." ); | ||
} | } | ||
- | $dateiName | + | if (!isset($_GET[" |
- | $shellBefehl = " | + | |
- | $shellBefehl = escapeshellcmd($shellBefehl); | + | echo "Bitte Datei zum enpacken anklicken:< |
- | exec($shellBefehl, | + | // Der Punkt steht für das Verzeichnis, |
- | echo "< | + | // PHP-Programm gespeichert ist |
- | print_r($nu); | + | $read_verz = " |
- | echo "</ | + | $verzeichnis = openDir($read_verz); |
- | echo " | + | // Verzeichnis lesen |
+ | while ($file = readDir($verzeichnis)) { | ||
+ | // Datei Extension auslesen | ||
+ | $ext = strtolower(pathinfo($file, | ||
+ | if ($file != " | ||
+ | if ( $ext == " | ||
+ | // Link erstellen | ||
+ | echo "<a href='". basename(__FILE__) ."? | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | // Verzeichnis schließen | ||
+ | closeDir($verzeichnis); | ||
+ | |||
+ | } else { | ||
+ | |||
+ | $dateiname = $_GET[" | ||
+ | echo "< | ||
+ | |||
+ | $ext = strtolower(pathinfo($dateiname, | ||
+ | |||
+ | if ($ext === " | ||
+ | // echo "ZIP Datei < | ||
+ | $shellBefehl | ||
+ | |||
+ | } elseif ($ext === "tar") { | ||
+ | // echo "tar Datei < | ||
+ | $shellBefehl = "tar cfv $dateiName"; | ||
+ | |||
+ | } elseif ($ext === " | ||
+ | // echo "gz Datei < | ||
+ | $shellBefehl = "tar xfvz $dateiName"; | ||
+ | |||
+ | } elseif ($ext === " | ||
+ | // echo "gzip Datei < | ||
+ | $shellBefehl = "tar xfvj $dateiName"; | ||
+ | } | ||
+ | |||
+ | $shellBefehl = escapeshellcmd($shellBefehl); | ||
+ | exec($shellBefehl, | ||
+ | echo "< | ||
+ | print_r($nu); | ||
+ | echo "</ | ||
+ | echo " | ||
+ | |||
+ | } | ||
function isEnabled($func) { | function isEnabled($func) { |
programmieren:php:programme (337 views) · Zuletzt geändert: 01/04/2021 14:16 von conny