Ejemplo n.º 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;
Ejemplo n.º 2
0
    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)) {
    $oprHours = $oprHours[0];
}