-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
143 lines (136 loc) · 5.65 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<?php
if(isset($_GET["logout"]) && $_GET["logout"]=="1") {
setcookie("user", "", time()+86400);
$currentuser = "";
}
else if(isset($_GET["user"]) && isset($_GET["password"])) {
$string = file_get_contents("db/users.json");
$json_a = json_decode($string,true);
$flag = false;
foreach($json_a["users"] as $user) {
if($_GET["user"] == $user["username"] && $_GET["password"] == $user["password"]) {
//echo $user["username"].":".$user["password"]."<br>";
setcookie("user", $user["username"], time()+86400);
$currentuser = $user["username"];
$flag = true;
}
}
if(!$flag) {
$currentuser = "";
}
}
else {
$currentuser = $_COOKIE["user"];
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="icon" type="image/png" href="resources/newnote.png">
<title>song.biz</title>
<!-- CSS -->
<link rel="stylesheet" href="resources/style.css">
</head>
<!-- MAIN VIEW -->
<body>
<table id="page">
<tbody>
<tr>
<!-- TOP LEFT -->
<td id="a1">
<button id="searchBtn">SEARCH</button><br>
<button id="browseBtn" class="inactive">BROWSE</button><br><br>
<span class="semibold lightred" id="user"></span><br>
<a class="semilight darkred" id="user_thing">LOGOUT</a>
<hr>
</td>
<!-- TOP MIDDLE -->
<td id="a2">
<div id="logo" style="text-align: center; padding: 8px;"><img src="./resources/songbiz.png" width="500px"></div>
<div id="searchFieldArea" class="search">
<input id="searchField" type="text">
</div>
<div id="selectSearchArea" class="search">
<form id="searchtype">
<input type="radio" name="type" id="songs" value="songs" checked><label for="songs">SONGS</label> |
<input type="radio" name="type" id="users" value="users"><label for="users">USERS</label> |
<input type="radio" name="type" id="collections" value="collections"><label for="collections">COLLECTIONS</label>
</form>
</div>
<div id="browseTop" class="browse" style="display:none">
<h2>Browse</h2>
<h4>Browse through a selection of our most popular songs</h4>
</div>
<hr>
</td>
<!-- TOP RIGHT -->
<td id="a3">
<span id="curcol" class="semibold lightred">Current collection</span><br>
<span id="current_collection" class="semilight darkred">AWESOME SONGS OF LOVE</span>
<hr>
</td>
</tr>
<tr>
<!-- MIDDLE LEFT -->
<td id="b1">
<div id="usercollections"></div>
</td>
<!-- MIDDLE MIDDLE -->
<td id="b2">
<!--Search-->
<div id="searchresults" class="search">
</div>
<!--Overlay-->
<div id="overlay" style="display:none">
<div id="addSongForm">
<h4>ADD A SONG</h4>
<input id="songTitle" type="text" name="songTitle" placeholder="Title"><br>
<textarea id="songLyrics" placeholder="Lyrics"></textarea><br>
<!-- <input id="songLyrics" type="text" name="songLyrics" placeholder="Lyrics"><br> -->
<input id="songMelody" type="text" name="songMelody" placeholder="Melody"><br>
<input id="songComposer" type="text" name="songComposer" placeholder="Composer"><br>
<input id="songType" type="text" name="songTitle" placeholder="Type"><br>
<button id="submitSongBtn">Submit</button>
<button id="returnBtn">Return</button>
</div>
</div>
<!--Browse-->
<div id="browse" class="browse" style="display:none;" class="row">
</div>
</td>
<!-- MIDDLE RIGHT -->
<td id="b3">
<div id="collectionsongs"></div>
</td>
</tr>
<tr>
<!-- BOTTOM LEFT -->
<td id="c1">
<hr>
<button id="addBtn">+</button>
<input id="collectionName" type="text" name="collName" placeholder="Name"><br>
<input id="collectionDescription" type="text" name="collDesc" placeholder="Description">
</td>
<!-- BOTTOM MIDDLE -->
<td id="c2">
<div id="c2Add">
<button id="addSongBtn">+</button>
</div>
</td>
<!-- BOTTOM RIGHT -->
<td id="c3">
<hr>
<div id="trash"></div>
</td>
</tr>
</tbody>
</table>
<script> var current_user = "<?php echo $currentuser; ?>";</script>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
<script src="scripts/model.js"></script>
<script src="scripts/controllers.js"></script>
<script src="scripts/views.js"></script>
</body>
</html>