Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Determining if Files are Open
Message
From
10/07/2003 09:10:29
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
10/07/2003 09:04:48
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00808779
Message ID:
00808819
Views:
12
Tracy,
Why not one single file (or folder\file) in user's local.
Cetin

>Hi Cetin,
>
>Just wanted to let you know that even if 1000 folders are created for this system, it still can be preferable for security purposes. when I was working for the govt all users had to have their temporary files stored in their own directories and were not allowed to be mingled. Since the folder had to exist anyway for that purpose, it is already there to incorporate this. It is similar to how I had to handle the situation at that time and worked very well. It also made it easier to track users' actions, file activity, and delete temporary files after poor user activity (dirty shutdowns) for specific users. It helped us troubleshoot issues that existed for specific users too.
>
>
>>>Good Morning
>>>
>>>I have table with user numbers and user names which I extract into a cursor:
>>>
>>>SET EXCLUSIVE OFF
>>>SET DEFAULT TO ("U:\Data")
>>>SET DELETED ON
>>>
>>>Select users.userno, users.username ;
>>>from "U:\Data\Users" ;
>>>ORDER BY users.username ;
>>>into cursor crsusers
>>>
>>>this will give me a list of users and user names:
>>>
>>>1 Neil
>>>2 Paul
>>>3 Simon
>>>
>>>In a shared directory on a network drive I have the following folder structure:
>>>
>>>U:\Profile\USER1
>>>U:\Profile\USER2
>>>U:\Profile\USER3
>>>
>>>For each user in the table is a directory within the Profile directory named after the user number. Within each USER directory is a file named Insystem.dbf. The file determines if a user is in our database application i.e if you can open it they are not in the system, if you cannnot open it they are in the system.
>>>
>>>I have a piece of code which scans for a particular insystem.dbf file and tells me this in the form of a messagebox.
>>>
>>>What I would like to do is to scan the users in the usertable, and scan through all the insystem.dbf files within the USER number directories. Here is my code:
>>>
>>>Lparameters lcinsystem
>>>Local llReturn, lnFID
>>>llReturn = .F.
>>>If File("U:\Profile\User1\insystem.dbf")
>>>lnFID = Fopen("U:\Profile\User1\insystem.dbf", 11)
>>>If lnFID = -1
>>>llReturn = .T.
>>>MessageBox("User is in system")
>>>Else
>>>=Fclose(lnFID)
>>>MessageBox("User is not in system")
>>>EndIf
>>>EndIf
>>>Return llReturn
>>>
>>>The above code is hard coded for User1 therefore I would like to scan the users table (some new users may have been added) and then somehow scan the insystem.dbf file in their respective User No directory within the profile directory to determine if the user is in the system.
>>>
>>>I would then create a list box which will give me all the users in the system at any given time.
>>>
>>>Can somebody put me in the right direction with this problem.
>>>
>>>Many Thanks
>>
>>
>>Select users.userno, users.username ;
>>  from "U:\Data\Users" ;
>>  ORDER BY users.username ;
>>  into array arrUsers
>>if ( _Tally > 0 )
>> for ix = 1 to alen(arrUsers,1)
>>  If File("U:\Profile\User"+ltrim(str(arrUsers[ix,2]))+"\insystem.dbf")
>>    lnFID = Fopen("U:\Profile\User1\insystem.dbf", 12)
>>    If lnFID = -1
>>      MessageBox("User "+trim(arrUsers[ix,1])+" is in system")
>>    Else
>>      Fclose(lnFID)
>>      MessageBox("User "+trim(arrUsers[ix,1])+" is not in system")
>>    EndIf
>>  EndIf
>> endfor
>>endif
>>
>>However with this approach if you have 1000 users you'd end up with 1000 folders.
>>Instead of locking a file, users might lock their particular records in same file.
>>Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform