function print_gallery_movies($movies) { global $baseURL, $dir; if (count($movies) > 0) { echo "<!-- Begin Movies-->\n"; ?> <script type="text/javascript"> function movie_player(movie,width,height) { var movie=window.open(movie,'','scrollbars=no,menubar=no,height='+height+',width='+width+',resizable=no,toolbar=no,location=no,status=no'); return false; } </script> <?php echo "<div id='movies'>\n"; echo "\t<h3>Movies</h3>\n"; echo "\t<ul>\n"; foreach ($movies as $movie) { if (hasExt($movie, array("mpg", "avi"))) { echo "\t\t<li><a target='_new' href=\"" . rrawurlencode($baseURL . $dir . $movie) . "\">"; echo "{$movie}</a> (" . getFileSize($scriptBase . $dir . $movie) . ")"; echo "</li>\n"; } if (hasExt($movie, "mov")) { echo "\t<li>\n"; echo "\t\t"; print_movie($movie, "qt_player"); echo "</li>\n"; } if (hasExt($movie, array("flv", "f4v", "mp4", "mp3"))) { echo "\t<li>\n"; echo "\t\t"; print_movie($movie, "swf_player"); echo "</li>\n"; } } echo "\t</ul>\n"; echo "</div>\n"; echo "<!-- End Movies-->\n\n"; } }
<?php /** * Created by PhpStorm. * User: Colin * Date: 2016-02-11 * Time: 7:53 PM * * Builds the list of Movies */ require_once "functions.php"; $movies = get_movies(); echo sizeof($movies) . " movies" . "<br/>"; foreach ($movies as $movie) { print_movie($movie); }
$SQL_SORT = " ORDER BY RAND(1) "; } $sql = 'SELECT movieid,title,year FROM movies ' . $SQL_FILTER . $SQL_SORT . "LIMIT {$start_movie_number} , {$movies_per_page}"; $stat = prepareStatement($sql); $stat->execute(); $rows = $stat->fetchAll(); foreach ($rows as $row) { $movieid = $row['movieid']; $title = $row['title']; $year = $row['year']; $sql = "SELECT rating FROM ratings WHERE movieid=? and userid=?"; $stat = prepareStatement($sql); $stat->bindParam(1, $movieid); $stat->bindParam(2, $userid); $stat->execute(); $res = $stat->fetchAll(); $data = array('tab' => 'movies'); $data['type'] = 'movie'; if (empty($res)) { $rating = -1; $data['rated'] = FALSE; } else { $data['rated'] = TRUE; $data['rating'] = $res[0]['rating']; } print_movie($movieid, $title, $year, $data); } //pager end if (!$no_pager) { print_paging('movies', $page, $movies_per_page, $tot_movies, 'movies'); }