Page 1 of 1 1
Topic Options
#21379 - 2002-05-08 07:46 PM Is it possible to break code lines?
Anonymous
Unregistered


Hello.
I have been requested to write code that can be modified easily (adding new conditions) by other people.
I have been suggested that code in the way

if user="user1"
or user="user2"
or user="user3"
...
EndIf

would be absolutely clumsy-proof. :-)

However, kix interpreter is not able to understand it correctly. Is it possible to tell kix that the line is broken (using "_" or whatever as in other languages) or it just reads, proccesses and executes code line by line?

Thanks in advance.
PS Yes, I know it is horrible, don't blame on me :-)

Top
#21380 - 2002-05-08 08:06 PM Re: Is it possible to break code lines?
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
KiXtart will permit you to do that...
code:
$user="user2"
if $user="user1" or
$user="user2" or
$user="user3"
? "Do Something"
EndIf

Or are your trying to accomplish something else?

[ 08 May 2002, 20:06: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#21381 - 2002-05-08 09:12 PM Re: Is it possible to break code lines?
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
You might want to think about separating code and conditions. This way, you can permit other people to modify conditions without accessing the code. for Kixtart 4.x I would recommend using a .INI file that contains the condition. Example:
code:
.INI file:
[Conditions]
SpecialUsers=user1,user2,user3

code:
Kixtart code:
$specialusers=split(readprofilestring('conditions.ini','Conditions','SpecialUsers'),chr(10)
for each $user in $specialusers
if $user=@USERID
; do something
endif
next

Alternatively, if you need certain conditions based on user names, you could arrange users in a group on the domain controller and check whether a speciifc user is member of that group. Example:
Create a group 'Special Users' with group members 'User 1' and 'User2' on the domain controller
code:
if ingroup('Special Users')
; do something
endif

_________________________
There are two types of vessels, submarines and targets.

Top
#21382 - 2002-05-08 09:31 PM Re: Is it possible to break code lines?
Anonymous
Unregistered


Hello.
Thanks everybody.
That is what happens when you donīt try things yourself and believe others. Just tried it on my own after first reply and realized it was ok.

I asked the people who had done it and they tried to find the problem. It was a subtle problem with another admin (same login) loging on same TS from another machine. Environment variables messed up and that it why they got mad.

Thanks all.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 507 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.053 seconds in which 0.024 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org