+tempfile="$_DATA/temp/${tpy}.$$.tpy"
+
+if [ "$(POST tid)" != "$(transid "$tpyfile")" ]; then
+ if [ "$(POST autosubmit)" = "true" ]; then
+ printf 'Status: 409 Conflict\r\nContent-Length: 0\r\n\r\n'
+ exit 0
+ else
+ SET_COOKIE session message="TRANSACTION_CONFLICT"
+ REDIRECT "/therapies/${tpy%.*}/${tpy#*.}"
+ fi
+fi
+
+if [ "$(POST formend)" != "formend" ]; then
+ if [ "$(POST autosubmit)" = "true" ]; then
+ printf 'Status: 409 Conflict\r\nContent-Length: 0\r\n\r\n'
+ exit 0
+ else
+ SET_COOKIE session message="INCOMPLETE_SUBMIT"
+ REDIRECT "/therapies/${tpy%.*}/${tpy#*.}"
+ fi
+fi