PDA

View Full Version : سوال: پسورد گذاری zip



premier
پنج شنبه 12 شهریور 1388, 16:15 عصر
سلام به دوستان برنامه نویس

یه مشکل دارم که از شما خواهش می کنم راهنماییم کنید
من یه فرد مبتدی تو php هستم
یک کد php دارم که توی برنامه AJAX EXPLORER هست این کد کارش فکر کنم ساخت zip هست .
حالا من می خواهم با توجه به این کد هر وقت دستور zip تو این برنامه اجرا میشه به صورت خود کار رمز گذاری کنه ---ممنوم میشم جواب بدید.


<?php

/*
AjaxExplorer Copyright (C) 2007-2008 Syed Mohammad Sidque Tahir Al-Habshi

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Head to
GNU site http://www.gnu.org/licenses/ for license copy.
*/

$access='0108';
include 'core.php';

$zip=new ZipArchive();

$dirc=Post('dirc');
$fold=Post('file');
$list[0]='/';

if($zip->open(($dirs=$root.$dirc.$fold).'.zip', (ZIPARCHIVE::CREATE)))
{
for($i=0; $i<count($list); $i++)
{
if($dir=opendir($dirs.$list[$i]))
{
while($file=readdir($dir))
{
$file=='.' || $file=='..'? '':(is_dir($zips=$dirs.$list[$i].$file)? $list[]=$list[$i].$file.'/':$zip->addFile($zips, $fold.$list[$i].$file));
}

closedir($dir);
}
}

$zip->close();

echo $fold.'.zip:'.filesize($dirs.'.zip').':'.time();
$does="Archive\t".$dirc."\t".$fold;
include 'track.php';
}

?>
:گیج:

premier
پنج شنبه 12 شهریور 1388, 16:32 عصر
کسی نیست جواب ما را بده خواهش می کنم :گریه:

premier
پنج شنبه 12 شهریور 1388, 17:15 عصر
یکی جوابمون را بده

آقا من این کد را پیدا کردم ولی نمیدونم چکارش کنم


<?php

echo system('zip -P pass file.zip file.txt');

?>

premier
پنج شنبه 12 شهریور 1388, 17:42 عصر
جواب بدید تو رو خدا

premier
پنج شنبه 12 شهریور 1388, 18:04 عصر
اینم یکی دیگه کد خواهشا کمک کنید

$zip = new ZipArchive();
$zip->open("./foo.zip", ZIPARCHIVE::CREATE);
$dir = scandir ("doc/");
foreach($dir as $filename)
{
if($filename != "." || $filename != "..")
{
$zip->addFile("doc/".$filename, "doc/".$filename);
}
}
$zip->close();