rapidleech icon indicating copy to clipboard operation
rapidleech copied to clipboard

add password protection to ZIP/UNZIP actions

Open AliM1988 opened this issue 7 years ago • 3 comments

Hi. I wonder it is possible to add password encryption to ZIP/Unzip actions like Rar/Unrar? It's useful because most of (shared/free) host disable RAR function. By default the zip decryption is enabled. (See code below). I don't know about zip encryption:

<?php
    $zip = new ZipArchive();
    $zip_status = $zip->open("test.zip");

    if ($zip_status === true)
    {
        if ($zip->setPassword("MySecretPassword"))
        {
            if (!$zip->extractTo(__DIR__))
                echo "Extraction failed (wrong password?)";
        }

        $zip->close();
    }
    else
    {
        die("Failed opening archive: ". @$zip->getStatusString() . " (code: ". $zip_status .")");
    }
?>

Thanks.

AliM1988 avatar Jun 18 '17 20:06 AliM1988

+1 Many RAR and ZIP have password for protection.

Please add this feature, thanks.

MythodeaLoL avatar Jun 29 '17 15:06 MythodeaLoL

At the moment none of the 2 classes used supports encryption

ZipArchive supports it, but it has to be enabled/compiled on the server, so it may not be available on all servers: http://php.net/manual/en/zip.installation.php

Anyways, writting another zip/unzip options for only shown if the module is enabled seems to be a good idea.

Th3-822 avatar Jun 29 '17 16:06 Th3-822

AFAIK, in most shared servers zip encryption is disabled because of disabled function "system". But still zip decryption is enabled (code in first comment). Thank you for your attention.

AliM1988 avatar Jul 07 '17 20:07 AliM1988