30
30
} else {
31
31
echo '<div class="alert alert-success" role="alert">Failed to register, check file permissions</div> ' ;
32
32
}
33
-
34
-
35
-
36
33
}
37
34
38
-
39
35
session_start ();
40
36
41
37
function logout ()
@@ -80,8 +76,6 @@ function authorizeLogggedIn()
80
76
}
81
77
if ($ _SERVER ["REQUEST_METHOD " ] == "POST " ) {
82
78
// Check if the password is correct (you need to define your own password)
83
-
84
-
85
79
if (isset ($ _POST ["password " ]) && !$ _SESSION ['backup_logged_in ' ] && md5 ($ _POST ["password " ]) == $ correct_password ) {
86
80
// Password is correct, set backup_logged_in session variable
87
81
$ _SESSION ['backup_logged_in ' ] = $ correct_password ;
@@ -93,10 +87,11 @@ function authorizeLogggedIn()
93
87
}
94
88
function unzipFile ($ zipFile )
95
89
{
90
+ global $ dir_path ;
96
91
preventUnAuthorized ();
97
92
$ zip = new ZipArchive ;
98
93
if ($ zip ->open ($ zipFile ) === TRUE ) {
99
- $ zip ->extractTo (' ./ ' ); // Extract to the current directory
94
+ $ zip ->extractTo ($ dir_path );
100
95
$ zip ->close ();
101
96
echo '<div class="alert alert-success" role="alert">File unzipped successfully!</div> ' ;
102
97
} else {
@@ -297,8 +292,6 @@ function doSqlBackup($host, $user, $pass, $dbname)
297
292
header ("Location: " . $ _SERVER ['PHP_SELF ' ] . "?error=Connection failed: " . $ conn ->connect_error );
298
293
exit ;
299
294
}
300
-
301
- // Continue with your code here
302
295
} catch (Exception $ e ) {
303
296
304
297
header ("Location: " . $ _SERVER ['PHP_SELF ' ] . "?error=Connection failed: " . urlencode ($ e ->getMessage ()));
@@ -314,7 +307,6 @@ function doSqlBackup($host, $user, $pass, $dbname)
314
307
$ tables [] = $ row [0 ];
315
308
}
316
309
317
-
318
310
foreach ($ tables as $ table ) {
319
311
$ outsql .= "DROP TABLE IF EXISTS ` $ table`; \n" ;
320
312
$ sql = "SHOW CREATE TABLE $ table " ;
@@ -370,7 +362,6 @@ function doSqlBackup($host, $user, $pass, $dbname)
370
362
}
371
363
.content-wrap {
372
364
min-height: 100%;
373
- /* Equal to the footer height */
374
365
margin-bottom: -100px;
375
366
}
376
367
.footer {
@@ -504,9 +495,6 @@ class="btn mb-1 btn-success"><i class="fas fa-cloud-upload-alt"></i> Backup all
504
495
}
505
496
?>
506
497
</select>
507
-
508
-
509
-
510
498
</div>
511
499
<button type="submit" class="btn btn-primary"><i class="fas fa-file-archive"></i>
512
500
Unzip</button>
@@ -517,7 +505,6 @@ class="btn mb-1 btn-success"><i class="fas fa-cloud-upload-alt"></i> Backup all
517
505
</div>
518
506
</div>
519
507
520
-
521
508
<div class="card mt-3">
522
509
<div class="card-header"><i class="fas fa-database"></i> SQL Import</div>
523
510
<div class="card-body">
0 commit comments