add example index.sh.html
This commit is contained in:
@@ -0,0 +1,69 @@
|
|||||||
|
<%
|
||||||
|
param() {
|
||||||
|
echo "$GET" | grep --color=never -P -o "(?<=$1=)[^&]+(?=&?)"
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ -n "$(param click)" ]; then
|
||||||
|
%>
|
||||||
|
<meta http-equiv="refresh" content="0; url=./?clicked=1">
|
||||||
|
<%
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
%>
|
||||||
|
|
||||||
|
<%
|
||||||
|
UPTIME=$(uptime --pretty)
|
||||||
|
%>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<style>
|
||||||
|
* {
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
html {
|
||||||
|
font-family: sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
background-color: black;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
main {
|
||||||
|
display: block;
|
||||||
|
background-color: #131313;
|
||||||
|
margin: 60px auto;
|
||||||
|
max-width: 800px;
|
||||||
|
padding: 10px;
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
article {
|
||||||
|
padding: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
margin: 0;
|
||||||
|
padding: 30px 0;
|
||||||
|
border-bottom: 1px solid white;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
a, a:link, a:hover, a:active, a:visited {
|
||||||
|
color: cornflowerblue;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<main>
|
||||||
|
<h1>Bash CGI</h1>
|
||||||
|
<p><%= "Heya, server is $UPTIME!" %></p>
|
||||||
|
<% if [ -z "$(param clicked)" ]; then %>
|
||||||
|
<a href="./?click=1">Click me!</a>
|
||||||
|
<% else %>
|
||||||
|
Nice! <a href="./">(reset)</a>
|
||||||
|
<% fi %>
|
||||||
|
</main>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user