Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- define('SPATH', '');
- require_once('inc/libs.php');
- $db = new DataBase(DB_HOST, DB_USER, DB_PASS, DB, false, 'utf8');
- $codecustomer = $_REQUEST['codecustomer'];
- $version = $_REQUEST['v'];
- $versionps = $_REQUEST['vps'];
- if (ctype_alnum($codecustomer)) {
- $result = $db->fetchArray('SELECT * FROM ' . PREF . 'customer_modules WHERE customercode = "' . $codecustomer . '"');
- foreach ($result as $itemuser) {
- $path = '../../p/prestashow.pl/prestashow_modules/' . $itemuser['modulesname'] . '/';
- $w = '/moduledownload.php?codecustomer=' . $codecustomer;
- if (!empty($version)) {
- $w.='&v=' . $version;
- $path.=$version . '/';
- }
- if (!empty($versionps)) {
- $w.='&vps=' . $versionps;
- $path.=$versionps . '/';
- }
- $files = scandir($path);
- foreach ($files as $item) {
- if ($item != '.' && $item != '..' && $item != 'desc.pdf') {
- // echo $path;
- if (file_exists($path)) {
- if (empty($version))
- echo '<a href="' . $w . '&v=' . $item . '">' . $item . '</a><br>';
- elseif (!empty($version) && empty($versionps))
- echo '<a href="' . $w . '&vps=' . $item . '">' . $item . '</a><br>';
- else {
- if (!empty($version) && !empty($versionps)) {
- $zip = new ZipArchive;
- if ($zip->open($path . $item) === TRUE) {
- $zip->addFromString('config/conf.txt', $codecustomer . ':dont delete and dont change this file');
- $zip->close();
- } else {
- echo 'failed';
- }
- $zip_name = $path . $item;
- header("Pragma: public");
- header("Expires: 0");
- header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
- header("Cache-Control: private", false);
- header('Content-type: application/zip');
- header('Content-Disposition: attachment; filename="' . $item . '"');
- readfile($zip_name);
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement