Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Determining if Files are Open
Message
De
10/07/2003 09:04:48
 
 
À
10/07/2003 07:37:54
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00808779
Message ID:
00808816
Vues:
16
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
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform