// Only load the classes in case the user submitted the form if ($_POST) { // Load the classes and create the new objects require_once 'includes/core_class.php'; require_once 'includes/database_class.php'; $core = new Core(); $database = new Database(); // Validate the post data if ($core->validate_post($_POST) == true) { // First create the database $database->create_database($_POST); // Fill the database with the default data $database->create_tables($_POST); // Check to see if the user wants to insert dummy data if (isset($_POST['dummy_data'])) { $database->dummy_data($_POST); } // Write the config file if ($core->write_config($_POST) == false) { $message = $core->show_message('error', "The config file could not be written, please chmod PyroCMS's database.php file to 777"); } // Check to see if any errors popped up if (!isset($message)) { // Display the message $message = $core->show_message('success', 'PyroCMS has been installed succesfully'); } } else { $message = $core->show_message('error', 'Not all fields have been filled in correctly. The host, username and database name are required.'); } } ?>
require_once 'includes/database_class.php'; $core = new Core(); $database = new Database(); // Validate the post data if ($core->validate_post($_POST) == true) { // First create the database if ($database->create_database($_POST) == false) { $message = $core->show_message('error', "The database could not be created, please verify your settings."); } // Fill the database with the default data if ($database->create_tables($_POST) == false) { $message = $core->show_message('error', "The database tables could not be created, please verify your settings."); } // Check to see if the user wants to insert dummy data if (isset($_POST['dummy_data'])) { if ($database->dummy_data($_POST) == false) { $message = $core->show_message('error', "The dummy data could not be inserted, please verify your settings."); } } // Write the config file if ($core->write_config($_POST) == false) { $message = $core->show_message('error', "The database configuration file could not be written, please chmod PyroCMS's database.php file to 777"); } // Check to see if any errors popped up if (!isset($message)) { // Display the message $message = $core->show_message('success', 'PyroCMS has been installed succesfully'); } } else { $message = $core->show_message('error', 'Not all fields have been filled in correctly. The host, username and database name are required.'); }