-
Notifications
You must be signed in to change notification settings - Fork 7
/
zipit-zip-db.php
58 lines (47 loc) · 1.79 KB
/
zipit-zip-db.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
55
56
57
58
<?php
###############################################################
# Zipit Backup Utility
###############################################################
# Developed by Jereme Hancock for Cloud Sites
# Visit http://zipitbackup.com for updates
###############################################################
// include password protection
require_once("zipit-login.php");
// require zipit configuration
require('zipit-config.php');
// get database to backup
$db = $_GET['db'];
// generate hash to create progress file
$progress_hash = substr(hash("sha512",rand()),0,12); // Reduces the size to 12 chars
// get name of progress file. This will keep on demand backups from colliding with auto backups
$progress_file = $progress_hash. "-progress.php";
// update progress file
file_put_contents($progress_file,'<br/><center>Initializing...<br/><img src="images/progress.gif"/></center>');
?>
<script src="js/jquery.js"></script>
<script>
function checkForData() {
$.post('<?php echo $progress_file; ?>',false,function(data){
if(data.length){
// Display the current progress
document.getElementById('progress').innerHTML = data;
}
else {
// No need to show anything if there isn't anything happening
}
});
}
// Start the timer when the page is done loading:
$(function(){
// First Check
checkForData();
// Start Timer
var refreshIntervalId = setInterval('checkForData()',1000); // 1 Second Intervals
$.post('zipit-zip-db-process.php?auth=<?php echo $auth_hash; ?>&progress=<?php echo $progress_hash; ?>&db=<?php echo $db; ?>', function(data) {
$('.result').text(data);
clearInterval(refreshIntervalId);
});
});
</script>
<link href="css/style.css" rel="stylesheet" type="text/css">
<span id="progress"></span>