File "code02.php"
Full Path: /home/analogde/www/RaspBerry/Dev/Domotique/code02.php
File size: 1.83 KB
MIME-type: text/html
Charset: utf-8
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="generator" content=
"HTML Tidy for Linux (vers 6 November 2007), see www.w3.org">
<meta charset="utf-8">
<title>Garage Remote</title>
<!--Begin code to open and close garage door-->
<script type="text/javascript">
window.onload = function(){
buttonOff = document.getElementById('submitPressed');
buttonOff.onClick = relayOff;
}
function relayOff(){
hidden = document.getElementById("total");
hidden.value = "pressed";
form = document.getElementById("relay");
form.method = "GET";
form.action = "remote.php";
form.submit();
}
</script><!--End code to open and close garage door-->
<!--Begin code to color button when pressed-->
<script type="text/javascript">
function setColor(btn,color){
var property=document.getElementById(btn);
if (window.getComputedStyle(property).backgroundColor == 'rgb(244, 113, 33)') {
property.style.backgroundColor=color;
}
else {
property.style.backgroundColor = "#2159F4";
}
}
</script><!--End code to color button when pressed-->
</head>
<body>
<form id="relay" action="remote.php" method="get">
<input type="button" id="submitPressed" style=
"border:1px solid #000; font-size:80px;" value="Open/Close"
onclick="relayOff();setColor('submitPressed','#fff200');">
<input type="hidden" name="total" id="total" value="">
</form><!--Begin code to open and close garage door-->
<?php
exec("gpio -g mode 17 out");
$state = $_GET["total"];
if ($state == "off"){
exec("gpio -g write 17 1");
sleep(1);
exec("gpio -g write 17 0");
}
?><!--End code to open and close garage door-->
<!--Insert code for magnetic switch here.-->
</body>
</html>