<?php
/************************************************************************/
/* Maximus CMS: Web Portal System                                       */
/* ==============================                                       */
/*                                                                      */
/* Copyright (c) 2002 - 2006                                            */
/* http://www.php-maximus.fr                                            */
/* dev@php-maximus.org                                                  */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/
/* Based on PHP-NUKE: Web Portal System                                 */
/************************************************************************/
if (!defined('ADMIN_ALLOW') && !defined('ADMIN_MAX')) {
	die ("Access Denied");
}
if ($acces == 1) {
if($admintest && $adminsecu)  {

if (!defined('SECUR_MAX')) {
	die ();
}

  $backupdir = $cache."/Backups/Database/";
  $today = getdate();
  $day = $today['mday'];
  if ($day < 10) {
     $day = "0$day";
  }
  $month = $today['mon'];
  if ($month < 10) {
     $month = "0$month";
  }
  $year = $today['year'];
  $hour = $today['hours'];
  if ($hour < 10) {
     $hour = "0$hour";
  }
  $min = $today['minutes'];
  if ($min < 10) {
     $min = "0$min";
  }
  $sec = "00";

  system(sprintf(
   'mysqldump --opt -h %s -u %s -p%s %s | gzip > %s/%s/%s-%s-%s-%s@%s:%s.sql.gz',
   $dbhost,
   $dbuname,
   $dbpass,
   $dbname,
   $doc_root,
   $backupdir,
   $dbname,
   $day,
   $month,
   $year,
   $hour,
   $min
  ));

redirect_url("".$admin_file.".php?op=database");
die();
}
}else {
	echo "Access Denied";
}