-
Notifications
You must be signed in to change notification settings - Fork 0
/
sonos.php
executable file
·64 lines (47 loc) · 2.03 KB
/
sonos.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
<?php
define('ROOT_PATH', './');
include(ROOT_PATH.'global.php');
require(ROOT_PATH.'includes/functions.php');
session_start();
if ($_SESSION['authed'] != true){
header( "Location: $login_page" ) ;
}else{
$userID = $_SESSION[userid];
include(ROOT_PATH.'includes/page_header.php');
mysql_connect($db_host,$db_user,$db_password);
@mysql_select_db($db_name) or die( "Unable to select database");
$query = "select networkID,PiIP from networks WHERE userID='$userID'";
$result = mysql_query($query);
$row = mysql_fetch_row($result);
$netID=$row[0];
$PIip=$row[1];
echo "$ip";
$query = "select * from devices WHERE networkID='$netID'";
$result = mysql_query($query);
echo "<br>Sonos Devices<br>";
echo "<table border=1>";
echo "<th>IP</th><th>Mac</th><th>Name</th><th>Custom Name</th>";
echo "<tr>";
while($row = mysql_fetch_array( $result )) {
if (strpos($row['devicename'],'SONOS') !== false){
echo '<form action="sonoscontrol.php" method="GET">';
echo "<td>" . $row['ip'] . "</td>" ;
echo "<td>" . $row['mac'] . "</td>" ;
echo "<td>" . $row['devicename'] . "</td>" ;
echo "<td>" . $row['CustomName'] . "</td>" ;
echo '<td><a href="sonoscontrol.php?command=play&ip=' . $row['ip'] . '">play</a></td> ';
echo '<td><a href="sonoscontrol.php?command=off&ip=' . $row['ip'] . '">stop</a></td> ';
echo '<input type="hidden" name="ip" value="' . $row['ip'] . '">';
echo '<input type="hidden" name="device" value="' . $row['deviceID'] . '">';
echo '<td><label for="fader">Volume</label><input name=level onchange="this.form.submit()" type="range" min="0" max="100" value="' . $row['level'] . '" id="level"></td>';
# echo '<td><a href="http://' . $PIip . '/sonos.php?command=play">Volume UP</a></td> ';
# echo '<td><a href="http://' . $PIip . '/sonos.php?command=play">Volume DOWN</a></td> ';
echo '</form>';
echo "</td></tr>";
}
}
echo "</table>";
mysql_close();
include(ROOT_PATH.'includes/page_footer.php');
}
?>