<?php

require_once 'classes/class.dbutil.php';
require_once 'classes/class.users.php';
require_once 'classes/class.user.php';
require_once 'classes/class.buildings.php';
require_once 'classes/class.building.php';
require_once 'config.php';
$DB = new DBUtil(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
// DB name
if ($DB) {
    $UserUtil = new UserUtil($DB);
    $BuildingUtil = new BuildingUtil($DB);
    $user = new User(null, 'example', '*****@*****.**');
    $user->setPassword('a-password');
    $user = $UserUtil->create($user);
    if ($user != null) {
        echo '<strong>UserUtil->create()</strong>';
        echo '<pre>';
        print_r($user);
        echo '</pre>';
    } else {
        echo "A problem ocurred while trying to create the user";
    }
    if ($user != null) {
        $id = $user->getId();
        $user2 = $UserUtil->getUserById($id);
        if ($user2 != null) {
            echo '<strong>UserUtil->getUserById()</strong>';
            echo '<pre>';
            print_r($user2);