<?php
/**
 *  --------------------------------------------------------------   
 *  Export Import MYSQL Database 0.1.1
 *  Released    : August 2009
 *  Last Update : Feb 2010
 *  --------------------------------------------------------------
 *  File Definition 
 *  Example File 
 *  ---------------------------------------------------------------
 *  Run on PHP 5
 *  ---------------------------------------------------------------
 *  Developed by: Reazaul Karim - Rubel
 *  URI: http://reazulk.wordpress.com
 *  Contact: [email protected]
 *  Call: +8801717403818
 *  ---------------------------------------------------------------
 *  License text http://www.opensource.org/licenses/mit-license.php 
 *  About MIT license <http://en.wikipedia.org/wiki/MIT_License/>
 *  ---------------------------------------------------------------
 */


// Enable Error Reporting
error_reporting(E_ALL);


// Include  DBIimExport libs
include('dbimexport.php');

// Database configuration
$db_config = Array
            ( 
                'host' => "<HOST>",
                'user' => "<USER>",
                'password' => "<PASSWORD>",
                'database' => "<DATABASE NAME>",
            );

// Initiate  main class
$dbimexport = new dbimexport();
$dbimexport->addValue("db_config",$db_config);

// Flag to select step
$_GET['select'] = isset($_GET['select']) ? $_GET['select'] : "";

// Execute Optinos
switch( $_GET['select'] )
{
    case "download_inline"  :
                                    $dbimexport->addValue("download_path","")
                                               ->addValue("download",true)
                                               ->addValue("file_name","MyBackUp.xml")
                                               ->export();
                                    break;

    case "save_to_disc"     :
                                   $dbimexport->addValue("download_path","auto_save.xml")
                                               ->addValue("download",false)
                                               ->export();
                                   break;

    case "import":
                                   $dbimexport->addValue("import_path","auto_save.xml")
                                              ->import();
                                    break;
}

echo 
<<<EOD
<!-- HTML Options -->
<ul>
    <li> <a href="example.php?select=download_inline"> Download Inline</a></li>
    <li> <a href="example.php?select=save_to_disc"> Save in disc</a></li>
    <li> <a href="example.php?select=import"> Import From Disc [Run Save in disc]</a></li>
</ul>
<!-- HTML Options END -->

EOD;