define('USER_BROWSER_AGENT', 'OTHER');
                }
            }
        }
    }
}
$mime_type = USER_BROWSER_AGENT == 'IE' || USER_BROWSER_AGENT == 'OPERA' ? 'application/octetstream' : 'application/octet-stream';
$now = gmdate('D, d M Y H:i:s') . ' GMT';
$filename = $dbname . "-" . date("d-m-y");
$ext = "sql";
$crlf = define_crlf();
// Send headers
if ($output == true) {
    header('Content-Type: ' . $mime_type);
    header('Expires: ' . $now);
    header('Content-Disposition: attachment; filename="' . $filename . '.' . $ext . '"');
    // lem9 & loic1: IE need specific headers
    if (USER_BROWSER_AGENT == 'IE') {
        header('Content-Disposition: inline; filename="' . $filename . '.' . $ext . '"');
        header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
        header('Pragma: public');
    } else {
        header('Content-Disposition: attachment; filename="' . $filename . '.' . $ext . '"');
        header('Pragma: no-cache');
    }
    mysqlbackup($host, $dbname, $uname, $upass, $structure_only, $crlf);
} else {
    echo "<pre>";
    echo htmlspecialchars(mysqlbackup($host, $dbname, $uname, $upass, $structure_only, $crlf));
    echo "</PRE>";
}
**   Wiki:     http://wiki.nubuilder.com
**   Forums:   http://forums.nubuilder.com
*/
$sd = $_GET['sd'];
header("Content-disposition: attachment;filename={$sd}.sql");
include '../' . $_GET['sd'] . '/database.php';
include 'common.php';
//--
//		$return[0]=$DBHost;
//		$return[1]=$DBName;
//		$return[2]=$DBUserID;
//		$return[3]=$DBPassWord;
//		return $return;
//
$dbInfo = nuRunQuery('');
mysqlbackup($dbInfo[0], $dbInfo[1], $dbInfo[2], $dbInfo[3], '', false);
function mysqlbackup($host, $dbname, $uid, $pwd, $output, $structure_only)
{
    //this function creates a text file (or output to a HTTP connection), that when parsed through MYSQL's telnet client, will re-create the entire database
    //Parameters:
    //    $host: usually "localhost" but depends on where the MySQL database engine is mounted
    //    $dbname : The MySQL database name
    //    $uid : the database's username (not your account's), leave blank if none is required
    //    $pwd : the database's password
    //    $output : this is the complete filespec for the output text file, or if you want the result SQL to be sent back to the browser, leave blank.
    //    $structure_only : set this to true if you want just the schema of the database (not the actual data) to be output.
    // **************
    // IMPORTANT: If you use this function, for personal or commercial use, AND you feel an overwhelming sense of gratitude that someone actually took the time and wrote it,
    // immediately go to your paypal account and send me $10 with a small comment of how and how much it helped! Set the payment recipient to woodystanford@yahoo.com .
    // **************
    if (strval($output) != "") {