<?php
// error_reporting(0);
// mysqli_report(MYSQLI_REPORT_OFF);
session_start();

$mysqli = new mysqli('localhost', 'root', '', '');

if ($mysqli->connect_errno) {
    throw new RuntimeException('mysqli connection error: ' . $mysqli->connect_error);
}

/* Set the desired charset after establishing a connection */
$mysqli->set_charset('utf8');

if ($mysqli->errno) {
    throw new RuntimeException('mysqli error: ' . $mysqli->error);
}

if (isset($_POST['database_name'])){
    $databaseName = $_POST['database_name'];
    $sql = "CREATE DATABASE IF NOT EXISTS $databaseName CHARACTER SET utf8 COLLATE utf8_general_ci;";
    $mysqli->query($sql);
    $_SESSION['message'] = 'Thanks, Database created successfully... Now proceed to importing the database';
    $_SESSION['message2'] = '<p><a href="bigdump.php">CLICK HERE TO PROCEED TO DATABASE IMPORT</p>';
}

header("location:index.php");

/* end of file */