Beispiel #1
0
<?php

session_start();
require_once '../../models/Restaurant_model.php';
$db = new Restaurant_model();
//echo '<br><br><br>in getResImages.php';
//exit();
$resId = intval(htmlspecialchars($_GET['resId']));
$offset = intval(htmlspecialchars($_GET['offset']));
if (isset($_SESSION['resId'])) {
    if ($resId != intval($_SESSION['resId'])) {
        //different resId, get new image array
        $_SESSION['resId'] = $resId;
        $_SESSION['resImages'] = $db->getRestaurantImages($resId);
    }
} else {
    //resId not set yet
    $_SESSION['resId'] = $resId;
    $_SESSION['resImages'] = $db->getRestaurantImages($resId);
}
$image = $_SESSION['resImages'][$offset]['media'];
//var_dump($resId);
//echo'<br>'; var_dump($offset); echo'<br>'; var_dump($image); exit();
header('Content-Type: image/jpeg');
echo $image;
Beispiel #2
0
require_once 'header.php';
require_once __DIR__ . '/../../models/Restaurant_model.php';
require_once __DIR__ . '/../../models/OperationHours_model.php';
require_once __DIR__ . '/../../models/Event_model.php';
require_once __DIR__ . '/../../controllers/Reservation_controller.php';
require_once __DIR__ . '/../../models/User_model.php';
$reservation;
if (!isset($reservation)) {
    $reservation = new Reservation_controller();
}
//sanitize $_POST array
$_POST = filter_input_array(INPUT_POST);
if ($_POST) {
    $reservationArray = $reservation->add();
}
$restaurantDb = new Restaurant_model();
$resId = array_key_exists('resid', $_GET) ? htmlspecialchars($_GET['resid']) : 0;
$restaurant = $restaurantDb->findRestaurantById($resId);
if (empty($restaurant)) {
    echo '<h1>Restaurant with $resId=' . $resId . ' does not exist </h1>';
    return;
}
$resName = $restaurant['name'];
$foodCategory = $restaurant['food_category_name'];
$description = $restaurant['description'];
$menu = base64_encode($restaurant['menu']);
$address = $restaurant['address'];
$phone = $restaurant['phone_no'];
//        $imgArray = $db->getRestaurantImages($resId);
$eventModel = new Event_model();
$events = $eventModel->getEventsByRestaurantId($resId);
Beispiel #3
0
    }
}
if (!isset($userModel) && isset($_SESSION['username']) && $_SESSION['role'] == 'user') {
    $userModel = new User_model();
    $userInfo = $userModel->getUser($_SESSION['username']);
    $userEmail = $userInfo['email'];
    $userName = explode(" ", $userInfo['name']);
    $userNameFirst = $userName[0];
    if (sizeof($userName) > 1) {
        $userNameLast = $userName[1];
    } else {
        $userNameLast = " ";
    }
}
if (!isset($db)) {
    $db = new Restaurant_model();
}
if (empty($foodCategoryArray)) {
    $foodCategoryArray = $db->getFoodCategories();
}
if (!isset($reservation)) {
    $reservation = new Reservation_controller();
}
if ($_POST) {
    $reservationArray = $reservation->add();
}
if ($_GET) {
    $nameAddCat = empty($_GET['searchText']) ? '%' : htmlspecialchars($_GET['searchText']);
    $currentPage = isset($_GET['pgnum']) ? htmlspecialchars($_GET['pgnum']) : 1;
    $totalCount = $db->findRestaurantsCount($nameAddCat);
    $restaurant_array = $db->findRestaurantsLimitOffset($nameAddCat, N_PER_PAGE, ($currentPage - 1) * N_PER_PAGE);
if (!isset($_SESSION)) {
    session_start();
}
require_once 'Controller.php';
require_once __DIR__ . '/../models/Restaurant_model.php';
require_once __DIR__ . '/../models/Owner_model.php';
require_once __DIR__ . '/../models/Event_model.php';
require_once __DIR__ . '/../models/Hostess_model.php';
require_once __DIR__ . '/../models/Login_model.php';
require_once __DIR__ . '/../models/OperationHours_model.php';
$username = $_SESSION['username'];
$ownerDb = new Owner_model();
$ownerInfo = $ownerDb->getOwnerInfo($username);
$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)) {