From b264ae0ee21e7ac731d73d00bed07c620753721d Mon Sep 17 00:00:00 2001 From: lukas Date: Sat, 16 May 2020 20:41:32 +0200 Subject: [PATCH] added old project files --- css/basicvideo.css | 76 ++++++++++++++++++ css/index__2.css | 6 ++ css/login.css | 3 + css/movies.css | 0 css/series.css | 1 + index.php | 37 +++++++++ js/login.js | 27 +++++++ js/movies.js | 94 +++++++++++++++++++++++ js/series.js | 55 +++++++++++++ movies.php | 79 +++++++++++++++++++ php/checkSessionValidity.php | 23 ++++++ php/checkpasswd.php | 10 +++ php/database.php | 20 +++++ php/db/getmoviefromdb.php | 36 +++++++++ php/db/savemovietodb.php | 42 ++++++++++ php/getmoviedata.php | 32 ++++++++ php/getseriesdata.php | 56 ++++++++++++++ php/mergescripts/getmoviejsondata.php | 47 ++++++++++++ php/mergescripts/getthumbnailsmovies.php | 46 +++++++++++ php/mergescripts/getthumbnailstvshows.php | 39 ++++++++++ series.php | 67 ++++++++++++++++ 21 files changed, 796 insertions(+) create mode 100755 css/basicvideo.css create mode 100755 css/index__2.css create mode 100755 css/login.css create mode 100755 css/movies.css create mode 100755 css/series.css create mode 100755 index.php create mode 100755 js/login.js create mode 100755 js/movies.js create mode 100755 js/series.js create mode 100755 movies.php create mode 100755 php/checkSessionValidity.php create mode 100755 php/checkpasswd.php create mode 100755 php/database.php create mode 100755 php/db/getmoviefromdb.php create mode 100755 php/db/savemovietodb.php create mode 100755 php/getmoviedata.php create mode 100755 php/getseriesdata.php create mode 100755 php/mergescripts/getmoviejsondata.php create mode 100755 php/mergescripts/getthumbnailsmovies.php create mode 100755 php/mergescripts/getthumbnailstvshows.php create mode 100755 series.php diff --git a/css/basicvideo.css b/css/basicvideo.css new file mode 100755 index 0000000..05f25fb --- /dev/null +++ b/css/basicvideo.css @@ -0,0 +1,76 @@ +.movietile{ + + height: 330px; + width: 200px; + float: left; + margin: 10px; + background-color: #F0F0F0; + position: relative; + + cursor: pointer; + border-radius: 25px; + + +} + +.movietile:hover{ + opacity: 0.7; +} + +.movietile-text{ + position: absolute; + text-align: center; /* todo doesnt work */ + bottom: 0; +} + +.movietile-thumbnail{ + height: 300px; + border-radius: 25px; +} + +#moviespace{ + +} + +#moviespace-video{ + max-width: 100%; + max-height: 100%; + width: 100%; + height: 100%; + display: inline-block; + vertical-align: middle; +} + +.hideit{ + display: none; +} + +.moviespace-heading{ + float: left; + margin-left: 20px; + margin-top: 20px; +} + +.moviespace-backbutton{ + float: left; + cursor: pointer; + color: white; + background-color: #404D5E; + border: none; + transition: all 0.2s ease-in-out; + width: 20%; + height: 40px; + margin-top: 20px; + margin-bottom: 20px; +} + +.moviespace-backbutton:hover{ + background: #E0B612; + color: white; + +} + +.btnloadmore{ + /* position: absolute; + bottom:0%; */ +} diff --git a/css/index__2.css b/css/index__2.css new file mode 100755 index 0000000..992edcb --- /dev/null +++ b/css/index__2.css @@ -0,0 +1,6 @@ +#thevideo { + max-width: 100%; + max-height: 100%; + display: inline-block; + vertical-align: middle; +} diff --git a/css/login.css b/css/login.css new file mode 100755 index 0000000..97d0329 --- /dev/null +++ b/css/login.css @@ -0,0 +1,3 @@ +.hideit{ + display: none; +} diff --git a/css/movies.css b/css/movies.css new file mode 100755 index 0000000..e69de29 diff --git a/css/series.css b/css/series.css new file mode 100755 index 0000000..8b13789 --- /dev/null +++ b/css/series.css @@ -0,0 +1 @@ + diff --git a/index.php b/index.php new file mode 100755 index 0000000..fbca19a --- /dev/null +++ b/index.php @@ -0,0 +1,37 @@ + + + + + Lukis Filme + + + + + + + + + + + + + +
+

Lukis Filme

+

Bitte Passwort eingeben:

+
+ Achtung! Du hast scheinbar das falsche Passwort eingegeben. +
+
+
+
+
+ + +
+ +
+
+
+ + diff --git a/js/login.js b/js/login.js new file mode 100755 index 0000000..e9eed16 --- /dev/null +++ b/js/login.js @@ -0,0 +1,27 @@ +$(document).ready(function() { + $("#myform").submit(function(event) { + event.preventDefault(); + // console.log($("#myform").serialize()); + checkpasswd($("#myform").serialize()); + // + }); +}); + +function checkpasswd(data) { + // console.log(data); + $.post('php/checkpasswd.php', data, function(retdata){ + if (retdata.valid == true) { + //successfully logged in + sessionStorage.LAST_ACTIVITY = Math.round(new Date().getTime() / 1000); + document.cookie = "LAST_ACTIVITY="+Math.round(new Date().getTime() / 1000); + window.location ="movies.php"; + return true; + }else { + $(".mypassalert").show(); + + setTimeout(function () { + $(".mypassalert").hide(); + }, 2000); + } + },'json'); +} diff --git a/js/movies.js b/js/movies.js new file mode 100755 index 0000000..89ce288 --- /dev/null +++ b/js/movies.js @@ -0,0 +1,94 @@ +//global variables: +var loadedVideos =0; +var allmovies = null; +var tempmovies = []; + +var tempscrollposition = null; + + +$(document).ready(function() { + $.post('php/db/getmoviefromdb.php','action=all',function(data){ + //console.log(data); + allmovies = data; + tempmovies = allmovies.data; + + loadNewPreviews(20); + },'json'); + + $(window).scroll(function() { + if($(window).scrollTop() + $(window).height() == $(document).height()) { + loadNewPreviews(10); + console.log("loadnew"); + } + }); + + $('.moviespace-backbutton').click(function() { + $('#moviespace').hide(); + $('.moviespace-videospace').html(""); + $('.movielist').show(); + $(window).scrollTop(tempscrollposition); + }); + + $("#moviesearch-form").submit(false); + + $("#moviesearch").change(function(event) { + console.log("change..."); + search(); + + }); + + $('#moviesearch-button').click(function(event) { + search(); + }); + + $('.btnloadmore').click(function() { + loadNewPreviews(10); + }); +}); + +function search() { + $(".movielist").html(""); + tempmovies = []; + loadedVideos = 0; + for (var i in allmovies.data) { + if(allmovies.data[i].name.toUpperCase().includes($("#moviesearch").val().toUpperCase())){ + tempmovies.push(allmovies.data[i]); + } + } + console.log(tempmovies.length); + if(tempmovies.length < 15){ + loadNewPreviews(tempmovies.length); + }else{ + loadNewPreviews(15); + } + +} + +function loadNewPreviews(number) { + for (var i = 0; i < number; i++) { + if (loadedVideos < tempmovies.length) { //maybe TODO + loadMoviePreview(tempmovies[loadedVideos]); + + loadedVideos++; + } + } +} + +function loadMoviePreview(data) { + var preview = $("
"+data.name+"
"); + $(".movielist").append(preview); + preview.click(function(event) { + tempscrollposition = $(window).scrollTop(); + $('.movielist').hide(); + var thisvideo = tempmovies[$(this).index()]; + $('#moviespace').show(); + $('.moviespace-videospace').html(""); + $('.moviespace-heading').html(thisvideo.name); + $.post('rsc/moviedatajson/'+thisvideo.name+'.json','',function(data){ + console.log(data); + $('.moviespace-infospace').html(data.overview); + },'json'); + + + }); +} diff --git a/js/series.js b/js/series.js new file mode 100755 index 0000000..a8d72eb --- /dev/null +++ b/js/series.js @@ -0,0 +1,55 @@ +var tempscrollposition = 0; + +$(document).ready(function() { + $.post('php/getseriesdata.php','action=getallseries',function(data){ + console.log(data); + // console.log("post finished"); + + for (var num in data.data) { + //insert a tile for each TV show... + var previewtvshow = $("
"+data.data[num].name+"
"); + $(".movielist").append(previewtvshow); + previewtvshow.click(function(event) { + var clickeditem = data.data[$(this).index()]; + + tempscrollposition = $(window).scrollTop(); + $('.movielist').hide(); + console.log(clickeditem); + $.post('php/getseriesdata.php','action=getseries&seriesname='+clickeditem.name,function(data){ + console.log(data); + + // TODO + // var seasons = []; +/* + var seasonold = ""; + for (var n in data.data) { + var filename = data.data[n].name; + var season = filename.substring(filename.length-5,filename.length-3); // TODO: + if (season != seasonold) { + seasons.push(season); + seasonold = season; + } + } + console.log("This tv show has "+seasons.length+" seasons");*/ + + $('.episodelist').html(""); + for (var i in data.data) { + var episode = $("
"+data.data[i].name+"
"); + $('.episodelist').append(episode); + episode.click(function(event) { + var clickeditem = data.data[$(this).index()]; + console.log(clickeditem); + $('.episodelist').hide(); + $('#moviespace').show(); + + $('.moviespace-videospace').html(""); + $('.moviespace-heading').html(clickeditem.name); + }); + } + },'json'); + $('.episodelist').show(); + }); + } + + },'json'); +}); diff --git a/movies.php b/movies.php new file mode 100755 index 0000000..ecbabea --- /dev/null +++ b/movies.php @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ +
+
+ +
+ +
+ + + +
+
Back to Movies
+
Moviename
+
+
+
+
+
+
+
+
+
+ +
+
+ +
+ +
+ +
+ + + + diff --git a/php/checkSessionValidity.php b/php/checkSessionValidity.php new file mode 100755 index 0000000..30d7a67 --- /dev/null +++ b/php/checkSessionValidity.php @@ -0,0 +1,23 @@ + 86400) { + // last activity is more than 10 minutes ago + + session_destroy(); + echo "you are logged out because of the 10 minutes..."; + exit(); +} else { + // update last activity timestamp + //echo "updated timestamp"; + //printf("timestamp updated %d seconds left", 3600 - (time() - $_SESSION['LAST_ACTIVITY'])); + $_COOKIE['LAST_ACTIVITY'] = time(); +} +}else +{ + echo "no cookie..."; + exit(); +} + + +?> diff --git a/php/checkpasswd.php b/php/checkpasswd.php new file mode 100755 index 0000000..2b24cc0 --- /dev/null +++ b/php/checkpasswd.php @@ -0,0 +1,10 @@ + true)); +}else { + echo json_encode(array('valid' => false)); +} + + ?> diff --git a/php/database.php b/php/database.php new file mode 100755 index 0000000..3fa5067 --- /dev/null +++ b/php/database.php @@ -0,0 +1,20 @@ + diff --git a/php/db/getmoviefromdb.php b/php/db/getmoviefromdb.php new file mode 100755 index 0000000..669d6f8 --- /dev/null +++ b/php/db/getmoviefromdb.php @@ -0,0 +1,36 @@ +num_rows; + + $data->data = array(); + while($row = $result->fetch_assoc()) { + array_push($data->data, array('name' => $row['name'],'url' => $row['URL'],'thumbnail' => $row['thumbnail'] )); + } + + } +} + +echo(json_encode($data)); + + + + ?> diff --git a/php/db/savemovietodb.php b/php/db/savemovietodb.php new file mode 100755 index 0000000..a21cff9 --- /dev/null +++ b/php/db/savemovietodb.php @@ -0,0 +1,42 @@ +error = false; +$list = scandir("../../../Filme"); + +$myobj->data = array(); + +foreach ($list as $moviename) { + if (strpos($moviename, '.mp4') !== false) { + + $name = substr($moviename, 0, -4); + $url = str_replace(" ","%20",$moviename); + $thumbnail = str_replace(" ","%20",str_replace(".mp4",".jpg",$moviename)); + + echo($name . "\n"); + + //check if movie already exists: + + $query = "SELECT * FROM `movies` WHERE `name` = '$name'"; + $result = mysqli_query($link,$query); + $resultnumber = $result->num_rows; + if ($resultnumber > 0) { + echo($name . "already exists!\n\n"); + }else { + //save movies to db + $query = "INSERT INTO `movies` (`id`, `name`, `URL`, `thumbnail`) VALUES (NULL, '$name', '$url', '$thumbnail')"; + $result = mysqli_query($link,$query); + } + } +} + + ?> diff --git a/php/getmoviedata.php b/php/getmoviedata.php new file mode 100755 index 0000000..403f50c --- /dev/null +++ b/php/getmoviedata.php @@ -0,0 +1,32 @@ + true); +$myobj = new class{}; + +if (isset($_POST['action'])) { + + $action = $_POST['action']; + + if ($action == "getmovies") { + $myobj->error = false; + $list = scandir("../../Filme"); + + $myobj->data = array(); + + foreach ($list as $moviename) { + if (strpos($moviename, '.mp4') !== false) { + array_push($myobj->data,(object) array( 'name' => substr($moviename, 0, -4), + 'url'=>str_replace(" ","%20",$moviename), + 'thumbnail' => str_replace(" ","%20",str_replace(".mp4",".jpg",$moviename)))); + + } + } + } else { + // code... + } + + +}else { + $myobj->error = true; +} +echo(json_encode($myobj)); + ?> diff --git a/php/getseriesdata.php b/php/getseriesdata.php new file mode 100755 index 0000000..98a8925 --- /dev/null +++ b/php/getseriesdata.php @@ -0,0 +1,56 @@ + true); +$myobj = new class{}; + +if (isset($_POST['action'])) { + + $action = $_POST['action']; + + if ($action == "getallseries") { + $myobj->error = false; + $list = scandir("../../Serien"); + + $myobj->data = array(); + + foreach ($list as $moviename) { + if ($moviename !== ".." && $moviename !== "." && $moviename !== "index.html") { + array_push($myobj->data,(object) array( 'name' => $moviename, + 'url'=>str_replace(" ","%20",$moviename), + 'thumbnail' => str_replace(" ","%20",$moviename.".jpg"))); + } + } + } elseif ($action == "getseries") { + if (isset($_POST['seriesname'])) { + $myobj->error = false; + + $seriesname = $_POST['seriesname']; + + $list = scandir("../../Serien/".$seriesname); + //echo(json_encode($list)); + + $myobj->data = array(); + + foreach ($list as $moviename) { + if ($moviename !== ".." && $moviename !== ".") { + $tempdata = new class{}; + + array_push($myobj->data,(object) array( 'name' => substr($moviename, 0, -4), + 'url'=>str_replace(" ","%20",$seriesname."/".$moviename), + 'thumbnail' => str_replace(" ","%20",str_replace(".mp4",".jpg",$seriesname."/".$moviename)), + 'seasons' => array())); + } + } + + }else { + $myobj->error = true; + } + }else { + // code... + } + + +}else { + $myobj->error = true; +} +echo(json_encode($myobj)); + ?> diff --git a/php/mergescripts/getmoviejsondata.php b/php/mergescripts/getmoviejsondata.php new file mode 100755 index 0000000..c8f5500 --- /dev/null +++ b/php/mergescripts/getmoviejsondata.php @@ -0,0 +1,47 @@ +total_results == 0) { + echo("\n\nno result found for".$moviename); + }else { + $moviedata = $result->results[0]; + echo json_encode($moviedata); + file_put_contents ('./'.str_replace('%20', ' ', $list[$i]).'.json', json_encode($moviedata)); + + // $data->{$moviedata->title} = $moviedata; + } + } + } +} + + + + + + ?> diff --git a/php/mergescripts/getthumbnailsmovies.php b/php/mergescripts/getthumbnailsmovies.php new file mode 100755 index 0000000..80035c2 --- /dev/null +++ b/php/mergescripts/getthumbnailsmovies.php @@ -0,0 +1,46 @@ +total_results == 0) { + echo("\n\nno result found for".$moviename); + }else { + if ($year != 0) { + for ($n=0; $n < count($result->results); $n++) { + if(strpos($result->results[$n]->release_date, $year) !== false) + { + copy("http://image.tmdb.org/t/p/w342/".$result->results[$n]->poster_path, $path.str_replace('%20', ' ', $list[$i]).".jpg"); + } + } + }else { + echo("http://image.tmdb.org/t/p/original/".$result->results[0]->poster_path."\n\n"); + copy("http://image.tmdb.org/t/p/w342/".$result->results[0]->poster_path, $path.str_replace('%20', ' ', $list[$i]).".jpg"); + } + } + } + } +} + + + + ?> diff --git a/php/mergescripts/getthumbnailstvshows.php b/php/mergescripts/getthumbnailstvshows.php new file mode 100755 index 0000000..d09862c --- /dev/null +++ b/php/mergescripts/getthumbnailstvshows.php @@ -0,0 +1,39 @@ +total_results == 0) { + echo("\n\nno result found for".$moviename); + }else { + + echo("http://image.tmdb.org/t/p/original/".$result->results[0]->poster_path."\n\n"); + copy("http://image.tmdb.org/t/p/w342/".$result->results[0]->poster_path, $path.str_replace('%20', ' ', $list[$i]).".jpg"); + + } + } +} + + + + ?> diff --git a/series.php b/series.php new file mode 100755 index 0000000..f205f4e --- /dev/null +++ b/series.php @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ +
+
+ +
+ +
+
+ +
+
Back to Movies
+
Moviename
+
+
+
+
+
+
+
+ + + +