Cannot read password file
' . "\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 'Wrong password: ' . $entered_hash . '
' . "\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 ...
' . "\n";
shell_exec('/usr/bin/gpio write 28 1');
flush();
usleep(100000 * $duration);
shell_exec('/usr/bin/gpio write 28 0');
print '... done
' . "\n";
}
}
print '' . "\n";
print '