#75777 - 2003-07-09 09:08 AM
Reading from INI file at same time
|
attiahia
Hey THIS is FUN
Registered: 2000-03-27
Posts: 268
|
In our login script I want to add part where all users (approximately 800) will access INI file at the same time and read specific data from it. Will this cause any problem?
The ini file will be like: [Jhoanxm] BadgNum=80922 [Mikalbn] BadgNum=80514 [Sungyxc] BadgNum=534291
The script will get the user id when he logged on and then access the ini file on the server and extract his BadgNum after it match his user id with the same one in the ini file.
Thank you.
|
|
Top
|
|
|
|
#75782 - 2003-07-14 02:01 PM
Re: Reading from INI file at same time
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
quote:
The only thing you might consider is the size of the ini ... KiX is as well sticky to the limitation which was IIRC 64K (Was this NT ?)
No and Yes.. No as the 64K limit of the INI files was brought forward with the advent of Windows 95 from the Windows 3.x days. Yes as with Windows 3.x you could only do so much with the setup of the computer. At this point, M$ thought it would be prudent to store these settings in the Registry. The main objective of the INI files in the Windows world, is legacy support.
Kent [ 14. July 2003, 14:12: Message edited by: kdyer ]
|
|
Top
|
|
|
|
#75785 - 2003-07-15 06:40 AM
Re: Reading from INI file at same time
|
attiahia
Hey THIS is FUN
Registered: 2000-03-27
Posts: 268
|
This what I am going to do. Your comments will be appreciated. $String1=” a,b,c,d,e,f,g,h,I,j” $String2=”k,l,m,n,o,p,q,r,s,t” $String3=”u,v,w,x,y,z” Following is example for the INI file where login script read from it to extract the employee badge# and a specific file name to be used latter in coping this file on the employee desktop during the login process.
[BUGAYORC] BadgNum=534241 FileOpen=Bugayong, Rodolfo 534241 [CHURCHMX] BadgNum=165340 FileOpen=Churchill, Michael 165340 [DELACRJV] BadgNum=538147 FileOpen=Dela Cruz, Javier 538147
I will read from the main TXT file which includes all the 800 employee’s data (badge# and file name) and which I use to create the INI. $q = open (1,"@curdir\Empls_Data.txt") DO $Read1=readline(1) Then the data will be sent to 3 ini files (instead of only one) based on the first character in the user id. $Userid=Substr($Read1,1,6) $Read2=Substr("$Userid ",1,1) IF instr("$string1","$Read2") $Writ=WriteProfileString("@curdir\Emply_1.ini","$Userid ","BadgNum",$Bagm + all other read data) ENDIF IF instr("$string2","$Read2") $Writ=WriteProfileString("@curdir\Emply_2.ini","$Userid ","BadgNum",$Bagm + all other read data) ENDIF (of course I can use case here) And so on With this way the 800 names will be distributed over 3 ini files instead of 1 file and In the login script user will be connected to one of these 3 files based on his login id first character. Thank you. [ 15. July 2003, 06:42: Message edited by: attiahia ]
|
|
Top
|
|
|
|
#75786 - 2003-07-15 11:33 AM
Re: Reading from INI file at same time
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
As a simpler and more flexible mechanism, use a modulo hash. You can do it on just the first character if you want: quote: $sFileName="Badge_"+(Asc(LCase($sLogin)) mod 3)+".ini"
Using the names from your example gives: quote: BUGAYORC=Badge_2.ini CHURCHMX=Badge_0.ini DELACRJV=Badge_1.ini
If you want to spread across more files, just change the modulo number from 3 to the number of files you require.
If you don't get a decent spread - perhaps many logins use the same first letter - sum the ASCII values of the login and apply the modulo to that instead.
|
|
Top
|
|
|
|
#75788 - 2003-07-16 05:05 AM
Re: Reading from INI file at same time
|
attiahia
Hey THIS is FUN
Registered: 2000-03-27
Posts: 268
|
Actually, I am storing & reading much different type of data in\from the ini file. Badge# , full name and file name were just examples of this ini file data. Thanks a lot gentlemen.
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
1 registered
(Allen)
and 1198 anonymous users online.
|
|
|