#! /home/path/public_html/rebol/rebol276 -cs
REBOL [Title: "REBOL CGI Console"]
print "content-type: text/html^/"
print {
Console}
selection: decode-cgi system/options/cgi/query-string
; If no data has been submitted, print form to request user/pass:
if ((selection/2 = none) or (selection/4 = none)) [
print {
W A R N I N G - Private Server, Login Required:
}
quit
]
; If code has been submitted, print the output:
entry-form: [print {
}]
if selection/2 = "command-submitted" [
write %commands.txt join "REBOL[]^/" selection/4
; The "call" function requires REBOL version 2.76:
call/output/error
"/home/path/public_html/rebol/rebol276 -qs commands.txt"
%conso.txt %conse.txt
do entry-form
print rejoin [
{Output:
}
{
}
{Errors:
}
read %conse.txt
{}
]
quit
]
; Otherwise, check submitted user/pass, then print form for code entry:
username: selection/2 password: selection/4
either (username = "user") and (password = "pass") [
; if user/pass is ok, go on
][
print "Incorrect Username/Password." quit
]
do entry-form