Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. sponsors. rss.
 From: Anil Sharma
  Where is Anil Sharma?
 ludhiana
 India
 Anil Sharma
 To: Anup Singh
  Where is Anup Singh?
 Delhi
 India
 Anup Singh
 Tags
Subject: RE: Small utility to check software users
Thread ID: 199123 Message ID: 199199 # Views: 38 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Security and Application Protection
Date: Saturday, October 18, 2008 9:02:37 AM         
   


Well i never used to count the no. of user login in my application. well but i have a idea i can share with u!


***Make a Empty or write any thing in TextFile for current user in Current Folder.


FUNCTION GetNumberofLoginedUser
Local lcLoginUsersFiles,lnLoginUsers,laFileData,gnPsFile  
lnLoginUsers = 0
lcLoginUsersFiles = Fullpath(Curdir())+"*.PAS"

FOR i = 1 TO   ADIR(laFileData,lcLoginUsersFiles )
 gnPsFile = FOPEN(laFileData(i,1),12)
 IF  gnPsFile = -1
 lnLoginUsers  = lnLoginUsers +1
 ENDIF
 
ENDFOR

RETURN lnLoginUsers 


&&& In software when user enter username password check if user is already login. Means Code for your login form
 LOCAL lLoginOk,lcUserName
 lcUserName= 'abc'
 lUserFile = ALLTRIM(lcUserName)+".PAS"  &&& UserName is varible for Current login user 

 IF FILE(lUserFile)
 ERASE '&lUserFile'   &&& Erase old file if found any if the user crashed the software last time the file will be there
 ELSE
 strtofile(lcUserName,luserFile)  && Make Fresh File is there is no file.
 ENDIF
 
IF Not PEMSTATUS(_SCREEN,"LoginFileHandle",5)
 _screen.AddProperty("LoginFileHandle", 0)
ENDIF

_SCREEN.LoginFileHandle = FOPEN(lcUserFile,12)

 IF  _screen.LoginFileHandle < 1
 	=MESSAGEBOX("User Already login",0+16,"Stop")
 	ELSE
 	****** You can enter in Software
 	
 ENDIF
 
 *** Dont Forget to Close that file when u shutdown the software the syntax is

 =FCLOSE(_SCREEN.LoginFileHandle)
lcUserName='abc'
 lUserFile = ALLTRIM(lcUserName)+".PAS"  &&& UserName is varible for Current login user 
 ERASE '&lUserFile'    && Erase the File


That is just a idea of mine as i told before too i have not used such in my application any suggestion are welcome :)

Anil
My Blog



COMPLETE THREAD
Small utility to check software users Posted by Anup Singh @ 10/17/2008 2:10:12 PM
RE: Small utility to check software users Posted by Borislav Borissov @ 10/17/2008 2:32:27 PM
RE: Small utility to check software users Posted by Anup Singh @ 10/18/2008 7:47:06 AM
RE: Small utility to check software users Posted by tushar @ 10/18/2008 10:11:31 AM
RE: Small utility to check software users Posted by vinod kabdal @ 10/18/2008 7:03:17 AM
RE: Small utility to check software users Posted by Anup Singh @ 10/18/2008 7:45:03 AM
RE: Small utility to check software users Posted by Anil Sharma @ 10/18/2008 9:02:37 AM