Skip to content

Commit 69542e0

Browse files
authored
Update backup.php
1 parent ae6c1b1 commit 69542e0

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

backup.php

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,8 @@
3030
} else {
3131
echo '<div class="alert alert-success" role="alert">Failed to register, check file permissions</div>';
3232
}
33-
34-
35-
3633
}
3734

38-
3935
session_start();
4036

4137
function logout()
@@ -80,8 +76,6 @@ function authorizeLogggedIn()
8076
}
8177
if ($_SERVER["REQUEST_METHOD"] == "POST") {
8278
// Check if the password is correct (you need to define your own password)
83-
84-
8579
if (isset($_POST["password"]) && !$_SESSION['backup_logged_in'] && md5($_POST["password"]) == $correct_password) {
8680
// Password is correct, set backup_logged_in session variable
8781
$_SESSION['backup_logged_in'] = $correct_password;
@@ -93,10 +87,11 @@ function authorizeLogggedIn()
9387
}
9488
function unzipFile($zipFile)
9589
{
90+
global $dir_path;
9691
preventUnAuthorized();
9792
$zip = new ZipArchive;
9893
if ($zip->open($zipFile) === TRUE) {
99-
$zip->extractTo('./'); // Extract to the current directory
94+
$zip->extractTo($dir_path);
10095
$zip->close();
10196
echo '<div class="alert alert-success" role="alert">File unzipped successfully!</div>';
10297
} else {
@@ -297,8 +292,6 @@ function doSqlBackup($host, $user, $pass, $dbname)
297292
header("Location: " . $_SERVER['PHP_SELF'] . "?error=Connection failed: " . $conn->connect_error);
298293
exit;
299294
}
300-
301-
// Continue with your code here
302295
} catch (Exception $e) {
303296

304297
header("Location: " . $_SERVER['PHP_SELF'] . "?error=Connection failed: " . urlencode($e->getMessage()));
@@ -314,7 +307,6 @@ function doSqlBackup($host, $user, $pass, $dbname)
314307
$tables[] = $row[0];
315308
}
316309

317-
318310
foreach ($tables as $table) {
319311
$outsql .= "DROP TABLE IF EXISTS `$table`;\n";
320312
$sql = "SHOW CREATE TABLE $table";
@@ -370,7 +362,6 @@ function doSqlBackup($host, $user, $pass, $dbname)
370362
}
371363
.content-wrap {
372364
min-height: 100%;
373-
/* Equal to the footer height */
374365
margin-bottom: -100px;
375366
}
376367
.footer {
@@ -504,9 +495,6 @@ class="btn mb-1 btn-success"><i class="fas fa-cloud-upload-alt"></i> Backup all
504495
}
505496
?>
506497
</select>
507-
508-
509-
510498
</div>
511499
<button type="submit" class="btn btn-primary"><i class="fas fa-file-archive"></i>
512500
Unzip</button>
@@ -517,7 +505,6 @@ class="btn mb-1 btn-success"><i class="fas fa-cloud-upload-alt"></i> Backup all
517505
</div>
518506
</div>
519507

520-
521508
<div class="card mt-3">
522509
<div class="card-header"><i class="fas fa-database"></i> SQL Import</div>
523510
<div class="card-body">

0 commit comments

Comments
 (0)