-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathroomindex.php
147 lines (138 loc) · 4.67 KB
/
roomindex.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
144
145
146
147
<html>
<head>
<title>Open room Protocol</title>
<link type="text/css" rel="stylesheet" href="bootstrap/css/bootstrap.css"/>
<meta name="viewport" content="width=device-width, user-scalable=false;">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>
<script src="chosen.jquery.js" type="text/javascript"></script>
</head>
<body>
<div class="row-responsive">
<p>The control function for Aran's Room</p>
<form action="roomupdate.php" method="post" class="well form-search">
<br>Songs<br>
<select name='song' class="chosen-select">
<option value=''></option>
<?php
//Variables for connecting to your database.
//These variable values come from your hosting account.
$hostname = "************";
$username = "**********";
$dbname = "*************";
//These variable values need to be changed by you before deploying
$password = "**********";
//Connecting to your database
mysql_connect($hostname, $username, $password) OR DIE ("Unable to
connect to database! Please try again later.");
mysql_select_db($dbname);
$query = "SELECT * FROM musiclibrary";
$result = mysql_query($query);
while($row = mysql_fetch_assoc($result)){
echo("<option value=\"");
echo addslashes($row["song"]);
echo("\">");
echo $row["song"];
echo("</option>");
}
mysql_close();
?>
</select><br>
Playlists<br>
<select name='playlist' class="chosen-select">
<option value=''></option>
<?php
//Variables for connecting to your database.
//These variable values come from your hosting account.
$hostname = "************";
$username = "***********";
$dbname = "***********";
//These variable values need to be changed by you before deploying
$password = "***************";
//Connecting to your database
mysql_connect($hostname, $username, $password) OR DIE ("Unable to
connect to database! Please try again later.");
mysql_select_db($dbname);
$query = "SELECT * FROM playlists";
$result = mysql_query($query);
while($row = mysql_fetch_assoc($result)){
echo("<option value=\"");
echo addslashes($row["list"]);
echo("\">");
echo $row["list"];
echo("</option>");
}
mysql_close();
?>
</select><br>
<input type="radio" name="control" value="pause">Pause<br>
<input type="radio" name="control" value="play">Play<br>
<input type="radio" name="control" value="next">Next<br>
<input type="radio" name="control" value="stop">Stop<br>
</input>
<br>
<br>
<input type="submit">
<br>
These are the light Controls<br>
<input type="radio" name="switch" value="on">On<br>
<input type="radio" name="switch" value="off">Off<br>
</input>
Hue:<input type="text" name="hue"><br>
Brightness:<input type="text" name="bri"><br>
<br>
<br>
<br>
These are the Voice Controls<br>
Say something:<input type="text" name="voice"><br>
</form>
</div>
<?php
//Variables for connecting to your database.
//These variable values come from your hosting account.
$hostname = "*****************";
$username = "************";
$dbname = "***********";
//These variable values need to be changed by you before deploying
$password = "*************";
//Connecting to your database
mysql_connect($hostname, $username, $password) OR DIE ("Unable to
connect to database! Please try again later.");
mysql_select_db($dbname);
$query = "SELECT * FROM paststates ORDER BY time DESC LIMIT 0, 1";
$result = mysql_query($query);
while($row = mysql_fetch_assoc($result)){
if ($row["song"]){
echo $row["song"];
echo("<br>");
if ($row["action"]==0){
echo ("paused");
}else{
echo ("playing");
}
echo("<br>");
}
if ($row["playlist"]){
echo $row["playlist"];
echo("<br>");
}
if ($row["lightstate1"]==0){
echo ("lights off");
echo("<br>");
}
else
{
echo ("lights on");
echo("<br>");
echo $row["lighthue1"];
echo("<br>");
echo $row["lightbri1"];
echo("<br>");
}
}
mysql_close();
?>
</body>
<script type="text/javascript">
$(".chosen-select").chosen();
</script>
</html>