[0001]
[0002]
[0003]
[0004]
[0005]
[0006]
[0007]
[0008]
[0009]
[0010]
[0011]
[0012]
[0013]
[0014]
[0015]
[0016]
[0017]
[0018]
[0019]
[0020]
[0021]
[0022]
[0023]
[0024]
[0025]
[0026]
[0027]
[0028]
[0029]
[0030]
[0031]
[0032]
[0033]
[0034]
[0035]
[0036]
[0037]
[0038]
[0039]
[0040]
[0041]
[0042]
[0043]
[0044]
[0045]
[0046]
[0047]
[0048]
[0049]
[0050]
[0051]
[0052]
[0053]
[0054]
[0055]
[0056]
[0057]
[0058]
$!-----------------------------------------------------------------------------
$! WELCOME.COM
$! Find "welcome" PHP file (WASD 8.n) implemented as CGIplus for efficiency.
$!
$! Also illustrates how to create a script to provide customised mapping.
$! In this case mapping rules (see below) activate this script if the path
$! ends in a slash ("/", i.e. is a directory specification).  Once activated
$! the script checks if the specified path contained a file INDEX.PHP.  If it
$! does the script generates a CGI redirect to cause the server to access it.
$! If it doesn't exist a redirect, using a detectable "escape" component,
$! has the server continue to supply whatever it's normal behaviour would.
$!
$! # HTTPD$MAP entries (pre-8.2 and post-8.2)
$! exec /*.php* /ht_root/*.php*
$! map **/ /cgiplus-bin/welcome.com*/ [pa:1]![pi:/$welcome$/*]
$! map /$welcome$/* /*
$!
$! # HTTPD$MAP entries (post-8.2)
$! exec /*.php* /ht_root/*.php*
$! if (pass:1 && !path-info:/$welcome$/*) map **/ /cgiplus-bin/welcome.com*/ 
$! map /$welcome$/* /*
$!
$! 01-JUN-2003  MGD  initial
$!-----------------------------------------------------------------------------
$!
$ on warning then $exit
$ say = "write sys$output"
$ open /read CgiPlusIn CGIPLUSIN
$!
$ RequestLoop:
$!
$!   (block waiting for request, this initial read is always discardable)
$    read CgiPlusIn /end=EndRequestLoop Line
$!
$    pathInfo = "ERROR"
$    pathTranslated = "ERROR"
$    CgiVarLoop:
$       read CgiPlusIn /end=EndCgiVarLoop Line
$       if Line .eqs. "" then goto EndCgiVarLoop
$       e0 = f$element(0,"=",Line)
$       e1 = f$element(1,"=",Line)
$       if e0 .eqs. "WWW_PATH_INFO" then pathInfo = e1
$       if e0 .eqs. "WWW_PATH_TRANSLATED" then pathTranslated = e1
$       goto CgiVarLoop
$    EndCgiVarLoop:
$!
$    if f$search("''pathTranslated'INDEX.PHP") .eqs. ""
$       then say "Location: /$welcome$''pathInfo'"
$       else say "Location: ''pathInfo'index.php"
$    endif
$    say ""
$!
$    say f$trnlnm("CGIPLUSEOF")
$    goto RequestLoop
$!
$ EndRequestLoop:
$!
$!-----------------------------------------------------------------------------