• Downloading from our site will require you to have a paid membership. Upgrade to a Premium Membership from 10$ a month today!

    Dont forget read our Rules! Also anyone caught Sharing this content will be banned. By using this site you are agreeing to our rules so read them. Saying I did not know is simply not an excuse! You have been warned.

Hỏi về hàm làm việc với file

lekien

New Member
về hàm làm việc với zip

cho em hỏi là cái code này lỗi ở đâu ak.
PHP:
<?php

define('_IN_JOHNCMS', 1);
require_once("../incfiles/core.php");
require_once("../incfiles/head.php");
$id = isset($_GET['id']) ? htmlspecialchars(urldecode($_GET['id'])) : ****;
$tdk = $_POST['tdk'];
if ($rights == 9) {
if ($id) {
$req = mysql_query("SELECT * FROM `cms_forum_files` WHERE `id` = '$id'");
if (mysql_num_rows($req)) {
$res = mysql_fetch_array($req);
     
$content = '';
$z = new ZipArchive();
if ($z->open(''.$home.'/files/forum/attach/'.$res['filename'].''))
{
$fp = $z-> getStream('META-INF/MANIFEST.MF');
echo'<form action="'.$homeurl.'/forum/fix-mf.php?id=' . $id . '" method="post" enctype="multipart/form-data"><textarea name="tdk"
rows="2">';
if(!$fp) exit("failed\n");
while (!feof($fp)){
echo fgets($fp);
}
echo'</textarea>';
fclose($fp);
}
echo'<input type="submit" name="submit" value="Ok"/></form>';
if (isset($_POST['submit'])) {
$zip = new ZipArchive();
if ($zip->open(''.$home.'/files/forum/attach/'.$res['filename'].''))
{
$tdk = $_POST['tdk'];
$filemod = "META-INF/MANIFEST.MF";
$zip->deleteName($filemod);
$zip->addFromString($filemod,$tdk);
$zip->close();
echo' Ok, Men';
}
}
}
}
}
require_once("../incfiles/end.php");
?>

server thông báo lỗi như sau.
PHP:
Warning: ZipArchive::getStream() [ziparchive.getstream]: Invalid or unitialized Zip object in/home/giaitri1/public_html/forum/fix-mf.php on line 18
thank
 
Last edited:

Facebook Comments

Similar threads

New posts New threads New resources

Back
Top