<?php
include("config_attrans.php");
error_reporting(1);
$backup_path 	= $config['db_clone']['local'] . '/';
$date 			= date('Y-m-d');
$all_db = array(
	"1" => array('name' => "pawanlog_attrans", 	'user' => "pawanlog_attrans",	'password' => "admin@2411",	'host'=> "localhost"),
);

if (!file_exists($backup_path . $date)) {
	mkdir($backup_path . $date, 0755, true);
}

foreach($all_db as $db){		
	$file_name = $backup_path . $date . '/' . $date . '.sql';
	
	if (!file_exists($file_name)) {
		unlink($file_name);
	}

	echo exec("mysqldump --user='".$db['user']."' --password='".$db['password']."' --host='".$db['host']."' ".$db['name']." > $file_name");
}
?>