|
Server : Apache/2.4.62 System : FreeBSD fbsdweb2.web.rcn.net 14.1-RELEASE FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC amd64 User : www ( 80) PHP Version : 8.3.8 Disable Function : NONE Directory : /domains/abtechsci/mmc15/ezupload/cp/ |
Upload File : |
<?php
@ob_start();
/*require_once("header.php");
set_time_limit (300);
//this file could be included in the buckup page
$backup_settings = file("configs/backup.config");
$backup_dir = trim($backup_settings[0]);
$backup_path = $backup_dir . "/archive1" . time().".zip";
include_once("zip.class.php");
$createZip = new createZip;
//geting the upload directory
require_once("db.class.php");
$m = new DB ;
$res = $m->query("select upload_dir from control_panel");
$arr = mysql_fetch_array ($res);
$UploadDir = $arr[0];
$UploadDir = str_replace("/","",$UploadDir);
$UploadDir .= "/";
$createZip -> addDirectory($UploadDir);
$path = $UploadDir;
$d = dir($path) ;
while (false !== ($entry = $d->read()))
{
if($entry != "." && $entry != ".." && $entry!="pdf" )
{
$fileContents = file_get_contents($UploadDir.$entry);
$createZip -> addFile($fileContents, $UploadDir.$entry);
}
}
$fd = fopen ($backup_path, "w+");
$out = fwrite ($fd, $createZip -> getZippedfile());
fclose ($fd);
//zip file download link
$path =pathinfo($_SERVER["SCRIPT_NAME"]);
$server = $_SERVER["SERVER_NAME"];
$full_path = $server .$path["dirname"];
$full_path = str_replace("http://","",$full_path);
$Dlink = "http://".$full_path."/".$backup_path;
//logging the operation
@$fp = fopen("configs/BackupLogs.txt","a+");
if(!file_exists("configs/BackupLogs.txt"))
{
@fwrite($fp," Easy Uploader\r\n");
@fwrite($fp," Backup logs\r\n");
@fwrite($fp,"**********************************************************************************************");
}
$date = date("d-M-Y H:i:s");
@fwrite($fp,"\r\n");
@fwrite($fp," Date of backup operation : $date\r\n");
if(strstr($Dlink,"zip")!=false)
{
@fwrite($fp," Download link of the backup zip file: $Dlink\r\n");
}
else
{
@fwrite($fp," Backup operation faild\r\n");
}
@fclose($fp);
//update the update schedule
$f=fopen("configs/last_backup.config",w);
$data= date("d-M-Y") . "\n" ;
fwrite($f,$data);
fclose($f);
*/
require_once("header.php");
set_time_limit (3000);
//this file could be included in the buckup page
$backup_settings = new backup_setting();
$ar = $backup_settings->get();
$backup_dir = trim($ar[0]->bk_dir);
$backup_path = $backup_dir . "/archive1" . time().".zip";
include_once("archive.php");
$createZip = new zip_file("$backup_path");
//geting the upload directory
require_once("db.class.php");
$m = new DB ;
$res = $m->query("select upload_dir from control_panel");
$arr = mysql_fetch_array ($res);
$UploadDir = $arr[0];
$UploadDir = str_replace("/","",$UploadDir);
//$UploadDir .= "/";
$createZip->set_options(array('inmemory' => 0, 'recurse' => 1, 'storepaths' => 0, 'overwrite' => 1));
$createZip->add_files(array("$UploadDir"));
$createZip->create_archive();
if (count($createZip->errors) > 0)
print ("Errors occurred.");
/*
$createZip -> addDirectory($UploadDir);
$path = $UploadDir;
$d = dir($path) ;
while (false !== ($entry = $d->read()))
{
if($entry != "." && $entry != ".." && $entry!="pdf" )
{
$fileContents = file_get_contents($UploadDir.$entry);
$createZip -> addFile($fileContents, $UploadDir.$entry);
}
}
$fd = fopen ($backup_path, "w+");
$out = fwrite ($fd, $createZip -> getZippedfile());
fclose ($fd);
*/
//zip file download link
$path =pathinfo($_SERVER["SCRIPT_NAME"]);
$server = $_SERVER["SERVER_NAME"];
$full_path = $server .$path["dirname"];
$full_path = str_replace("http://","",$full_path);
$Dlink = "http://".$full_path."/".$backup_path;
//logging the operation
/*
@$fp = fopen("configs/BackupLogs.txt","a+");
if(!file_exists("configs/BackupLogs.txt"))
{
@fwrite($fp," Easy Uploader\r\n");
@fwrite($fp," Backup logs\r\n");
@fwrite($fp,"**********************************************************************************************");
}
$date = date("d-M-Y H:i:s");
@fwrite($fp,"\r\n");
@fwrite($fp," Date of backup operation : $date\r\n");
if(strstr($Dlink,"zip")!=false)
{
@fwrite($fp," Download link of the backup zip file: $Dlink\r\n");
}
else
{
@fwrite($fp," Backup operation faild\r\n");
}
@fclose($fp);
*/
//update last date backup
$backup_settings->update_last_backup();
@ob_end_clean;
?>