-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackup.php
More file actions
67 lines (47 loc) · 995 Bytes
/
backup.php
File metadata and controls
67 lines (47 loc) · 995 Bytes
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
59
60
61
62
63
64
65
66
67
<?php
include('inc/getperms.php');
include('inc/functions.php');
if($highest_perm < 3) {
print_error(array("You don't have permission to be here!"));
die;
}
if($_POST['check'] == 1) {
process_form();
} else {
print_form();
}
function process_form() {
$comment = $_POST['comment'];
if($comment == '') { $comment = 'Manual backup'; }
if(!backup_db($comment)) {
print_error(array("Backup failed!"));
die;
}
include('inc/insidehead.php');
print <<<RESULTS
<div id='content'>
<h1>Success!</h1>
<p>
The database has been backed up. That was easy, wasn't it?
</p>
</div>
RESULTS;
include('inc/insidefoot.php');
}
function print_form() {
include('inc/insidehead.php');
$thisdoc = $_SERVER['PHP_SELF'];
print <<<FORM
<div id='content'>
<p>
<form action='$thisdoc' method='post'>
<input type='hidden' name='check' value='1'/>
Backup comment: <input name='comment'/>
<input type='submit' value='Backup'/>
</form>
</p>
</div>
FORM;
include('inc/insidefoot.php');
}
?>