function setUserGoesToEvent($idUser, $idEvent, $state) { global $db; if (getUserByID($idUser) == FALSE) { return FALSE; } if (getEventByID($idEvent) == FALSE) { return FALSE; } if ($state) { if (getUserGoesToEvent($idUser, $idEvent)) { return FALSE; } if (!userIsInvited($idUser, $idEvent)) { inviteToEvent($idUser, $idEvent); } $result = createUserToEvent($idUser, $idEvent); } else { if (!getUserGoesToEvent($idUser, $idEvent) && userIsInvited($idUser, $idEvent)) { return FALSE; } if (!userIsInvited($idUser, $idEvent)) { inviteToEvent($idUser, $idEvent); } $result = deleteUserToEvent($idUser, $idEvent); } return $result; }
<?php if (!isset($_GET['id'])) { die('No ID found'); } include_once 'database/connection.php'; include_once 'database/events.php'; session_start(); try { $event = getEventByID($_GET['id']); } catch (PDOException $e) { die($e->getMessage()); } include_once 'templates/header.php'; include_once 'templates/edit_event.php'; include_once 'templates/footer.php';
<!DOCTYPE html> <html> <?php include_once 'database/access_db.php'; include_once 'database/connect.php'; $types = retrieveAllEventTypes(); $event = getEventByID($idEvent); ?> <head> <link rel="stylesheet" href="css/edit_event.css"> </head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script> <script src="js/editEvent.js"></script> <script src="js/bridge.js"></script> <div id="edit_form"> <button id="close_create_event" onClick="closeEditEvent()" type="button"> <img src="images/template/x_button.png"> </button> <header id="edit_header" class="info"> <h1>Edit Event</h1> </header> <form id="edit" type="submit" method="post" action="php/editEvent.php" enctype="multipart/form-data"> <label for="title">Title:</label> <input type="text" id="title" name="title" placeholder="<?php echo $event['title'];
<head> <link rel="stylesheet" href="css/multiple_events.css"> </head> <div id="display_events"> <?php foreach ($events as $idEvent) { ?> <div class = "single_event"> <?php $event = getEventByID($idEvent['idEvent']); ?> <img class="event_image" src="<?php echo $event['image']; ?> "> <a class="event_name" href="mainpage.php?event=<?php echo $event['idEvent']; ?> "><h1><?php echo $event['title']; ?> </h1></a> <h3 class="event_date"><?php echo $event['eventDate']; ?> </h3> </div> <?php } ?>
?> "><?php echo getEventByID($event['idEvent'])['title']; ?> </a></li> <?php } ?> </ul> </li> <li class='has-sub'><a><span>Other Events</span></a> <ul> <?php foreach ($myInvitedEvents as $event) { ?> <li><a href="mainpage.php?event=<?php echo $event['idEvent']; ?> "><?php echo getEventByID($event['idEvent'])['title']; ?> </a></li> <?php } ?> </ul> </ul> </div>