$watchlist = new Watchlist(); $post = new MediaPost(); if ($_SERVER['REQUEST_METHOD'] === 'POST') { if (!empty($_POST['title'])) { $media_id = $post->getMediaIdByTitle($_POST['title']); $watchlist->storeListMedia($_SESSION['authenticated_user'], $media_id); } } else { if ($_SERVER['REQUEST_METHOD'] === 'GET') { if (!empty($_GET['remove_media'])) { $media_id = $_GET['remove_media']; $watchlist->removeMediaFromWatchlist($_SESSION['authenticated_user'], $media_id); } } } $list_items = $watchlist->getWatchlistForUser($_SESSION['authenticated_user']); if ($list_items) { while ($list_item = $list_items->fetch_object()) { echo '<div class="well"><div class="page-header"><h3>'; $media = $post->getMediaById($list_item->media); echo $media->title; echo "</h3>"; echo "<a class='btn btn-danger btn-sm' href='user_watchlist.php?remove_media="; echo $media->id; echo "'>Remove from Watchlist</a>"; echo "</div></div>"; } } if ($list_items->num_rows === 0) { ?> <div class="well">
if ($_SERVER['REQUEST_METHOD'] === 'POST') { if (!empty($_POST['friend_email'])) { $new_friend_id = $user->getIdByEmail($_POST['friend_email']); if (!$new_friend_id) { echo "<h2 style='color: white; background-color: #d61616;'>User not found with email address " . $_POST['friend_email'] . ". Try again.</h2>"; } else { $date_created = date("Y-m-d H:i:s"); $watchlist->addNewBoy($_SESSION['authenticated_user'], $new_friend_id, $date_created); } } } $this_user = $_SESSION['authenticated_user']; $friends = $watchlist->getMyBoys($this_user); if ($friends) { while ($friend = $friends->fetch_object()) { $friend_watchlist = $watchlist->getWatchlistForUser($friend->friend); $url_string = "conversation.php?friend_id=" . $friend->friend; $user_email = $post->getUserById($friend->friend)->email; ?> <div class="well"> <div class="page-header"> <div class="row"> <div class="col-md-8"> <a href="<?php echo $url_string; ?> "> <h3><?php echo $user->getFullNameById($friend->friend); ?> </h3>