start or resume session PERFORM HTM2COB-SESS-START CALL "HTM2COB-POST" USING "name" , WS-NAME END-CALL CALL "HTM2COB-POST" USING "comment", WS-COMMENT END-CALL CALL "HTM2COB-POST" USING "captchatext", WS-CAPTCHATEXT END-CALL *> check saved captcha text in session MOVE "captchatext" TO HTM2COB-SESS-VAR-NAME PERFORM HTM2COB-SESS-GET IF NOT V-OK OF LNK-RESULT OF LNK-HTM2COB-SESSION OR HTM2COB-SESS-VAR-VALUE NOT = WS-CAPTCHATEXT THEN DISPLAY "

Captcha verification failed, please try again.

" DISPLAY '

' DISPLAY '' DISPLAY '' DISPLAY '' DISPLAY '

' *> slash with concatenate, because of the htm2cob preprocessor DISPLAY "" "" GOBACK END-IF ?>

### Your comment was accepted!

filter special chars, before display text CALL "HTM2COB-SPEC-CHARS" USING WS-NAME, HTM-NAME END-CALL *> first replace LF and CR INSPECT WS-COMMENT REPLACING ALL X"0A" BY " " INSPECT WS-COMMENT REPLACING ALL X"0D" BY " " CALL "HTM2COB-SPEC-CHARS" USING WS-COMMENT, HTM-COMMENT END-CALL DISPLAY "Hello " TRIM(HTM-NAME) "
" DISPLAY "Your comment: " TRIM(HTM-COMMENT) "
" ?>

Cookie session captcha test start page

COBOL variables 01 WS-NAME PIC X(20). 01 WS-COMMENT PIC X(10000). 01 WS-CAPTCHATEXT PIC X(10). 01 HTM-NAME PIC X(20). 01 HTM-COMMENT PIC X(10000). ?>