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