PRIVATE ALL LIKE z* PUBLIC m._vsouserfilename, m._vsouserhandle *** seed and ignore the first returned value m.zfilename = intrandrange(00000000, 99999999, 87654321) FOR m.zusercount = 1 TO m._vsomaxuser *** get an integer for use as a filename m.zfilename = ALLTRIM(STR(intrandrange(00000000, 99999999))) + ".acu" IF _file(m.zfilename) m.zfh = FOPEN(m.zfilename, 12) ELSE m.zfh = 0 ENDIF IF m.zfh > -1 IF m.zfh > 0 *** Person is no longer using the application and did not *** log out properly = FCLOSE(m.zfilename) ENDIF m.zfh = FCREATE(m.zfilename) EXIT ENDIF ENDFOR m._vsouserfilename = m.zfilename m._vsouserhandle = m.zfh IF (!m.nomore) AND (m._vsolan AND m.zusercount > m._vsomaxuser AND m._vsomaxusers > 0) * WARNING !!! Maximum * users Allowed; Close Idle Instances of this Applcation before * ReStarting; If a Node was Hanged or ReBooted Please ReStart ALL * Instances again m.nomore = .T. ENDIFFor logout
IF m._vsouserhandle > 0 = FCLOSE(m._vsouserhandle) = deletefile(m._vsouserfilename) ENDIF RELEASE m._vsouserfilename, m._vsouserhandlefunction intrandrange
PARAMETERS m.zfrom, m.zto, m.zseed PRIVATE ALL LIKE z* IF NOT EMPTY(m.zseed) m.zretval = int((m.zto - m.zfrom + 1) * RAND(m.zseed) + m.zfrom) ELSE m.zretval = int((m.zto - m.zfrom + 1) * RAND() + m.zfrom) ENDIF RETURN m.zretval