start or resume session PERFORM HTM2COB-SESS-START DISPLAY "

    HTM2COB-HIDDEN-SESSION-ID: " HTM2COB-HIDDEN-SESSION-ID"

" *> in case, if it from login page, then name has a value CALL "HTM2COB-POST" USING "name" , WS-NAME END-CALL CALL "HTM2COB-POST" USING "pw" , WS-PW END-CALL IF WS-NAME NOT = SPACES THEN *> check name and password, this is usually in a database IF WS-NAME = "admin" AND WS-PW = "qwerty" OR WS-NAME = "user1" AND WS-PW = "pw123" THEN *> write name in session MOVE "name" TO HTM2COB-SESS-VAR-NAME MOVE WS-NAME TO HTM2COB-SESS-VAR-VALUE PERFORM HTM2COB-SESS-SET END-IF END-IF *> check whether within the session MOVE "name" TO HTM2COB-SESS-VAR-NAME PERFORM HTM2COB-SESS-GET IF NOT V-OK OF LNK-RESULT OF LNK-HTM2COB-SESSION THEN DISPLAY "

No access

" *> you can use a sample link also *> DISPLAY "Login page
" DISPLAY '

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

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

### Intro page

read name from session MOVE "name" TO HTM2COB-SESS-VAR-NAME PERFORM HTM2COB-SESS-GET MOVE HTM2COB-SESS-VAR-VALUE TO WS-NAME *> filter special chars, before display text CALL "HTM2COB-SPEC-CHARS" USING WS-NAME, HTM-NAME END-CALL *> welcome user DISPLAY "Hello " TRIM(HTM-NAME) "
" ?>

Cookie session login start page

COBOL variables 01 ws-name pic x(20). 01 ws-pw pic x(20). 01 htm-name pic x(20). ?>