コード例 #1
0
ファイル: zip.php プロジェクト: Elonet/Secure-Attachment
    while (($data = fgets($handle)) !== FALSE) {
        if (trim($data) == trim($login . ':' . $password)) {
            $logpas = true;
        }
    }
}
if ($logpas == true) {
    if (!file_exists("{$dirname}/all_files_list.zip")) {
        $dir = opendir($dirname);
        $zip = new ZipArchive();
        if ($zip->open("{$dirname}/all_files_list.zip", ZipArchive::CREATE) == TRUE) {
            echo '&quot;all_files_list.zip&quot; ouvert<br/>';
            while ($file = readdir($dir)) {
                $filetype_explode = explode(".", $file);
                $fileext = $filetype_explode[count($filetype_explode) - 1];
                if ($file != '.' && $file != '..' && $file != 'index.php' && !is_dir($dirname . '/' . $file) && $file != 'mail.json' && $file != '.htaccess' && $file != '.sender' && $file != '.htpasswd' && !check_only($dirname . '/' . $file, $login) && $fileext != "lock") {
                    //ici on intègre le déchiffrement
                    $file_handler = file_get_contents($conf['absolute_path_download'] . $dirname . "/" . $file);
                    if (!$file_handler) {
                        echo "<p>Erreur d'ouverture du fichier à déchiffrer.</p>";
                    } else {
                        //déchiffrement du fichier
                        // Open the cipher
                        $td = mcrypt_module_open('rijndael-256', '', 'cbc', '');
                        // Initialize encryption module for decryption
                        mcrypt_generic_init($td, $key, $iv);
                        // Decrypt encrypted string
                        $decrypted = mdecrypt_generic($td, $file_handler);
                        $decrypted = base64_decode($decrypted);
                        $zip->addFromString($dirname . '/' . $file, $decrypted);
                        // Terminate decryption handle and close module
コード例 #2
0
').remove();
								if($('.download').length <= 1) {
									$('#zip').fadeOut();
								}
							});
						});
					</script>
		<?php 
                        $onlyone = true;
                    }
                }
            }
            ?>
			<?php 
        }
        if (check_only($dirname . '/' . $file, $mail)) {
            ?>
			<tr class="template-download fade in" id="<?php 
            echo $filetype_explode[0];
            ?>
">
				<td></td>
				<td>
					<p class="name">
						<?php 
            echo $file;
            ?>
					</p>
				</td>
				<td>
					<span class="type">
コード例 #3
0
ファイル: download.php プロジェクト: Elonet/Secure-Attachment
<?php

date_default_timezone_set('Europe/Berlin');
require "/etc/secure_attachment.conf";
require $conf['absolute_path_upload'] . "include_languages.php";
$file = htmlspecialchars($_GET['file']);
$password = htmlspecialchars($_GET['psw']);
$lang = htmlspecialchars($_GET['l']);
$ip = htmlspecialchars($_GET['ip']);
$mail = htmlspecialchars($_GET['mail']);
$folder_tmp = explode("/", $file);
if (($handle = fopen($conf['absolute_path_download'] . "files/" . $folder_tmp[1] . "/.htpasswd", "r")) !== FALSE) {
    while (($data = fgets($handle)) !== FALSE) {
        if ($data == $mail . ':' . $password . "\n" && !check_only($file, $mail)) {
            download_file($file, $folder_tmp, $password, $ip, $mail);
        }
    }
}
function check_only($file, $login)
{
    $login_found = 0;
    if (!file_exists($file . ".lock")) {
        return false;
    } else {
        if (($handle = fopen($file . ".lock", "r")) !== FALSE) {
            while (($data = fgets($handle)) !== FALSE) {
                if ($data == $login . "\n") {
                    $login_found++;
                }
            }
        }