#!../rebol276 -cs
REBOL []
print "content-type: text/html^/"
print [
"Sitebuilder"]
read-cgi: func [/local data buffer][
switch system/options/cgi/request-method [
"POST" [
data: make string! 1020
buffer: make string! 16380
while [positive? read-io system/ports/input buffer 16380][
append data buffer
clear buffer
]
]
"GET" [data: system/options/cgi/query-string]
]
data
]
submitted: decode-cgi submitted-bin: read-cgi
; if no data has been submitted, request user/pass:
if ((submitted/2 = none) or (submitted/4 = none)) [
print ["W A R N I N G - "]
print ["Private Server, Login Required:"
]
print []
print {} quit
]
; check user/pass every time - end program if incorrect:
username: "cmstest" password: "cmstest"
myusername: submitted/2 mypassword: submitted/4
either ((username = myusername) and (password = mypassword)) or ((find submitted/2 {Content-Disposition: form-data;}) <> none) [
; if user/pass is ok, go on
][
print "Incorrect Username/Password."
print {