-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdbdump.php
More file actions
executable file
·50 lines (40 loc) · 1.47 KB
/
dbdump.php
File metadata and controls
executable file
·50 lines (40 loc) · 1.47 KB
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
<?php
set_time_limit (0);
//WORDPRESS
if (file_exists('wp-config.php')) {
include('wp-config.php');
MakeDump (DB_HOST,DB_NAME,DB_USER,DB_PASSWORD,"Wordress");
}
//OPENCART
if (file_exists('config.php')) {
include('config.php');
MakeDump (DB_HOSTNAME,DB_DATABASE,DB_USERNAME,DB_PASSWORD, "Opencart");
}
//Joomla
if (file_exists('configuration.php')) {
include('configuration.php');
$config=new JConfig;
MakeDump ($config->host,$config->db,$config->user,$config->password,"Joomla");
}
//MODx Revolution:
if (file_exists('core/config/config.inc.php')) {
include('core/config/config.inc.php');
MakeDump ($database_server,$dbase,$database_user,$database_password,"MODx Revolution");
}
//SimplaCMS / OkayCMS
if (file_exists('config/config.php')) {
$config = parse_ini_file('config/config.php');
MakeDump ($config['db_server'],$config['db_name'],$config['db_user'],$config['db_password'], "SimplaCMS/OkayCMS");
}
function MakeDump($dbhost,$dbname,$dbuser,$dbpassword,$engine)
{
echo "Engine recognized as -> $engine<br>";
shell_exec('mysqldump -u'.$dbuser.' -h'.$dbhost.' -p'.$dbpassword.' '.$dbname.' > '.$dbname.'.sql');
echo "Dump done, ";
if (isset($_SERVER['REQUEST_URI'])) {
$current_url = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
echo "Database file -> ".dirname($current_url)."/".$dbname.".sql";
} else {
echo "Database file -> $dbname.sql";
}
}