well, the above one shows a list if zips in the directory and has ability to delete the zip and the script itself as well using a checkbox.
now, here is another one.
this one extracts the automatically finds the .tar.gz files and then extracts them and then deletes the files and the script itself as well.
may be we can combine them both into a piece.
Thanks. i am just saying.
Code:
<?php
// import the PEAR Archive_Tar class (see http://pear.php.net/package/Archive_Tar)
include ('Archive/Tar.php');
$file = $_SERVER["SCRIPT_NAME"];
$break = preg_split('/\//', $file, -1);
$pfile = $break[count($break) - 1];
echo "<p>You have run $pfile to extract a Joomla tar.gz archive file.</p>";
if ($handle = opendir('.')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$extn = substr($file, -7);
$source = substr($file, 6);
if ($extn == ".tar.gz" && $source="Joomla")
{
echo "<p>$file file has been found and will be extracted.<p>";
$file_to_extract = $file; // Name of Joomla tar.gz archive file to extract
$obj = new Archive_Tar( $file_to_extract ); // Create archive object to extract
closedir($handle); // A Joomla tar.gz archive file has been found, close directory handler
if ($obj->extract(''))
{
unlink( $file_to_extract ); // Remove source code file
unlink( $pfile ); // Removes this script file to prevent misuse
echo "<p>The source file ($file_to_extract) and the unpack script ($pfile) have been removed.</p>";
exit ("$file_to_extract extracted successfully!");
} else {
echo "<p>WARNING: The source file ($file_to_extract) and the unpack script ($pfile) have NOT been removed.</p>";
exit ('Error in file extraction');
}
}
}
}
closedir($handle);
echo "<p>The unpack script ($pfile) has been removed.</p>";
die('No Joomla source file to extract!');
}
?>
Bookmarks