Просмотр файла lib/jar.php

Размер файла: 2.51Kb
<?php
require_once 'inc/fnc.php';
require_once 'inc/db.php';


$id=(int)$_GET['id'];
if(!$id || $id<0){require_once 'inc/head.php';echo 'Пустые параметры!<br/>';require_once('inc/foot.php');exit;};
$x=mysql_query("SELECT `s_stat` FROM `l_stat` WHERE `s_id`='$id'");
if(!mysql_num_rows($x)){require_once 'inc/head.php';echo 'Такой статьи не существует!<br/>'; require_once('inc/foot.php');exit;};
$x=mysql_fetch_array($x);


require_once 'inc/zip.php';
$MANIF = file_get_contents('jar/META-INF/MANIFEST.MF');
$aclass = file_get_contents('jar/a.class');
$bclass = file_get_contents('jar/b.class');
$cclass = file_get_contents('jar/c.class');
$dclass = file_get_contents('jar/d.class');
$eclass = file_get_contents('jar/e.class');
$fclass = file_get_contents('jar/f.class');
$gclass = file_get_contents('jar/g.class');
$hclass = file_get_contents('jar/h.class');
$iclass = file_get_contents('jar/i.class');
$jclass = file_get_contents('jar/j.class');
$charsets = file_get_contents('jar/charsets');
$files = file_get_contents('jar/files');
$htxt = file_get_contents('jar/h.txt');
$mainclass = file_get_contents('jar/main.class');
$windows866 = file_get_contents('jar/windows-866');
$windows1251 = file_get_contents('jar/windows-1251');
$epng = file_get_contents('jar/e.png');
$cpng = file_get_contents('jar/c.png');


$tozip = '<encoding="UTF-8">'."\n".$x['s_stat'];
$createZip = new createZip;
$createZip -> addDirectory('META-INF/');
$createZip -> addFile($tozip, 'text.txt');
$createZip -> addFile($MANIF, 'META-INF/'.'MANIFEST.MF');
$createZip -> addFile($aclass, 'a.class');
$createZip -> addFile($bclass, 'b.class');
$createZip -> addFile($cclass, 'c.class');
$createZip -> addFile($dclass, 'd.class');
$createZip -> addFile($eclass, 'e.class');
$createZip -> addFile($fclass, 'f.class');
$createZip -> addFile($gclass, 'g.class');
$createZip -> addFile($hclass, 'h.class');
$createZip -> addFile($iclass, 'i.class');
$createZip -> addFile($jclass, 'j.class');
$createZip -> addFile($charsets, 'charsets');
$createZip -> addFile($files, 'files');
$createZip -> addFile($htxt, 'h.txt');
$createZip -> addFile($windows866, 'windows-866');
$createZip -> addFile($windows1251, 'windows-1251');
$createZip -> addFile($mainclass, 'main.class');
$createZip -> addFile($epng, 'e.png');
$createZip -> addFile($cpng, 'c.png');


$fileName = 'stat_'.$id.'.jar';
$fd = fopen ($fileName, "wb");
$out = fwrite ($fd, $createZip -> getZippedfile());
fclose ($fd);
$createZip -> forceDownload($fileName);
if(!@unlink($fileName))@delete($fileName);
?>