/
volume.php
57 lines (49 loc) · 1.43 KB
/
volume.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
<html>
<head>
<style type="text/css" title="currentStyle" media="screen">
@import "style.css";
</style>
</head>
<body>
<div height="60px" width="100%" style="position:absolute;left:0;top:0;">
<?php
$volumeRaw=exec('amixer get \'Master\' | tail -n 1');
$volumeRaw=preg_replace("/.*\[(\d+)%\].*/", "\$1", $volumeRaw);
if(strchr(getenv(REMOTE_ADDR), "129.65.18")!=FALSE)
$local=TRUE;
if($local) {
if($_POST['volup']) {
if($volumeRaw<=85)
$volumeRaw+=5;
} elseif($_POST['voldown']) {
if($volumeRaw>=5)
$volumeRaw-=5;
} elseif($_POST['phone']) {
$volumeRaw=55;
}
exec('amixer set \'Master\' '.$volumeRaw.'%');
} ?>
<div style="font-size:12px">Volume: <? echo $volumeRaw ?>%</div>
<?
if($local) {
?>
<form action="volume.php" method="post" style="display:inline;float:left;">
<input name="volup" value="1" type="hidden">
<input value="up" class="volbutton" type="submit">
</form>
<form action="volume.php" method="post" style="display:inline;float:left;">
<input name="voldown" value="1" type="hidden">
<input value="down" class="volbutton" type="submit">
</form>
<form action="volume.php" method="post" style="display:inline;float:left;">
<input name="phone" value="1" type="hidden">
<input value="phone!" class="volbutton" type="submit"></form>
<?
if($_POST['volup'] && $volumeRaw>85) {
echo "<font color=\"red\">Hobble thinks it's too loud!</font>";
}
}
?>
</div>
</body>
</html>