<?php require_once "../includes/session.php"; require_once "../includes/db_connection.php"; require_once "../includes/functions.php"; if (isset($_POST["submit"])) { $user_id = mysqli_real_escape_string($connection, $_POST["user_id"]); $episode_id_list = mysqli_real_escape_string($connection, $_POST["episode_id_list"]); $episode_id_array = explode(" ", $episode_id_list); if (check_existance_by_id("users", "id", $user_id)) { foreach ($episode_id_array as $id) { if (check_existance_by_id("episodes", "EpID", $id)) { delete_favorite($user_id, $id); } } } }
if (!isset($_GET["user"])) { set_error_output("Favorite deletion failed. User not selected.", "index.php"); } else { if ($_SESSION["user_id"] != $_GET["user"]) { set_error_output("Favorite deletion failed. ", "index.php"); } else { if (!isset($_GET["episode"])) { set_error_output("Favorite deletion failed. Episode not selected. ", "search.php?epname="); } else { if (!check_existance_by_id("episodes", "EpID", $_GET["episode"])) { set_error_output("Episode does not exist.", "search.php?epname="); } else { if (!check_existance_by_id("users", "id", $_GET["user"])) { set_error_output("User does not exist. ", "index.php"); } else { if (!already_favorite($_GET["user"], $_GET["episode"])) { set_error_output("You never favorited that", "video.php?e=" . urlencode($_GET["episode"])); } } } } } } } if (!delete_favorite($_GET["user"], $_GET["episode"])) { set_error_output("Favorite deletion failed. Database error.", "video.php?e=" . urlencode($_GET["episode"])); } ?> Favorite:<i class="fi-like" id="video_info_panel_favorite_icon"></i>