Hi to all hbtip, cgi.prg sessi.prg users.
in these months i'm try to use cgi class, my environment is freebsd 13.0 server and harbour
after some tests i choose to work with cgi class.
but i have a problem with session id, if you work in a browser session and start a cgi with these istructions :
oCgi := TipCgi():new()
oCgi:Header( 'Content-Type: text/html; charset=utf-8' )
oCgi:StartSession()
cSESSION := oCgi:cSID
the class generate correctly a sid, but after going on in the sequence of cgi apps and close the job, and re go to the same cgi app, to start a new login for example, the session id generated is the same !!!
i investigate in temp directory and there is only a session id file, and this is the one generated the first time.
And the problem arise also using a textual harbour app, the session is the same, so i cannot manage the access to the files correctly.
I found a solution and i have discuss with Lorenzo Fiorini one of the developers of these prgs.
the solution is simple : here the code in sessid.prg add this function
FUNCTION ENCODE64DATETIME()
* : convert date and time in base64
* : date in session in format yyyymmgg
* : and seconds sssss from midnight
LOCAL cRET
* LENGTH = 26
cRET := HB_BASE64ENCODE( DTOS( DATE() ) ) + HB_BASE64ENCODE( STRZERO( SECONDS(), 5 ) )
RETURN( cRET )
*eof
and in tip_GenerateSID( cCRCKey )
the last row from :
RETURN cSID + cSIDCRC
become :
RETURN ENCODE64DATETIME() + cSID + cSIDCRC
why i choose to use hb64encode() ?
this function return an encoded string of date and time , so human can not understand
how it is generated. Unless is an Harbour USER.
but before ask to modify the prgs i want to know if there is some one who is using this library, and if using cgi class encounter the same problem.
Second if some one use tip_CheckSID( cSID, cCRCKey ) or
METHOD CheckCrcSID( cSID, cCRCKey ) INLINE tip_CheckSID( cSID, cCRCKey )
because this function have to be changed to support the new upgrade
regards
Domenico