diff options
author | Erich Eckner <git@eckner.net> | 2021-01-30 21:16:34 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2021-01-30 21:16:34 +0100 |
commit | 0ba9cc4e7fa875d5a37180c2dde13eae82f99ac5 (patch) | |
tree | aaecc5d69d1217bfedbee266d4e56986ac9b39ce | |
parent | f936b79013ae53fe2620dcad140a751f01904713 (diff) | |
download | raspi-lights-out-0ba9cc4e7fa875d5a37180c2dde13eae82f99ac5.tar.xz |
removed everything
-rw-r--r-- | configure-gpio.service | 13 | ||||
-rw-r--r-- | httpdocs/index.php | 78 |
2 files changed, 0 insertions, 91 deletions
diff --git a/configure-gpio.service b/configure-gpio.service deleted file mode 100644 index 9feb7be..0000000 --- a/configure-gpio.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=configure the GPIO pins - -[Service] -Type=oneshot -RemainAfterExit=yes -ExecStart=/usr/bin/gpio mode 27 in -ExecStart=/usr/bin/gpio mode 27 up -ExecStart=/usr/bin/gpio mode 28 out -ExecStart=/usr/bin/gpio write 28 0 - -[Install] -WantedBy=multi-user.target diff --git a/httpdocs/index.php b/httpdocs/index.php deleted file mode 100644 index 43dd967..0000000 --- a/httpdocs/index.php +++ /dev/null @@ -1,78 +0,0 @@ -<?php - -$f = popen('/usr/bin/gpio read 27', 'r'); -if ($f === false) { - print 'Cannot access gpio' . "\n"; - die(); -} -$l = trim(fgets($f)); -pclose($f); - -if ($l == '') { - print 'Cannot read gpio - is it installed?' . "\n"; - die(); -} - -if (array_key_exists('HTTPS', $_SERVER) -&& ($_SERVER['HTTPS'] == 'on')) - $https = true; -else - $https = false; - -function push_it() { - if (!array_key_exists('password', $_POST)) - return; - $f = fopen('../password', 'r'); - if ($f === false) { - print '<font color="ff0000">Cannot read password file</font><br>' . "\n"; - return; - } - $saved_hash = trim(fgets($f)); - fclose($f); - $entered_hash = $_POST['password']; - for ($i=0; $i<1000; $i++) - $entered_hash = hash('sha512', $entered_hash . $i . $_POST['password']); - if ($saved_hash != $entered_hash) { - print '<font color="ff0000">Wrong password: ' . $entered_hash . '</font><br>' . "\n"; - return; - } - foreach ($_POST as $key => $dummy) - if (preg_match('/^push_([0-9]+)$/', $key, $duration)) - break; - if (count($duration) != 2) - return; - $duration = $duration[1]; - if (($duration > 0) - && ($duration < 300)) { - print 'pushing for ' . ($duration * 0.1) . ' seconds ... <br>' . "\n"; - shell_exec('/usr/bin/gpio write 28 1'); - flush(); - usleep(100000 * $duration); - shell_exec('/usr/bin/gpio write 28 0'); - print '... done<br>' . "\n"; - } -} - -print '<html>' . "\n"; -print '<head>' . "\n"; -print '<title>fileserver lights-out</title>' . "\n"; -if (array_key_exists('password', $_POST)) - print '<meta http-equiv="refresh" content="1;/">' . "\n"; -print '</head>' . "\n"; -print '<body>' . "\n"; -print 'Fileserver is currently '; -if ($l == '1') - print '<font color="ff0000">off</font>'; -else - print '<font color="00ff00">on</font>'; -print '<br>' . "\n"; -if ($https) { - push_it(); - print '<form action="" method="post">' . "\n"; - print 'Passwort: <input name="password" type="password"><br>' . "\n"; - print '<input type="submit" name="push_1" value="short power button push"><br>' . "\n"; - print '<input type="submit" name="push_150" value="long power button push"><br>' . "\n"; - print '</form>' . "\n"; -} -print '</body>' . "\n"; -print '</html>' . "\n"; |