FREE Subscription to Dr. Dobb’s Digest: Same Great Content, New Digital Edition
Site Archive (Complete)
Architecture & Design
Email
Print
Reprint

add to:
Del.icio.us
Digg
Google
Furl
Slashdot
Y! MyWeb
Blink
January 01, 2002

Writing CGI Scripts in REXX (Web Techniques, May 1996)

(Page 9 of 23)

Writing CGI Scripts in REXX, Listing 10 (Web Techniques, May 1996)

Web Techniques Magazine

May 1996

Volume 1, Issue 2





Writing CGI Scripts in REXX



Listing Ten

/* CgiError

# Prints out an error message which which containes appropriate headers,

# markup, etcetera.

# Parameters:

# If no parameters, gives a generic error message

# Otherwise, the first parameter will be the title and the rest will

# be given as the body

*/

CgiError: PROCEDURE

PARSE ARG Title, Body

IF Title='' THEN Title='Error: script' MyURL() 'encountered fatal error.'

SAY 'Content-type: text/html'; SAY ''

SAY '<html><head><title>'Title'</title></head>'

SAY '<body><h1>'Title'</h1>'

IF Body/='' THEN SAY Body

SAY '</body></html>'

RETURN ''

/* CgiDie

Identical to CgiError, but also quits with the passed error message.

*/

CgiDie: PROCEDURE

PARSE ARG Title, Body

Fail=CgiError(Title, Body)

EXIT

/* MyURL

Returns a URL to the script

*/

MyURL: PROCEDURE

IF GETENV('SERVER_PORT')/='80' THEN Port=':'GETENV('SERVER_PORT')

ELSE Port=''

RETURN 'http://'GETENV('SERVER_NAME')||Port||GETENV('SCRIPT_NAME')



( back )


Copyright Web Techniques. All rights reserved.

Previous Page | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 Next Page
TOP 5 ARTICLES
No Top Articles.



MICROSITES
FEATURED TOPIC

ADDITIONAL TOPICS

INFO-LINK