Forum Discussion
Ryan_Moran
11 years agoValued Contributor
You'll want to look at the USEUNIT option as well as creating a global variable by placing it outside all procedures/functions. As far as securing the password you may use something like this for simple encryption/decryption:
'VBS Example
Function encrypt(Str, key)
Newstr = ""
lenKey = Len(key)
KeyPos = 1
LenStr = Len(Str)
str = StrReverse(str)
For x = 1 To LenStr
Newstr = Newstr & chr(asc(Mid(str,x,1)) + Asc(Mid(key,KeyPos,1)))
KeyPos = keypos + 1
If KeyPos > lenKey Then KeyPos = 1
Next
encrypt = Newstr
End Function
Function decrypt(str,key)
Newstr = ""
lenKey = Len(key)
KeyPos = 1
LenStr = Len(Str)
str=StrReverse(str)
For x = LenStr To 1 Step -1
Newstr = Newstr & chr(asc(Mid(str,x,1)) - Asc(Mid(key,KeyPos,1)))
KeyPos = KeyPos+1
If KeyPos > lenKey Then KeyPos = 1
Next
Newstr=StrReverse(Newstr)
decrypt = Newstr
End Function
Related Content
Recent Discussions
- 47 minutes agoSvetaG