Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php copy('test_with_comment.zip', 't.zip'); $z = new ZipArchive; $z->open('t.zip'); pr..

Decoded Output download

<?php

copy('test_with_comment.zip', 't.zip');
$z = new ZipArchive;
$z->open('t.zip');

print_r($z);

for ($i=0; $i<$z->numFiles; $i++) {
    echo "index: $i
";
    print_r($z->getCommentIndex($i));
    echo "

";
}
echo "foobar/ " . $z->getCommentName('foobar/') . "
";

echo "Archive comment: " . $z->getArchiveComment() . "
";


$z->setCommentIndex(1, 'new comment idx 1');
$z->setCommentName('foobar/', 'new comment foobar/');

$z->setArchiveComment( 'new archive comment');

for ($i=0; $i<$z->numFiles; $i++) {
    echo "index: $i
";
    print_r($z->getCommentIndex($i));
    echo "

";
}

echo $z->getCommentName('foobar/') . "
";

// Get the original comment
echo $z->getCommentName('foobar/', ZIPARCHIVE::FL_UNCHANGED) . "
";

echo "Archive comment: " . $z->getArchiveComment() . "
";
echo "Archive comment (original): " . $z->getArchiveComment(ZIPARCHIVE::FL_UNCHANGED) . "
";
 ?>

Did this file decode correctly?

Original Code

<?php

copy('test_with_comment.zip', 't.zip');
$z = new ZipArchive;
$z->open('t.zip');

print_r($z);

for ($i=0; $i<$z->numFiles; $i++) {
    echo "index: $i\n";
    print_r($z->getCommentIndex($i));
    echo "\n\n";
}
echo "foobar/ " . $z->getCommentName('foobar/') . "\n";

echo "Archive comment: " . $z->getArchiveComment() . "\n";


$z->setCommentIndex(1, 'new comment idx 1');
$z->setCommentName('foobar/', 'new comment foobar/');

$z->setArchiveComment( 'new archive comment');

for ($i=0; $i<$z->numFiles; $i++) {
    echo "index: $i\n";
    print_r($z->getCommentIndex($i));
    echo "\n\n";
}

echo $z->getCommentName('foobar/') . "\n";

// Get the original comment
echo $z->getCommentName('foobar/', ZIPARCHIVE::FL_UNCHANGED) . "\n";

echo "Archive comment: " . $z->getArchiveComment() . "\n";
echo "Archive comment (original): " . $z->getArchiveComment(ZIPARCHIVE::FL_UNCHANGED) . "\n";

Function Calls

copy 1

Variables

None

Stats

MD5 c2f90fb6fb657cb805fbc26ffa604d5a
Eval Count 0
Decode Time 88 ms