View file down/txt_zip.php

File size: 953B
<?php

// mod Gemorroj

require 'moduls/config.php';
require 'moduls/fun.php';
// Проверка переменных

$id = intval($_GET['id']);
// Получаем инфу о файле
$d = mysql_fetch_row(mysql_query('SELECT TRIM(`path`) FROM `files` WHERE `id` = ' . $id));


if (file_exists($d[0])) {
    mysql_query('UPDATE `files` SET `loads`=`loads`+1, `timeload`=' . $_SERVER['REQUEST_TIME'] . ' WHERE `id`=' . $id);

    $tmp = $setup['zpath'] . '/' . basename($d[0]) . '.zip';

    if (!file_exists($tmp)) {
        include 'moduls/pclzip.lib.php';

        $zip = new PclZip($tmp);

        function cb($p_event, &$p_header)
        {
            $p_header['stored_filename'] = basename($p_header['filename']);
            return 1;
        }
        $zip->create($d[0], PCLZIP_CB_PRE_ADD, 'cb');
        chmod($tmp, 0644);
    }

    header('Location: ' . $tmp, true, 301);
} else {
    echo $setup['hackmess'] . '</body></html>';
}

?>