synapse-registration-bash/registerform.sh

47 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
captchouliurl=http://mugi.midov.pl
sendcaptchashort() {
curl --silent -XPOST "$captchouliurl" -H "$HTTP_CONTENT_TYPE" -d "$1" > /dev/null
}
registrationpage() {
echo "Content-type: text/html"
echo ""
echo "<html>"
echo "<head>"
echo '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">'
echo "</head>"
echo "<body>"
echo "<form action='do-register.sh' method='POST'>"
echo "<label for='login'>Login:</label>"
echo "<br>"
echo "<input type='text' id='login' name='login'>"
echo "<br>"
echo "<label for='password'>Password:</label>"
echo "<br>"
echo "<input type='password' id='password' name='password'>"
echo "<br>"
echo "<label for='passwordagain'>Re-type Password:</label>"
echo "<br>"
echo "<input type='password' id='passwordagain' name='passwordagain'>"
echo "<br>"
echo "<input type='hidden' id='captcha' name='captcha' value=\"$id\">"
echo "<input type='submit' value='Submit'>"
echo "</form>"
echo "</body>"
echo "</html>"
}
# get post body from captchouli to check if its valid later
data=$(cat)
id=$(echo "$data" | cut -d '=' -f 2 | cut -d '&' -f 1)
registrationpage
# sends the captcha id to capthouli so it knows it was solved
sendcaptchashort "$data"
exit 0