<?php include_once '../database/connection.php'; include_once '../database/users.php'; include_once '../database/events.php'; include_once '../database/comments.php'; $event = getEventById($_GET['id']); if ($event == null) { header('Location: ../index.php'); } $title = $event['title']; include_once '../templates/header.php'; if (!isset($_SESSION['userId'])) { header('Location: ../index.php'); } $comments = getComments($_GET['id']); include_once '../templates/event.php'; include_once "../templates/comments_list.php"; include_once '../templates/footer.php';
$out = getUpcomingEvents($_POST['id_user']); break; case 'getEventBySportName': $out = getEventBySportName($_POST['name_sport'], $_POST['name_location'], $_POST['date']); break; case 'getNewEventsForUser': $out = getNewEventsForUser($_POST['id_user']); break; case 'updateChatForEvent': $out = updateChatForEvent($_POST['id_event'], $_POST['chat']); break; case 'getCurrentLobbyByUserId': $out = getCurrentLobbyByUserId($_POST['id_user']); break; case 'getEventById': $out = getEventById($_POST['id_event']); break; case 'getChatForEventLobby': $out = getChatForEventLobby($_POST['id_event']); break; case 'getEventInfoById': $out = getEventInfoById($_POST['id_event']); break; case 'getSoonestEvent': $out = getSoonestEvent($_POST['id_user']); break; case 'getFriendlistForUser': $out = getFriendlistForUser($_POST['id_user']); break; case 'changeLobbyStateForUser': $out = changeLobbyStateForUser($_POST['id_event'], $_POST['id_user']);
function returnEventOfUser($idUser, $idEvent) { global $db; $result = getEventById($idEvent); //e privado if ($result[0]['private']) { $stmt = $db->prepare('SELECT * FROM InvitedTo WHERE idEvent = :idEvent AND idUser = :idUser'); $stmt->bindParam(':idUser', $idUser, PDO::PARAM_INT); $stmt->bindParam(':idEvent', $idEvent, PDO::PARAM_INT); $stmt->execute(); $res = $stmt->fetchAll(); if (count($res) > 0) { return $result[0]; } return false; } else { return $result[0]; } }