Example #1
0
    exit;
}
if (isset($_GET["database"])) {
    database_table_list();
    exit;
}
if (isset($_GET["databases-list"])) {
    databases_list_json();
    exit;
}
if (isset($_GET["tables-list"])) {
    database_table_list_json();
    exit;
}
if (isset($_POST["mysql-add-db"])) {
    database_create();
    exit;
}
if (isset($_POST["dropdb"])) {
    database_drop();
    exit;
}
if (isset($_POST["mysql-empty"])) {
    table_empty();
    exit;
}
if (isset($_GET["mysql-scan"])) {
    mysql_scan();
    exit;
}
js();
*	Serial:		120429
*	by:			M.Karminski
*
*/
//Include files
include 'etc/config.php';
//Define the global database connection var
$DB_CONNECTION = mysql_connect($DB_HOST, $DB_USER, $DB_PASS);
//Database connect status
if ($DB_CONNECTION) {
    //print "Database connect success.<br />";
} else {
    print "Error:Databse connect fail.<br />";
}
//Create the database if not exists
database_create($DB_NAME, $DB_CONNECTION);
//------  -[ database_create function ]-  ------
function database_create($database_name, $database_connection)
{
    $database_name;
    //For database name
    $database_connection;
    //For database connection
    if (!mysql_select_db($database_name, $database_connection)) {
        print "Error:System could not select database and creating a new database now.<br />";
        if (mysql_query('Create database ' . $database_name)) {
            print "New database has been created.<br />";
        } else {
            die("Error:System can not create database, please check settings.<br />");
        }
    } else {