root / createBackup.php

1
<?php
2
3
/*
4
5
    Copyright (C) 2010, All Rights Reserved.
6
7
    This file is part of RPInventory.
8
9
    RPInventory is free software: you can redistribute it and/or modify
10
    it under the terms of the GNU General Public License as published by
11
    the Free Software Foundation, either version 3 of the License, or
12
    (at your option) any later version.
13
14
    RPInventory is distributed in the hope that it will be useful,
15
    but WITHOUT ANY WARRANTY; without even the implied warranty of
16
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
    GNU General Public License for more details.
18
19
    You should have received a copy of the GNU General Public License
20
    along with RPInventory.  If not, see <http://www.gnu.org/licenses/>.
21
22
*/
23
24
25
require_once( "lib/auth.lib.php" );  //Session
26
27
// Authenticate
28
$auth = GetAuthority();        
29
if($auth<1)
30
  die("Please login to complete this action");
31
32
require_once( "class/config.class.php" );
33
34
$user = Config::get( 'database_username' );
35
$password = Config::get( 'database_password' );
36
$database = Config::get( 'database_name' );
37
$club_name = Config::get( 'club_name' );
38
$club_name = str_replace( ' ', '_', $club_name );
39
$sqlFile = "cache/". $club_name;
40
41
$createBackup = "mysqldump -u ".$user." --password=".$password." ".$database;
42
43
header( 'Content-type: text/plain' );
44
header( 'Content-Disposition: attachment; filename="'.$club_name."_backup.txt".'"' );
45
46
system($createBackup);
47
48
?>
49