Example #1
0
function InitializeConfig()
{
    global $config_db_name, $config_db, $version;
    // Configuration Database
    $config_db_name = dirname(__FILE__) . '/rest.config.sqlite3';
    try {
        $config_db = new PDO("sqlite:{$config_db_name}");
        $config_db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    } catch (PDOException $ex) {
        // Print PDOException message
        die($ex->getMessage());
    }
    // Check for configuration DB
    if (file_exists($config_db_name)) {
        // $this->showMessage("DB Found");
        // Check for Versioning Table
        if (!checkTable('version')) {
            // $this->showMessage("Versioning Table Missing");
            createVersionTable();
        }
        // Check Table Version
        $tblVer = checkTableVersion('version', $version);
        if ($tblVer === false) {
            // $this->showMessage('Adding Version Details');
            addVersionRecord('version');
        }
        if ($tblVer === -99) {
            // $this->showMessage('Updating Version Details');
            updateVersionRecord('version');
        }
        // Check Users Table
        if (!checkTable('users')) {
            createUsersTable();
        } else {
            // Check Version
            $tblVer = checkTableVersion('users', $version);
        }
        // Load Database Configurations
        loadDBConnections();
        // Load Published Tables
        loadPublishedTables();
        // Load System Settings
        loadSettings();
    } else {
        die("Sorry, system cannot be setup configuration file....");
    }
}
function main($registerKey)
{
    require '../includes/connect.php';
    createUsersTable();
    if (isset($_GET['register']) && $_GET['register'] == true) {
        registerUser($registerKey);
    } elseif (isset($_GET['username']) && isset($_GET['password'])) {
        autheticateUser();
    }
    //end of issets
}
Example #3
0
<?php

require 'dbadapter.php';
require_once 'admin-auth.php';
createUsersTable();
createHousesTable();
createRoomsTable();
createBillsTable();
createDatesTable();
createPurchasesTable();
include_once 'header.php';
?>
    <p>Tables created successfully.</p>
<?php 
include_once 'footer.php';
Example #4
0
function createTables()
{
    //blog title name
    $inputHost = $_POST[form_host];
    //blog is the name of the text field
    $inputUser = $_POST[form_user];
    //blog title name
    $inputPassword = $_POST[form_password];
    //blog is the name of the text field
    $inputDataBase = $_POST[form_database];
    if (!empty($inputHost) && !empty($inputUser) && !empty($inputPassword) && !empty($inputDataBase)) {
        createUsersTable();
        checkIfUserExists('1', 'bfusterg', '904deeaf9fdc44dd75e17954d10f21889ce8669a', 'Beatriz', 'Fuster', '*****@*****.**', 'student');
        checkIfUserExists('2', 'jrtundidor', '1d1f7b626bbd3efa49c7b5ac68a88fdd3d60a7a0', 'Jaime', 'Ruiz', '*****@*****.**', 'student');
        checkIfUserExists('3', 'andreagm', '90fd7547a62150eed1b1354f7814366775784440', 'Andrea', 'Gomez', '*****@*****.**', 'student');
        checkIfUserExists('4', 'jlamber4', '0efa0f43d9f28d92c0ab6b8611c039f29270dfc7', 'Jason', 'Lambert', '*****@*****.**', 'professor');
        checkIfUserExists('5', 'phuang9', '375eeeeccd8f6f249f182b5284710e6338b669a4', 'Peisong', 'Huang', '*****@*****.**', 'professor');
        checkIfUserExists('6', 'carlson', '9753456e0298e686b5eb1d5ef1019a7f31fc44dd', 'Carl', 'Carlson', '*****@*****.**', 'professor');
        checkIfUserExists('7', 'mschray', '9b612414e1804c937d5305eecdfc3a942604db9d', 'Martin', 'Schray', '*****@*****.**', 'professor');
        createSubjectsTable();
        checkIfSubjectExists('1', 'ITMD-555-02', 'Intelligent Device Application', 'E1', '241', 'Peisong Huang', 'Fall');
        checkIfSubjectExists('2', 'ITMD-562-01', 'Web Site Development', 'E1', '104', 'Jason Lambert', 'Fall');
        checkIfSubjectExists('3', 'ITMD-555-01', 'Intelligent Device Application', 'Tech Business Center', 'Idea Shop', 'Martin Schray', 'Fall');
        checkIfSubjectExists('4', 'ITMM-581', 'IT Entrepreneurship', 'E1', '121', 'Carl Carlson', 'Fall');
        createEnrollmentTable();
    }
}