<!DOCTYPE html>
<html lang='en'>
<?php 
$title = "Directors";
include '../includes/header.php';
include '../classes/MovieActorDBO.php';
// turn on errors
ini_set('display_errors', 'On');
$DBO = new MovieActorDB();
$rows = $DBO->query("SELECT director.id AS director_id, first_name, last_name, birthdate FROM person INNER JOIN director ON director.person_id = person.id ORDER BY first_name");
?>

<body>
  <?php 
include '../includes/navigation.php';
?>
;
  <div class="container theme-showcase" role="main">
    <div id="blockContent" class="page-header">
      <table id="mainTable" class="table table-bordered">
        <caption id='tableCaption'>Directors</caption>
        <thead>
          <td>First Name</td>
          <td>Last Name</td>
          <td>Born</td>
        </thead>

    <?php 
if (count($rows) > 0) {
    ?>
      <?php 
Esempio n. 2
0
<!DOCTYPE html>
<html lang='en'>
<?php 
$title = "People";
include '../includes/header.php';
include '../classes/MovieActorDBO.php';
// turn on errors
ini_set('display_errors', 'On');
$DBO = new MovieActorDB();
$rows = $DBO->query("SELECT person.id AS person_id, first_name, last_name, birthdate FROM person ORDER BY first_name");
?>
<body>
  <?php 
include '../includes/navigation.php';
?>
;
  <div class="container theme-showcase" role="main">
    <div id="blockContent" class="page-header">
      <table id="mainTable" class="table table-bordered">
        <caption id='tableCaption'>All People</caption>
          <thead>
            <td>First Name</td>
            <td>Last Name</td>
            <td>Born</td>
          </thead>

    <?php 
if (count($rows) > 0) {
    ?>
      <?php 
    foreach ($rows as $row) {
<!DOCTYPE html>
<html lang="en">
<?php 
session_start();
$title = "Write Title";
include '../includes/header.php';
include '../classes/MovieActorDBO.php';
// turn on errors
ini_set('display_errors', 'On');
$DBO = new MovieActorDB();
$_SESSION['review_title'] = $_GET['review_title'];
$title = str_replace("+", " ", $_SESSION['review_title']);
$rows = $DBO->query("SELECT mov_tv.title, mov_tv.release_country, media.id FROM media\n  INNER JOIN (SELECT title, media_id, release_country FROM (\n    (SELECT title, media_id, release_country FROM movie)\n    UNION ALL\n    (SELECT title, media_id, release_country from tvshow)\n   ) mov_tv\n  ) mov_tv ON mov_tv.media_id = media.id\n  WHERE title = '" . $title . "'");
$ratings_siteJSON = $DBO->queryJSON("SELECT id, name, max_rating FROM site");
if (count($rows) > 0) {
    ?>

<body>
<?php 
    include '../includes/navigation.php';
    ?>
<div class="container theme-showcase" role="main">
  <div id="blockContent" class="page-header">
    <table id="findReviewTable" class="table table-bordered">
      <thead>
        <td></td>
        <td>Title</td>
        <td>Release Country</td>
      </thead>

  <?php 
Esempio n. 4
0
<?php

$title = 'Movie/TV Show Database';
include 'includes/header.php';
include 'classes/MovieActorDBO.php';
// turn on errors
ini_set('display_errors', 'On');
$DBO = new MovieActorDB();
$query = "\n   SELECT COUNT(movie.id) AS info FROM movie\n   UNION ALL\n   SELECT COUNT(tvshow.id) FROM tvshow\n   UNION ALL\n   SELECT COUNT(tvshow_episode.id) FROM tvshow_episode\n   UNION ALL\n   SELECT COUNT(actor.id) FROM actor\n   UNION ALL\n   SELECT COUNT(director.id) FROM director\n   UNION ALL\n   SELECT COUNT(rating.id) FROM rating\n   UNION ALL\n   SELECT COUNT(site.id) FROM site\n   UNION ALL\n   SELECT COUNT(genre.id) FROM genre\n    ";
$summaryInfo = $DBO->query($query);
?>

<body>
<?php 
include 'includes/navigation.php';
?>
<div class="container theme-showcase" role="main">
    <div id="blockContent" class="page-header">
        <h3> Welcome! Use the navigation menu to find information on Movies and TV Shows </h3>
    </div>
    <section class="ivt-section">
      <div class="col-sm-8 col-8 col-xs-12 no-padding">
        <div class="ivt-name">
          <h1 id='title'>&nbsp;</h1>
          <ul>
            <li># Movies</li>
            <li># TV Shows</li>  
            <li># TV Show Episodes</li>
            <li># Actors</li>
            <li># Directors</li>
            <li># Ratings</li>
Esempio n. 5
0
<?php

$title = "Add Episode";
include '../classes/MovieActorDBO.php';
$DBO = new MovieActorDB();
$result = $DBO->queryJSON("SELECT episode_title, episode_number, season FROM tvshow_episode \n     WHERE tvshow_id = (SELECT id FROM tvshow WHERE title = '" . $_GET['tvshow'] . "') AND\n           episode_number = " . $_GET['number'] . " AND\n           season = " . $_GET['season'] . "");
$array = json_decode($result);
if (count($array) > 0) {
    echo $result;
} else {
    $insert = $DBO->queryJSON("INSERT INTO tvshow_episode (tvshow_id, airdate, episode_title, runtime, episode_number, season) VALUES\n       ((SELECT id FROM tvshow WHERE title = '" . $_GET['tvshow'] . "'), \n       '" . $_GET['date'] . "', '" . $_GET['title'] . "', " . $_GET['runtime'] . ", " . $_GET['number'] . ", " . $_GET['season'] . ")");
}
Esempio n. 6
0
<?php

$title = "Add Person";
include '../classes/MovieActorDBO.php';
// turn on errors
ini_set('display_errors', 'On');
$DBO = new MovieActorDB();
$DBO->query("INSERT INTO person(first_name, last_name, birthdate) VALUES ('" . $_GET['first_name'] . "', '" . $_GET['last_name'] . "', '" . $_GET['birthday'] . "')");
$role = $_GET['role'];
if (strcmp($role, "actor") == 0) {
    $DBO->query("INSERT INTO actor(person_id) VALUES ((SELECT id FROM person WHERE (first_name = '" . $_GET['first_name'] . "' AND last_name = '" . $_GET['last_name'] . "')))");
    if (strcmp($_GET['media'], "")) {
        echo $_GET['media'];
        $DBO->query("INSERT INTO media_actor(media_id, actor_id) VALUES\n        (" . $_GET['media'] . ", \n        (SELECT actor.id FROM actor \n          INNER JOIN person ON actor.person_id = person.id \n          WHERE (person.first_name = '" . $_GET['first_name'] . "' AND person.last_name = '" . $_GET['last_name'] . "')))");
    }
} else {
    $DBO->query("INSERT INTO director(person_id) VALUES ((SELECT id FROM person WHERE (first_name = '" . $_GET['first_name'] . "' AND last_name = '" . $_GET['last_name'] . "')))");
    if (strcmp($_GET['media'], "")) {
        echo $_GET['media'];
        $DBO->query("INSERT INTO media_director(media_id, director_id) VALUES\n        (" . $_GET['media'] . ", \n        (SELECT director.id FROM director \n          INNER JOIN person ON director.person_id = person.id \n          WHERE (person.first_name = '" . $_GET['first_name'] . "' AND person.last_name = '" . $_GET['last_name'] . "')))");
    }
}
Esempio n. 7
0
<!DOCTYPE html>
<html lang='en'>

<?php 
$title = "Add to DB";
include '../includes/header.php';
include '../classes/MovieActorDBO.php';
$DBO = new MovieActorDB();
$movieShowJSON = $DBO->queryJSON("\n    SELECT movie.title AS title, movie.media_id AS media_id FROM movie\n    UNION ALL\n    SELECT tvshow.title AS title, tvshow.media_id AS media_id  FROM tvshow\n    ORDER BY title ASC\n    ");
$tvShowJSON = $DBO->queryJSON("\n    SELECT title FROM tvshow\n    ORDER BY title ASC\n    ");
$genresJSON = $DBO->queryJSON("\n    SELECT genre.genre_type AS genre FROM genre\n      ORDER BY genre ASC\n      ");
?>
  <body>
  <?php 
include '../includes/navigation.php';
?>
  <div id="addContainer" class="container theme-showcase addForms" role="main">
    <div id="blockContent" class="page-header">
      <form class="addForms form-inline">
        <fieldset>
          <legend>Person</legend>
          <label for="first_name">First Name:</label>
          <input type="text" class="form-control" name="first_name" id="first_name">
          
          <label for="last_name">Last Name:</label>
          <input type="text" class="form-control" name="last_name" id="last_name">

          <label for="birthday">Birthday:</label>
          <input type="date" class="form-control" name="birthday" id="birthday">
          <input type="radio" name="role" id="role" value="actor" checked="checked"/>Actor
          <input type="radio" name="role" id="role" value="director"/>Director
Esempio n. 8
0
<?php

$title = "Get Site Max";
include '../classes/MovieActorDBO.php';
// turn on errors
ini_set('display_errors', 'On');
$DBO = new MovieActorDB();
$site = str_replace("+", " ", $_GET['site_name']);
$results = $DBO->queryJSON("SELECT max_rating FROM site WHERE site.name = '" . $site . "'");
echo $results;
Esempio n. 9
0
<!DOCTYPE html>
<html lang='en'>
<?php 
$title = "TV Shows";
include '../includes/header.php';
include '../classes/MovieActorDBO.php';
// turn on errors
ini_set('display_errors', 'On');
$DBO = new MovieActorDB();
$rows = $DBO->query("\n  SELECT id, title, start_year, end_year, release_country, content_rating FROM tvshow ORDER BY title\n  ");
?>

<body>
    <?php 
include '../includes/navigation.php';
?>
;
    <div class="container theme-showcase" role="main">
      <div id="blockContent" class="page-header">
        <table id="mainTable" class="table table-bordered">
          <caption id="tableCaption">TV Shows</caption>
          <thead>
              <td>TV Show Title</td>
              <td>Start Year</td>
              <td>End Year</td>
              <td>Release Country</td>
              <td>Content Rating</td>
          </thead>

      <?php 
if (count($rows) > 0) {
Esempio n. 10
0
<?php

$title = "Add Site";
include '../includes/header.php';
include '../classes/MovieActorDBO.php';
// turn on errors
ini_set('display_errors', 'On');
$DBO = new MovieActorDB();
$result = $DBO->query("INSERT INTO site (name, site_url, max_rating) VALUES ('" . $_GET['site_name'] . "', '" . $_GET['url'] . "', '" . $_GET['max'] . "')");
if (!$result) {
    die('Could not query:' . mysql_error());
}
echo mysql_result($result, 2);
Esempio n. 11
0
<?php

$title = "Add TV Show";
include '../classes/MovieActorDBO.php';
$DBO = new MovieActorDB();
$DBO->query("START TRANSACTION");
$DBO->query("INSERT INTO media (id) VALUES (null)");
if (!strcmp($_GET['end_year'], "")) {
    $DBO->query("INSERT INTO tvshow (title, media_id, start_year, release_country, content_rating)\n      VALUES ('" . $_GET['title'] . "', LAST_INSERT_ID(), " . $_GET['start_year'] . ", '" . $_GET['country'] . "', '" . $_GET['rating'] . "')");
} else {
    $DBO->query("INSERT INTO tvshow (title, media_id, start_year, end_year, release_country, content_rating)\n      VALUES ('" . $_GET['title'] . "', LAST_INSERT_ID(), " . $_GET['start_year'] . ", " . $_GET['end_year'] . ", '" . $_GET['country'] . "', '" . $_GET['rating'] . "')");
}
$DBO->query("COMMIT");
$result = $DBO->query("INSERT INTO tvshow_genre (tvshow_id, genre_id) VALUES\t\n    ((SELECT @tId := id FROM tvshow WHERE title = '" . $_GET['title'] . "'),(SELECT id FROM genre WHERE genre_type = '" . $_GET['genre'] . "'));");
Esempio n. 12
0
<!DOCTYPE html>
<html lang='en'>
<?php 
$title = "Movies";
include '../includes/header.php';
include '../classes/MovieActorDBO.php';
// turn on errors
ini_set('display_errors', 'On');
$DBO = new MovieActorDB();
if (count($_GET) > 0) {
    $startString = "SELECT movie.id AS movie_id, title, release_date, release_country, runtime, content_rating, GROUP_CONCAT(genre.genre_type ORDER BY genre.genre_type SEPARATOR ', ') AS genre_type FROM movie \n                    LEFT JOIN media ON media.id = movie.media_id\n                    LEFT JOIN movie_genre ON movie_genre.movie_id = movie.id \n                    LEFT JOIN genre ON genre.id = movie_genre.genre_id \n                    INNER JOIN (SELECT media.id FROM movie\n                                  LEFT JOIN movie_genre ON movie_genre.movie_id = movie.id\n                                  LEFT JOIN genre ON genre.id = movie_genre.genre_id\n                                  LEFT JOIN media ON media.id = movie.media_id ";
    $queryString = $startString;
    if ($_GET['directorFirst'] || $_GET['directorLast']) {
        $directorString = "INNER JOIN (SELECT media.id FROM media\n                                LEFT JOIN media_director ON media_director.media_id = media.id\n                                LEFT JOIN director on director.id = media_director.director_id\n                                LEFT JOIN person on person.id = director.person_id \n                                WHERE ";
        if ($_GET['directorFirst']) {
            $directorFirst = "first_name ";
            if (!strcmp($_GET['directorIn'], "IN")) {
                $directorFirst .= "= '" . $_GET['directorFirst'] . "' ";
            } else {
                $directorFirst .= "!= '" . $_GET['directorFirst'] . "' ";
            }
            $directorString .= $directorFirst;
        }
        if ($_GET['directorLast']) {
            $directorLast = "last_name ";
            if (!strcmp($_GET['directorIn'], "IN")) {
                $directorLast .= "= '" . $_GET['directorLast'] . "' ";
            } else {
                $directorLast .= "!= '" . $_GET['directorLast'] . "' ";
            }
            if (!strcmp(substr($directorString, -6), "WHERE ")) {
<?php

include '../../classes/MovieActorDBO.php';
$isGET = FALSE;
if (isset($_GET['id'])) {
    $isGET = TRUE;
    include '../../includes/header.php';
    $tvshow_id = $_GET['id'];
} else {
    $tvshow_id = $_POST['id'];
}
// turn on errors
ini_set('display_errors', 'On');
$DBO = new MovieActorDB();
$actorsQ = "\n    SELECT person.first_name AS fn, person.last_name AS ln, person.birthdate AS bd FROM tvshow \n        INNER JOIN media ON media.id=tvshow.media_id\n        INNER JOIN media_actor ON media_actor.media_id = media.id\n        INNER JOIN actor ON actor.id = media_actor.actor_id\n        INNER JOIN person ON person.id = actor.person_id    \n        WHERE tvshow.id=" . $tvshow_id . " \n        ORDER BY tvshow.title\n\n    ";
$directorsQ = "\n    SELECT person.first_name AS fn, person.last_name AS ln, person.birthdate AS bd FROM tvshow \n        INNER JOIN media ON media.id=tvshow.media_id\n        INNER JOIN media_director ON media_director.media_id = media.id\n        INNER JOIN director ON director.id = media_director.director_id\n        INNER JOIN person ON person.id = director.person_id    \n        WHERE tvshow.id=" . $tvshow_id . " \n        ORDER BY tvshow.title\n\n        ";
$tvshowQ = "\n  SELECT tvshow.title AS title, tvshow.start_year AS start_year, tvshow.end_year AS end_year, \n  tvshow.release_country AS release_country, tvshow.content_rating AS content_rating,\n    person.first_name AS first_name, person.last_name AS last_name,\n    GROUP_CONCAT(DISTINCT genre.genre_type ORDER BY genre.genre_type SEPARATOR ', ') AS genre_type\n    FROM tvshow \n      INNER JOIN media ON media.id=tvshow.media_id\n      INNER JOIN media_actor ON media_actor.media_id = media.id\n      INNER JOIN actor ON actor.id = media_actor.actor_id\n      INNER JOIN person ON person.id = actor.person_id    \n      INNER JOIN tvshow_genre ON tvshow_genre.tvshow_id = tvshow.id\n      INNER JOIN genre ON genre.id = tvshow_genre.genre_id\n      WHERE tvshow.id=" . $tvshow_id . " \n      ORDER BY title\n\n      ";
$episodesQ = "\n  SELECT tvshow_episode.airdate AS airdate, tvshow_episode.episode_title AS title, tvshow_episode.runtime AS runtime, tvshow_episode.season AS season, tvshow_episode.episode_number AS number FROM tvshow_episode\n    INNER JOIN tvshow ON tvshow.id = tvshow_episode.tvshow_id\n    WHERE tvshow.id=" . $tvshow_id . "\n    ORDER BY season, number ASC\n  ";
$ratingQ = "\n  SELECT rating.rating AS rating, rating.rating_url AS rating_url, site.name AS site_name, site.max_rating AS max_rating FROM tvshow\n    INNER JOIN media ON media.id = tvshow.media_id\n    INNER JOIN rating ON rating.media_id = media.id\n    INNER JOIN site ON site.id = rating.site_id\n    WHERE tvshow.id=" . $tvshow_id . "\n    ORDER BY site_name;\n  ";
$actorRows = $DBO->query($actorsQ);
$directorRows = $DBO->query($directorsQ);
$tvshowJSON = $DBO->queryJSON($tvshowQ);
$episodeRows = $DBO->query($episodesQ);
$ratingRows = $DBO->query($ratingQ);
if ($isGET) {
    echo "<body>";
    include '../../includes/navigation.php';
    echo '<div class="container theme-showcase" role="main">';
    //echo '<div id="blockContent" class="page-header jumbotron">';
}
?>
Esempio n. 14
0
<?php

$title = "Add Movie";
include '../classes/MovieActorDBO.php';
$DBO = new MovieActorDB();
$DBO->query("START TRANSACTION");
$DBO->query("INSERT INTO media (id) VALUES (null)");
$DBO->query("INSERT INTO movie (title, media_id, release_date, release_country, runtime, content_rating)  \n    VALUES ('" . $_GET['title'] . "', LAST_INSERT_ID(), '" . $_GET['release_date'] . "', '" . $_GET['country'] . "', '" . $_GET['run_time'] . "', '" . $_GET['rating'] . "')");
$DBO->query("COMMIT");
$result = $DBO->query("INSERT INTO movie_genre (movie_id, genre_id) VALUES\t\n    ((SELECT @mId := id FROM movie WHERE title = '" . $_GET['title'] . "'),(SELECT id FROM genre WHERE genre_type = '" . $_GET['genre'] . "'));");
<?php

include '../../classes/MovieActorDBO.php';
header('Content-type: application/json');
$response = [];
if (isset($_POST['id']) && isset($_POST['type'])) {
    $id = $_POST['id'];
    $type = $_POST['type'];
    $pattern = '/(.*)Item/';
    preg_match($pattern, $type, $matches);
    $type = $matches[1];
} else {
    $response['status'] = 'error';
}
$DBO = new MovieActorDB();
$query = '
  DELETE media_actor.*, media_director.* FROM ' . $type . '
      LEFT JOIN actor ON actor.person_id = ' . $type . '.id
      LEFT JOIN director ON director.person_id = ' . $type . '.id
      LEFT JOIN media_actor ON media_actor.actor_id = actor.id
      LEFT JOIN media_director ON media_director.director_id = director.id
      WHERE ' . $type . '.id =' . $id;
$result = $DBO->query($query);
$query = '
  DELETE actor.*, director.* FROM ' . $type . '
      LEFT JOIN actor ON actor.person_id = ' . $type . '.id
      LEFT JOIN director ON director.person_id = ' . $type . '.id
      WHERE ' . $type . '.id =' . $id;
$result = $DBO->query($query);
$query = '
  DELETE ' . $type . '.* FROM ' . $type . '
Esempio n. 16
0
<?php

$title = "Add Genre";
include '../classes/MovieActorDBO.php';
// turn on errors
ini_set('display_errors', 'On');
$DBO = new MovieActorDB();
$result = $DBO->query("INSERT INTO genre (genre_type) VALUES ('" . $_GET['genre'] . "')");
<?php

include '../../classes/MovieActorDBO.php';
$isGET = FALSE;
if (isset($_GET['id'])) {
    $isGET = TRUE;
    include '../../includes/header.php';
    $movie_id = $_GET['id'];
} else {
    $movie_id = $_POST['id'];
}
// turn on errors
ini_set('display_errors', 'On');
$DBO = new MovieActorDB();
$actorsQ = "\n    SELECT person.first_name AS fn, person.last_name AS ln, person.birthdate AS bd FROM movie \n        INNER JOIN media ON media.id=movie.media_id\n        INNER JOIN media_actor ON media_actor.media_id = media.id\n        INNER JOIN actor ON actor.id = media_actor.actor_id\n        INNER JOIN person ON person.id = actor.person_id    \n        WHERE movie.id=" . $movie_id . " \n        ORDER BY title\n\n    ";
$directorsQ = "\n    SELECT person.first_name AS fn, person.last_name AS ln, person.birthdate AS bd FROM movie \n        INNER JOIN media ON media.id=movie.media_id\n        INNER JOIN media_director ON media_director.media_id = media.id\n        INNER JOIN director ON director.id = media_director.director_id\n        INNER JOIN person ON person.id = director.person_id    \n        WHERE movie.id=" . $movie_id . " \n        ORDER BY title\n\n        ";
$movieQ = "\n  SELECT movie.title AS title, DATE_FORMAT(movie.release_date, '%M %d, %Y') AS release_date, movie.release_country AS release_country, movie.runtime AS runtime, movie.content_rating AS content_rating,\n    person.first_name AS first_name, person.last_name AS last_name,\n    GROUP_CONCAT(DISTINCT genre.genre_type ORDER BY genre.genre_type SEPARATOR ', ') AS genre_type\n    FROM movie \n      INNER JOIN media ON media.id=movie.media_id\n      INNER JOIN media_actor ON media_actor.media_id = media.id\n      INNER JOIN actor ON actor.id = media_actor.actor_id\n      INNER JOIN person ON person.id = actor.person_id    \n      INNER JOIN movie_genre ON movie_genre.movie_id = movie.id\n      INNER JOIN genre ON genre.id = movie_genre.genre_id\n      WHERE movie.id=" . $movie_id . " \n      ORDER BY title\n\n      ";
$ratingQ = "\n  SELECT rating.rating AS rating, rating.rating_url AS rating_url, site.name AS site_name, site.max_rating AS max_rating FROM movie\n    INNER JOIN media ON media.id = movie.media_id\n    INNER JOIN rating ON rating.media_id = media.id\n    INNER JOIN site ON site.id = rating.site_id\n    WHERE movie.id=" . $movie_id . "\n    ORDER BY site_name;\n  ";
$actorRows = $DBO->query($actorsQ);
$directorRows = $DBO->query($directorsQ);
$movieJSON = $DBO->queryJSON($movieQ);
$ratingRows = $DBO->query($ratingQ);
if ($isGET) {
    echo "<body>";
    include '../../includes/navigation.php';
    echo '<div class="container theme-showcase" role="main">';
    //echo '<div id="blockContent" class="page-header jumbotron">';
}
?>
<section class="ivt-section">
  <div class="col-sm-8 col-8 col-xs-12 no-padding">
Esempio n. 18
0
<?php

$title = "Insert Review";
include '../classes/MovieActorDBO.php';
$DBO = new MovieActorDB();
$result = $DBO->query("INSERT INTO rating (media_id, site_id, rating, rating_url) VALUES\n    (" . $_GET['media_id'] . ", \n    (SELECT site.id FROM site WHERE (site.name = '" . $_GET['site_name'] . "')),\n    " . $_GET['rating'] . ", '" . $_GET['url'] . "')");
?>