<?php

session_start();

ini_set("memory_limit","-1");

require 'authenticate.user.php';

require 'configuration.php';

require_once 'includes/common.functions.php';

/* ACTIVATE THE TAB */

$activeTab = 'Administration';



if ($_POST['exportform'] == 1)

{

	$nodata   = false;      #!DO NOT DUMP TABLES DATA

	$nostruct = false;      #!DO NOT DUMP TABLES STRUCTURE

	if ($_POST['compress'] == 1)

		$gzip     = true;      #!DO GZIP OUTPUT

	else

		$gzip     = false;      #DO PLAIN TEXT OUTPUT

	

	$link = mysql_connect("$dbhost", "$dbuser", "$dbpassword",false,MYSQL_CLIENT_COMPRESS);

	require_once("classes/class_mysqldump.php");

	$dump = new MySQLDump();

	$dbdata =  $dump->dumpDatabase($dbname,$nodata,$nostruct);

	mysql_close($link);

	if($gzip == false){

	$dump->sendAttachFile($dbdata,'text/html','sql_dump.sql');}else{

	$dump->sendAttachFileGzip($dbdata,'sql_dump.sql.gz');}

}

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Segnant Mailer - Export Database</title>

<link rel="stylesheet" type="text/css" href="includes/css/segnantmailer.css" />

<link rel="stylesheet" href="includes/css/themes/blue/style.css" type="text/css"  media="print, projection, screen" />

<link rel="stylesheet" type="text/css" href="includes/css/paging.css"  />

<script type="text/javascript" src="includes/js/jquery-1.3.2.min.js"></script>

<script type="text/javascript" src="includes/js/common.jquery.js"></script>

<script type="text/javascript" src="includes/js/managesuperuser.jquery.js"></script>

<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />

</head>

<body>

<table width="100%" border="0" cellspacing="0" cellpadding="0">

  <tr>

    <td height="79" class="headerbg"><? require_once 'includes/inc.header.php' ?>    

    </td>

  </tr>

  <tr>

    <td class="canvas" height="300" valign="top"><table width="100%" border="0" cellspacing="10" cellpadding="4">

      <tr>

        <td colspan="2" class="heading" height="50" valign="top">Export Database</td>

        </tr>

      <tr>

        <td colspan="2" bgcolor="#eaeaea" style="padding:10px;">

        <table cellspacing="0" cellpadding="0" class="tabtable" >

<tr>

<?php

$file = basename($_SERVER['PHP_SELF']);



## ADD EXCEPTIONS



$tabArray = array("<td nowrap=\"nowrap\" style=\"cursor:pointer;\" onclick=\"javascript:window.location.href='managesmtp.php'\"> Manage Mailers </td>",

		"<td nowrap=\"nowrap\" style=\"cursor:pointer;\" onclick=\"javascript:window.location.href='settings.php'\"> General Settings </td>",

		"<td nowrap=\"nowrap\" style=\"cursor:pointer;\" onclick=\"javascript:window.location.href='db_dump.php'\"> Export Database </td>"

		);

foreach ($tabArray as $key => $val)

{

	$strpos = strpos($val, $file);



	if ($strpos > 0)

	{

		$newString = str_replace('style="cursor:pointer;"','style="cursor:pointer;" class="active" ',$val);

		echo $newString;

	}

	else

	{

		echo $val;

	}	

}

?>

</tr>

</table>

        <table width="100%" border="0" cellspacing="0" cellpadding="4">

                <tr>

                  <td height="405" bgcolor="#FFFFFF" valign="top"><table width="100%" border="0" cellspacing="1" cellpadding="1">

                      <tr>

                        <td class="pageHeading">Export MySQL Database</td>

                      </tr>

                      <tr>

                        <td height="15" valign="top" align="right">&nbsp;</td>

                      </tr>

                      <tr>

                        <td><h2>Dump your MySQL Database</h2></td>

                    </tr>

                      <tr>

                        <td><p>It is highly recommended that you take backup of your database on regular intervals. This utility will create SQL script for your database. If your database size is large then prefer to check the gZip compress checkbox below. This will compress your database and the download time will drastically decrease. You need to uncompress the file using WinRAR or another utility.                        

                          </p>

                          <br /><br />

                          <form name="frmexport" method="post" action="db_dump.php" >

                          <input type="checkbox" name="compress" value="1" /> <strong>Enable gZip compression</strong><br />

                          

                          <input type="image" name="export" src="images/export.png" style="margin-top: 4px; margin-bottom: 4px;" />

                          <input type="hidden" name="exportform" value="1" />

                          </form>

                          </td>

                    </tr>

                    </table></td>

                </tr>

              </table></td>

      </tr>

    </table></td>

  </tr>

<? require_once 'includes/inc.footer.php' ?>

</table>

</body>

</html>

