Skip to content

Instantly share code, notes, and snippets.

@dave-kennedy
Created November 1, 2017 19:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dave-kennedy/e37e3033564156fcf3068de21b2afd43 to your computer and use it in GitHub Desktop.
Save dave-kennedy/e37e3033564156fcf3068de21b2afd43 to your computer and use it in GitHub Desktop.
CGI form
#!/bin/sh
read input
if [ -n "$input" -a "$input" = 'password=foobar' ]; then
echo -e 'Content-Type: text/html\n'
cat << EOF
<html>
<body>Rebooting...</body>
</html>
EOF
reboot
exit 0
fi
echo -e 'Content-Type: text/html\n'
cat << EOF
<html>
<body>
<form method="post">
<label>
Password: <input name="password" type="text">
</label>
<input type="submit" value="Submit">
</form>
</body>
</html>
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment