mirror of
https://github.com/thewesker/greptweet.git
synced 2025-12-22 13:01:06 -05:00
Merge branch 'master' of github.com:kaihendry/Greptweet
This commit is contained in:
19
create.cgi
19
create.cgi
@@ -1,6 +1,15 @@
|
||||
#!/bin/bash -e
|
||||
# vim: set ts=4 sw=4
|
||||
exec 2>&1
|
||||
cat <<END
|
||||
Cache-Control: no-cache
|
||||
Content-Type: text/html
|
||||
|
||||
END
|
||||
badinput() {
|
||||
echo "<h1>Bad input, parameter id $@</h1>"
|
||||
exit
|
||||
}
|
||||
|
||||
oldpwd=$PWD
|
||||
|
||||
@@ -12,8 +21,8 @@ IFS=$saveIFS
|
||||
if test ${parm[0]} == "id"
|
||||
then
|
||||
id=$(echo ${parm[1]} | tr -dc '[:alnum:]_' | tr '[:upper:]' '[:lower:]')
|
||||
test ${#id} -gt 0 || exit
|
||||
test ${#id} -lt 20 || exit
|
||||
test ${#id} -gt 0 || badinput is empty
|
||||
test ${#id} -lt 20 || badinput is too large
|
||||
else
|
||||
exit
|
||||
fi
|
||||
@@ -24,9 +33,6 @@ then
|
||||
fi
|
||||
|
||||
cat <<END
|
||||
Cache-Control: no-cache
|
||||
Content-Type: text/html
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
@@ -43,6 +49,9 @@ Content-Type: text/html
|
||||
<pre>
|
||||
END
|
||||
|
||||
|
||||
|
||||
|
||||
hash figlet 2>/dev/null && figlet $id
|
||||
|
||||
if test -d u/$id
|
||||
|
||||
Reference in New Issue
Block a user