</script>
    </head>
    <body>
       <?php 
include 'header.php';
$user = __DIR__ . '/../../controllers/User_Controller.php';
require_once $user;
require_once '../../models/Login_model.php';
$db = new Login_model();
//         $flag = $_GET['checkUsername'];
//  if (isset($_GET['checkUsername']) && !empty($_GET['checkUsername'])) {
if ($_POST) {
    $user_controller = new User_controller();
    $user_controller->registerUser();
}
$existingUsernames = $db->getAllUsernames();
?>

        <div class="container">
            <h1 class="well">User Registration Form</h1>
            <div class="col-lg-12 well">
                <div class="row">
                    <form name="myForm" action="<?php 
echo htmlspecialchars($_SERVER["PHP_SELF"]);
?>
"
                          onsubmit="return validateForm()" method="post">
                        <div class="col-sm-12">
                            
                            <p>* indicates required field.</p>
                            <div class="row">
$resId = intval($ownerInfo['restaurant_id']);
$restaurantDb = new Restaurant_model();
$restaurantInfo = $restaurantDb->findRestaurantById($resId);
$restaurantImages = $restaurantDb->getRestaurantImages($resId);
$imageCount = count($restaurantImages) >= 4 ? 4 : count($restaurantImages);
//total number of images for the restaurant in multimedia table
$foodCategory = $restaurantDb->getFoodCategories();
$reviewArray = $restaurantDb->getRestaurantReviews($resId);
$oprDb = new OperationHours_model();
$oprHours = $oprDb->getOperatingHoursByRestaurantId($resId);
$eventDb = new Event_model();
$eventArray = $eventDb->getEventsByRestaurantId($resId);
$hostessDb = new Hostess_model();
$hostessArray = $hostessDb->getHostessByRestaurantId($resId);
$loginDb = new Login_model();
$existingUsernames = $loginDb->getAllUsernames();
if (!empty($oprHours)) {
    $oprHours = $oprHours[0];
}
if ($_POST) {
    /*
     * For uploading images
     */
    if (isset($_POST['image_type'])) {
        switch ($_POST['image_type']) {
            case 'profile':
                if (is_uploaded_file($_FILES['profile-image']['tmp_name'])) {
                    $thumbnail = file_get_contents($_FILES["profile-image"]["tmp_name"]);
                }
                if ($restaurantDb->updateRestaurantThumbnail($resId, $thumbnail)) {
                    $restaurantInfo = $restaurantDb->findRestaurantById($resId);