|
| 1 | +<?php |
| 2 | + |
| 3 | +session_start(); |
| 4 | + |
| 5 | +if($_COOKIE["logged"] != 1) |
| 6 | +{ |
| 7 | + $_SESSION["signin_errors"] = "Sign in to continue<br>"; |
| 8 | + header("Location: signin.php"); |
| 9 | +} |
| 10 | + |
| 11 | +?> |
| 12 | + |
| 13 | +<!DOCTYPE html> |
| 14 | +<html> |
| 15 | +<head> |
| 16 | + <!--<script src="https://cdnjs.cloudflare.com/ajax/libs/jplayer/2.9.2/add-on/jplayer.playlist.min.js" type="text/javascript" ></script> |
| 17 | + <script src="libraries/requireJS/require.js" type="text/javascript" ></script> |
| 18 | + <script src="libraries/id3/src/id3.js" type="text/javascript" ></script> !--> |
| 19 | + <link href="stylesheets/player.css" type="text/CSS" rel="stylesheet" /> |
| 20 | +</head> |
| 21 | +<body> |
| 22 | + <div id="grey_mask" ></div> |
| 23 | + <nav class="topbar_container" > |
| 24 | + <nav class="topbar" > |
| 25 | + <a href="logout.php" ><div id="logout" class="left_button" >logout</div></a> |
| 26 | + <button id="sense" class="button" style="position: relative" >Sense Emotion</button> |
| 27 | + <button id="random" class="button" >Random Song</button> |
| 28 | + </nav> |
| 29 | + </nav> |
| 30 | + <div id="sense_window" > |
| 31 | + <div class="title" >Choose Method</div> |
| 32 | + <div class="left_container" > |
| 33 | + <div class="label" >Select Mood</div> |
| 34 | + <div class="emoji_list" > |
| 35 | + <input type="image" name="happy" id="happy" src="images/happy.png" class="button" value="happy" > |
| 36 | + <input type="image" name="sad" id="sad" src="images/sad.png" class="button" > |
| 37 | + <input type="image" name="angry" id="angry" src="images/angry.png" class="button" > |
| 38 | + <input type="image" name="bored" id="bored" src="images/bored.png" class="button" > |
| 39 | + </div> |
| 40 | + </div> |
| 41 | + <div class="right_container"> |
| 42 | + <div class="label" >Scan From Camera</div> |
| 43 | + <div class="button" >Scan</div> |
| 44 | + </div> |
| 45 | + </div> |
| 46 | + <div class="maincontainer" > |
| 47 | + <div class="leftcontainer" > |
| 48 | + <div class="player" > |
| 49 | + <marquee class="song_title" scrolldelay="40" truespeed=true > |
| 50 | + <?php |
| 51 | + |
| 52 | + if(isset($_SESSION["song_title"])) |
| 53 | + { |
| 54 | + $song_title = $_SESSION["song_title"]; |
| 55 | + echo "Now Playing: " . $song_title; |
| 56 | + } |
| 57 | + |
| 58 | + ?> |
| 59 | + </marquee> |
| 60 | + <img id="visualizer" class="visualizer" src="images/scene3.jpg" > |
| 61 | + <audio id="music" controls autoplay src= |
| 62 | + <?php |
| 63 | + |
| 64 | + if(isset($_SESSION["song_ref"])) |
| 65 | + { |
| 66 | + $song_ref = $_SESSION["song_ref"]; |
| 67 | + echo '"' . $song_ref . '"'; |
| 68 | + } |
| 69 | + |
| 70 | + ?> |
| 71 | + class="controls" >Your browser doesn't allow this feature</audio> |
| 72 | + </div> |
| 73 | + </div> |
| 74 | + <div class="rightcontainer" > |
| 75 | + <div class="mostplayed" > |
| 76 | + <div class="title" >Most Played Songs</div> |
| 77 | + <p class="warning" >This feature is coming soon.</p> |
| 78 | + </div> |
| 79 | + </div> |
| 80 | + </div> |
| 81 | + |
| 82 | + <script type="text/javascript" > |
| 83 | + |
| 84 | + var sense_button = document.getElementById("sense"); |
| 85 | + var random_button = document.getElementById("random"); |
| 86 | + var grey_mask = document.getElementById("grey_mask"); |
| 87 | + var happy_btn = document.getElementById("happy"); |
| 88 | + var sad_btn = document.getElementById("sad"); |
| 89 | + var angry_btn = document.getElementById("angry"); |
| 90 | + var bored_btn = document.getElementById("bored"); |
| 91 | + var music = document.getElementById("music"); |
| 92 | + |
| 93 | + var visualizer = document.getElementById("visualizer"); |
| 94 | + var scene_path = "images/scene"; |
| 95 | + |
| 96 | + /*for(;;) |
| 97 | + { |
| 98 | + setInterval(function() |
| 99 | + { |
| 100 | + |
| 101 | + }, 5000); |
| 102 | + }*/ |
| 103 | + |
| 104 | + function getRandomInt(max) { |
| 105 | + return Math.floor(Math.random() * Math.floor(max)); |
| 106 | + } |
| 107 | + |
| 108 | + |
| 109 | + function displayWindow(element_id) |
| 110 | + { |
| 111 | + var element = document.getElementById(element_id); |
| 112 | + if(element.style.display == "block") |
| 113 | + { |
| 114 | + element.style.display = "none"; |
| 115 | + } |
| 116 | + else |
| 117 | + { |
| 118 | + element.style.display = "block"; |
| 119 | + } |
| 120 | + } |
| 121 | + |
| 122 | + function closeWindow(element_id) |
| 123 | + { |
| 124 | + var element = document.getElementById(element_id); |
| 125 | + if(element.style.display == "block") |
| 126 | + { |
| 127 | + element.style.display = "none"; |
| 128 | + } |
| 129 | + } |
| 130 | + |
| 131 | + sense_button.onclick = function() |
| 132 | + { |
| 133 | + displayWindow("grey_mask"); |
| 134 | + displayWindow("sense_window"); |
| 135 | + } |
| 136 | + |
| 137 | + grey_mask.onclick = function() |
| 138 | + { |
| 139 | + closeWindow("sense_window"); |
| 140 | + closeWindow("grey_mask"); |
| 141 | + } |
| 142 | + |
| 143 | + happy_btn.onclick = function() |
| 144 | + { |
| 145 | + window.location = "getsong.php?emotion=happy"; |
| 146 | + } |
| 147 | + |
| 148 | + sad_btn.onclick = function() |
| 149 | + { |
| 150 | + window.location = "getsong.php?emotion=sad"; |
| 151 | + } |
| 152 | + |
| 153 | + angry_btn.onclick = function() |
| 154 | + { |
| 155 | + window.location = "getsong.php?emotion=angry"; |
| 156 | + } |
| 157 | + |
| 158 | + bored_btn.onclick = function() |
| 159 | + { |
| 160 | + window.location = "getsong.php?emotion=bored"; |
| 161 | + } |
| 162 | + |
| 163 | + random_button.onclick = function() |
| 164 | + { |
| 165 | + var emos = ["happy", "sad", "angry", "bored"]; |
| 166 | + window.location = "getsong.php?emotion=" + emos[getRandomInt(3)]; |
| 167 | + } |
| 168 | + |
| 169 | + </script> |
| 170 | + |
| 171 | +</body> |
| 172 | +</html> |
0 commit comments