-
Notifications
You must be signed in to change notification settings - Fork 1
/
backupsoftwarecode1.php
54 lines (42 loc) · 1.76 KB
/
backupsoftwarecode1.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/*
Copyright (c) 2011 http://ramui.com. All right reserved.
This product is protected by copyright and distributed under licenses restricting copying, distribution. Permission is granted to the public to download and use this script provided that this Notice and any statement of authorship are reproduced in every page on all copies of the script.
*/
//On the backup zipped file, this omits the backup destination folder. To avoid, folder not found error, below code is needed.
if (is_dir('zbackupsoftwarefiles'))
{
//code to use if directory
//echo 'Dir Found.';
//echo 'No Action Taken';
}
else
{
//echo 'Dir Not Found';
mkdir("zbackupsoftwarefiles");
//echo 'Dir Created';
}
//To call database backupcode to include DB backup process.
include ("backupdatabasecode1.php");
//include "recurseZip.php";
include "backupsoftwarecodeinclude1.php";
//Source file or directory to be compressed.
//$src='source/foldername';
$src='../'.$appfoldername;
//Destination folder where we create Zip file.
$dst='zbackupsoftwarefiles';
$z=new recurseZip();
//echo $z->compress($src,$dst);
$z->compress($src,$dst);
$backuptime = date('YMd_His');
$backupsoftwarefiletime = date('Y-m-d H:i:s');
$username = $_SESSION["username"];
$ipaddress = $_SERVER["REMOTE_ADDR"];
$backupsoftwarefilename = 'SW_Backup_'.$backuptime.'.zip';
$backupsoftwarefiletime = $backupsoftwarefiletime;
$query1db = "insert into master_backupsoftware (backupfilename, backupfiledate, username, ipaddress)
values ('$backupsoftwarefilename', '$backupsoftwarefiletime', '$username', '$ipaddress')";
$exec1db = mysql_query($query1db) or die ("Error in Query1db".mysql_error());
//To rename the created zipped file.
rename('zbackupsoftwarefiles/'.$appfoldername.'.zip', 'zbackupsoftwarefiles/'.$backupsoftwarefilename);
?>