Page 1 of 2 12>
Topic Options
#130949 - 2004-12-09 11:04 PM Masking User ID
Fugazi Offline
Starting to like KiXtart

Registered: 2001-04-23
Posts: 142
Loc: Pace, Fl.
I am trying to set up an algorithm to mask a user ID in an INI file. Simple example below.

Code:
 
?"Enter USer ID "Gets $userid
If InStr ($userid,"z")
$letter="26"
EndIf
$number=SubStr ($userid,2,8)
$moduserid=($number+334455)



I am trying to get the $moduserid to add 334455 to the user number but it keeps appending the number to the end of the actual number.

Ex.
Get User ID: z12345678 ;setting the $userid variable
$moduserid= 1234567334455 ;results


Hope this makes sense.
_________________________
I haven't failed. I just found another way that did not work.

Top
#130950 - 2004-12-09 11:11 PM Re: Masking User ID
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Code:

$moduserid=($number+'334455')


Top
#130951 - 2004-12-09 11:15 PM Re: Masking User ID
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Just remove the brackets.

Code:

$moduserid= $number+334455




Quote:


?"Enter USer ID "Gets $userid
If InStr ($userid,"z")
$letter="26"
EndIf

$number=SubStr ($userid,2,8)
$moduserid=($number+334455)





What does $letter do? Gets filled and not used agian, why fil it then
This is just a part of the script??
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#130952 - 2004-12-09 11:17 PM Re: Masking User ID
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11624
Loc: CA
Don't think you can do it quite like that.

Your number would be z which is TEXT and you what? Want to add a number 334455 to the text? Or you want 26 to be added to 334455?

Top
#130953 - 2004-12-09 11:21 PM Re: Masking User ID
Fugazi Offline
Starting to like KiXtart

Registered: 2001-04-23
Posts: 142
Loc: Pace, Fl.
Both examples gave me the same results appending to the end of $number.


I want to add 334455 to $number


$letter is meant to be appended to the beginning of the final results of $moduserid

$letter + $moduserid


Edited by Fugazi (2004-12-09 11:33 PM)
_________________________
I haven't failed. I just found another way that did not work.

Top
#130954 - 2004-12-09 11:34 PM Re: Masking User ID
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11624
Loc: CA
Try something more like this....

Code:
?"Enter USer ID "Gets $userid 
If InStr ($userid,"z")
$letter="26"
EndIf

$number=SubStr ($userid,2,8)
$moduserid=$letter+334455

? 'Mod User ID: ' + $moduserid



Top
#130955 - 2004-12-09 11:37 PM Re: Masking User ID
Fugazi Offline
Starting to like KiXtart

Registered: 2001-04-23
Posts: 142
Loc: Pace, Fl.
That is still just appending 334455.

'Mod User ID: ' 26334455
_________________________
I haven't failed. I just found another way that did not work.

Top
#130956 - 2004-12-09 11:43 PM Re: Masking User ID
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2125
Loc: Tulsa, OK
Try removing the quotes from the $letter="26" line like below.

Code:

?"Enter USer ID : "Gets $userid
If InStr ($userid,"z")
$letter=26
EndIf

$number=SubStr ($userid,2,8)
$moduserid=$letter+334455

? 'Mod User ID: ' + $moduserid


Top
#130957 - 2004-12-09 11:43 PM Re: Masking User ID
Fugazi Offline
Starting to like KiXtart

Registered: 2001-04-23
Posts: 142
Loc: Pace, Fl.
When I removed the quotes from $letter=26 it added.

Now I want to add 334455 to the $number variable.
Question: If I do a substr is this treated as text?

If it's treated as text how would I translate it to a numeric expression?



Edited by Fugazi (2004-12-09 11:45 PM)
_________________________
I haven't failed. I just found another way that did not work.

Top
#130958 - 2004-12-09 11:44 PM Re: Masking User ID
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11624
Loc: CA
I see what you want now. Yes, odd it is not working as I'd expect. Testing some more
Top
#130959 - 2004-12-09 11:45 PM Re: Masking User ID
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4549
Loc: USA
Try adding val to this line

