If you hit my script directly using the if error? try statement, the
browser displays the "Content-Type: text/html" statement at the top of the
page. When I view source, I see that it is displaying the stylesheet info
twice, once before the Content-Type statement and once afterward. Here is
the message-action-cgi function:

message-action-cgi: func [
    {Decode CGI input and create, display, edit, or delete message(s).}
    cgi-input [object!] "Decoded CGI data as submitted from an HTML page,
most likely sent using GET with messageType and messageID sent as an
appendage to the url request."
][
    print "Content-Type: text/html^/"
    default-input: make cgi-input [
        messageID: "none"
    ]
    if error? try [
        stylesheet-to-load: make file! (rejoin [cgi-input/messageType
".css"])
        stylesheet: read stylesheet-to-load
    ][
        stylesheet-to-load: %comments.css
        stylesheet: read stylesheet-to-load
    ]
    print {
        <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
        <HTML>
        <HEAD>
        <TITLE></TITLE>
    }
    print {<STYLE type="text/css">}
    print stylesheet
    print {</STYLE>}
    print {
        </HEAD>
        <BODY>
    }
    switch/default cgi-input/actionType [
        "create-form" [
            sessionID-check: make decimal! time-in-digits now
            user-sessionID: make decimal! cgi-input/sessionID
            either (user-sessionID + 1000) > sessionID-check [
                display-create-form cgi-input
            ][
                display-login-form cgi-input
            ]
        ]
        "create" [
            sessionID-check: make decimal! time-in-digits now
            user-sessionID: make decimal! cgi-input/sessionID
            either (user-sessionID + 1000) > sessionID-check [
                create-message/from-cgi cgi-input
                display-messages/for-editing default-input
            ][
                display-login-form cgi-input
            ]
         ]
        "comment" [
            if error? try [
                create-message/from-cgi cgi-input
            ][
                comments-directory: make file! rejoin
[cgi-input/messageType {/}]
                make-dir comments-directory
                create-message/from-cgi cgi-input
            ]
            parent-message-input: make cgi-input [
                messageType: cgi-input/parent-messageType
                messageID: cgi-input/parent-messageID
            ]
            post-comment-input: make cgi-input [
                messageType: cgi-input/parent-messageID
                messageID: "none"
            ]
            post-comment-reverse-input: make cgi-input [
                messageID: "none"
                messageType: parent-message-input/messageID
                parent-messageID: parent-message-input/messageID
                parent-messageType: parent-message-input/messageType
            ]
            display-messages/for-reading/for-commenting
parent-message-input
            wait 1
            display-messages/for-reading/for-commenting post-comment-input
            display-comment-form post-comment-reverse-input
         ]
        "display" [
             display-messages/for-reading/for-commenting cgi-input
         ]
        "display-comments" [
            reverse-input: make cgi-input [
                messageID: "none"
                messageType: cgi-input/messageID
                parent-messageID: cgi-input/messageID
                parent-messageType: cgi-input/messageType
            ]
            display-messages/for-reading/for-commenting cgi-input
            if error? try [display-messages/for-reading/for-commenting
reverse-input][]
            display-comment-form reverse-input
        ]
         "edit-form" [
            sessionID-check: make decimal! time-in-digits now
            user-sessionID: make decimal! cgi-input/sessionID
            either (user-sessionID + 1000) > sessionID-check [
                display-messages/for-editing cgi-input
            ][
                display-login-form cgi-input
            ]
         ]
         "edit" [
            sessionID-check: make decimal! time-in-digits now
            user-sessionID: make decimal! cgi-input/sessionID
            either (user-sessionID + 1000) > sessionID-check [
                edit-message cgi-input
                display-messages/for-editing default-input
            ][
                display-login-form cgi-input
            ]
         ]
         "delete" [
            sessionID-check: make decimal! time-in-digits now
            user-sessionID: make decimal! cgi-input/sessionID
            either (user-sessionID + 1000) > sessionID-check [
                delete-message cgi-input
                display-messages/for-editing default-input
            ][
                display-login-form cgi-input
            ]
         ]
        "display-login" [
            display-login-form cgi-input
        ]
        "login" [
            unencrypted-logins: decrypt read %logins.bin
            do unencrypted-logins
            login: make object! [
                userID: cgi-input/userID
                password: cgi-input/password
            ]
            login-string: make string! logins
            either all [(find/any/case login-string login/userID)
(find/any/case login-string login/password)][
                cgi-input: make cgi-input [
                    sessionID: time-in-digits now
                ]
                display-messages/for-editing cgi-input
            ][
                display-login-form cgi-input
            ]
        ]
    ][
        display-messages/for-reading/for-commenting default-input
    ]
    print {
        </BODY>
        </HTML>
    }
]

Ryan C. Christiansen
Web Developer

Intellisol International
4733 Amber Valley Parkway
Fargo, ND 58104
701-235-3390 ext. 6671
FAX: 701-235-9940
http://www.intellisol.com

Global Leader in People Performance Software

_____________________________________

Confidentiality Notice
This message may contain privileged and confidential information. If you
think, for any reason, that this message may have been addressed to you in
error, you must not disseminate, copy or take any action in reliance on it,
and we would ask you to notify us immediately by return email to
[EMAIL PROTECTED]


                                                                                       
                 
                    [EMAIL PROTECTED]                                                      
                 
                    t                    To:     [EMAIL PROTECTED]                  
                 
                    Sent by:             cc:                                           
                 
                    rebol-bounce@        Subject:     [REBOL] Re: if error? try 
problems                
                    rebol.com                                                          
                 
                                                                                       
                 
                                                                                       
                 
                    04/06/2001                                                         
                 
                    11:07 AM                                                           
                 
                    Please                                                             
                 
                    respond to                                                         
                 
                    rebol-list                                                         
                 
                                                                                       
                 
                                                                                       
                 





  Howdy, Ryan:

  What does it blow out with? .. or where does it?

  maybe:

  if error? try [message-action-cgi no-cgi-input][
     print "The error is down here?"
  ]

  Just a thought--

  -jeff

> The following statement works in my script...
>
> cgi-input: retrieve-user-data
> message-action-cgi cgi-input
>
> The function 'retrieve-user-data successfully transfers the CGI input
into
> the variable 'cgi-input and subsequently, the 'message-action-cgi
function
> successfully processes the cgi-input variable. The cgi-input object
> includes three values: messageType, messageID, and actionType. I test the
> above statements using a URL, as such...
>
>
http://www.fargonews.com/cgi-bin/messages.cgi?actionType=display&messageType=news&messageID=none

>
>
> But if I try to add error-checking so that it will default to using a
> pre-defined object!, it does not work.
>
> if error? try [
>      cgi-input: retrieve-user-data
>      message-action-cgi cgi-input
> ][
>      no-cgi-input: make object! [
>          messageType: "news"
>          messageID: "none"
>          actionType: "display"
>      ]
>      message-action-cgi no-cgi-input
> ]
>
>
> I've been working on this little problem for a long time now. Can anyone
> see what I'm doing wrong?
>
> Ryan C. Christiansen
> Web Developer
>
> Intellisol International
> 4733 Amber Valley Parkway
> Fargo, ND 58104
> 701-235-3390 ext. 6671
> FAX: 701-235-9940
> http://www.intellisol.com

--
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the
subject, without the quotes.





-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to