Example #1
0
<?php

error_reporting(0);
//Setting this to E_ALL showed that that cause of not redirecting were few blank lines added in some php files.
$db_config_path = '../application/config/database.php';
// 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, then create tables, then write config file
        if ($database->create_database($_POST) == false) {
            $message = $core->show_message('error', "The database could not be created, please verify your settings.");
        } else {
            if ($database->create_tables($_POST) == false) {
                $message = $core->show_message('error', "The database tables could not be created, please verify your settings.");
            } else {
                if ($core->write_config($_POST) == false) {
                    $message = $core->show_message('error', "The database configuration file could not be written, please chmod application/config/database.php file to 777");
                }
            }
        }
        // If no errors, redirect to registration page
        if (!isset($message)) {
            $redir = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on" ? "https" : "http";
            $redir .= "://" . $_SERVER['HTTP_HOST'];
            $redir .= str_replace(basename($_SERVER['SCRIPT_NAME']), "", $_SERVER['SCRIPT_NAME']);
Example #2
0
session_start();
error_reporting(0);
//Setting this to E_ALL showed that that cause of not redirecting were few blank lines added in some php files.
$db_config_path = '../application/config/database.php';
// 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, then create tables, then write config file
        $db_create = $database->create_database($_POST);
        if ($db_create['success'] == false) {
            $message = $core->show_message('error', $db_create['msg']);
        } else {
            if ($database->create_tables($_POST) == false) {
                $message = $core->show_message('error', "The database tables could not be created, please verify your settings.");
            } else {
                if ($core->write_config($_POST) == false) {
                    $message = $core->show_message('error', "The database configuration file could not be written, please chmod install/config/database.php file to 777");
                }
            }
        }
        // If no errors, redirect to login page
        if (!isset($message)) {
            $redir = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on" ? "https" : "http";
            $redir .= "://" . $_SERVER['HTTP_HOST'];
Example #3
0
 require_once 'includes/database_class.php';
 require_once 'includes/jsonrpcclient.php';
 require_once 'includes/core_class.php';
 $database = new Database();
 $core = new Core();
 // Validate the post data
 if ($core->validate_post($_POST) == true) {
     $btc_conn_url = (isset($_POST['ssl']) && $_POST['ssl'] == '1' ? 'https://' : 'http://') . $_POST['btc_username'] . ':' . $_POST['btc_password'] . '@' . $_POST['btc_ip'] . ':' . $_POST['btc_port'] . '/';
     $bitcoin = new Jsonrpcclient(array('url' => $btc_conn_url));
     $data = $_POST;
     $data['encryption_key'] = $core->random_key_string();
     // First create the database, then create tables, then write config file
     if ($bitcoin == NULL || $bitcoin->getinfo() == NULL) {
         $message = "Unable to make connection to the bitcoin daemon. Is it running? Are your settings correct?";
     } else {
         if ($database->create_database($data) == false) {
             $message = $core->show_message('error', "The database could not be created, please verify your settings.");
         } else {
             if ($database->create_tables($data) == false) {
                 $message = $core->show_message('error', "The database tables could not be created, please verify your settings.");
             } else {
                 if ($core->write_database_config($data) == false) {
                     $message = $core->show_message('error', "The database configuration file covuld not be written, please chmod application/config/database.php file to 777");
                 } else {
                     if ($database->add_config_entries($data) == false) {
                         $message = $core->show_message('error', 'error db config');
                     } else {
                         if ($core->write_config_config($data) == false) {
                             $message = $core->show_message('error', "Unable to write config.");
                         } else {
                             if ($core->write_bitcoin_config($data) == false) {
Example #4
0
<?php

// 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.');
    }