$number=val(SubStr ($userid,2,8))

Top
#130960 - 2004-12-09 11:47 PM Re: Masking User ID
Fugazi Offline
Starting to like KiXtart

Registered: 2001-04-23
Posts: 142
Loc: Pace, Fl.
Thank you! Adding Val allowed it to process as I was expecting.
_________________________
I haven't failed. I just found another way that did not work.

Top
#130961 - 2004-12-09 11:51 PM Re: Masking User ID
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11624
Loc: CA
Nope, not a VAL issue

The $letter="26" should be
$letter=26

By placing quotes around it modifies it to text.

Code:
?"Enter USer ID "Gets $userid 
If InStr ($userid,"z")
$letter=26
EndIf

$number=SubStr ($userid,2,8)
$moduserid=($letter + 334455)

? 'Mod User ID: ' + $moduserid


Top
#130962 - 2004-12-09 11:51 PM Re: Masking User ID
Fugazi Offline
Starting to like KiXtart

Registered: 2001-04-23
Posts: 142
Loc: Pace, Fl.
Would still like to know:

Is substr treated as text?
_________________________
I haven't failed. I just found another way that did not work.

Top
#130963 - 2004-12-09 11:54 PM Re: Masking User ID
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2125
Loc: Tulsa, OK
Yes SubStr returns text, which is why the Val() is needed. Whats an example of what you are you entering when prompted for the user ID?
Top
#130964 - 2004-12-09 11:55 PM Re: Masking User ID
Fugazi Offline
Starting to like KiXtart

Registered: 2001-04-23
Posts: 142
Loc: Pace, Fl.
Quote:

Nope, not a VAL issue

The $letter="26" should be
$letter=26





NTDOC I was trying to work with the $number variable. I actually do want to treat $letter as a text expression to append it to the beginning of the $number variable for the final results.
_________________________
I haven't failed. I just found another way that did not work.

Top
#130965 - 2004-12-09 11:56 PM Re: Masking User ID
Fugazi Offline
Starting to like KiXtart

Registered: 2001-04-23
Posts: 142
Loc: Pace, Fl.
Quote:

Yes SubStr returns text, which is why the Val() is needed. Whats an example of what you are you entering when prompted for the user ID?




Sample:

Z1234567
_________________________
I haven't failed. I just found another way that did not work.

Top
#130966 - 2004-12-10 12:02 AM Re: Masking User ID
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11624
Loc: CA
Okay, sorry. Yes, Al's code works then.

Code:
Break On
?"Enter USer ID " Gets $userid
If InStr ($userid,"z")
$letter="26"
EndIf
$number=val(SubStr ($userid,2,8))
$moduserid=($number+334455)
? $moduserid




Top
#130967 - 2004-12-10 12:02 AM Re: Masking User ID
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2125
Loc: Tulsa, OK
So something like this should do the trick.

Code:

?"Enter USer ID : "Gets $userid
If InStr ($userid,"z")
$letter="26"
EndIf
$number=Val(SubStr($userid,2,8))
$moduserid=$letter+($number+334455)
? 'Mod User ID: ' + $moduserid



You could also use the Int() where Val() is used as well. When I run the above and enter in Z12345678 for the ID it returns 2612680133...

Top
#130968 - 2004-12-10 12:07 AM Re: Masking User ID
Fugazi Offline
Starting to like KiXtart

Registered: 2001-04-23
Posts: 142
Loc: Pace, Fl.
Once again, thank you all for the help and the really quick responses.
_________________________
I haven't failed. I just found another way that did not work.

Top
Page 1 of 2 12>


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

Who's Online
0 registered and 366 anonymous users online.
Newest Members
Timothy, Jojo67, MaikSimon, kvn317, kixtarts2025
17874 Registered Users

Generated in 0.076 seconds in which 0.027 seconds were spent on a total of 13 queries. Zlib compression enabled.

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