về hàm làm việc với zip
cho em hỏi là cái code này lỗi ở đâu ak.
server thông báo lỗi như sau.
thank
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
Last edited: