How to Change a Network Password
Keywords: password
This code changes a network password. Example is targetted
to Novell networks on 16 bit platforms.
AddExtender("wwn3x16i.dll")
BLACK="0,0,0"
WHITE="255,255,255"
RED="255,0,0"
GREEN="0,255,0"
DKGRAY="128,128,128"
GRAY="192,192,192"
LTGRAY="240,240,240"
DKRED="128,0,0"
DKGREEN="0,128,0"
BLUE="0,0,255"
PURPLE="255,0,255"
YELLOW="255,255,0"
CYAN="0,255,255"
DKBLUE="0,0,128"
DKPURPLE="128,0,128"
DKYELLOW="128,128,0"
DKCYAN="0,128,128"
servers = n3ServerList(0)
numservers = Itemcount(servers,@TAB)
user = n3GetUser(n3ServerList(1))
BoxColor(1,"192,192,192",0)
BoxesUp("250,300,750,700", @normal)
BoxCaption(1, "Changing Network Password")
BoxDrawRect(1, "0,0,1000,1000", 1)
BoxDrawText(1,"175,10,825,100","Change Password for: %user%",@TRUE,1)
BoxTextColor(1,"0,0,128")
BoxTextFont(1, "Times Roman", 100, 0, 16)
UL="100,100"
UR="900,100"
LL="100,900"
LR="900,900"
gosub draw_sunken
oldpass = askpassword("D&T Password","Current Password? ")
:asknewpass
newpass = askpassword("D&T Password","New Password? ")
if strlen(newpass) < 5
message("Sorry!","New password is too short!%@CRLF%Must be 5 Characters
or longer.")
goto asknewpass
endif
verpass = askpassword("D&T Password","Retype New Password? ")
if newpass != verpass
message("Sorry!","You mistyped your new password.%@CRLF%Please Try
again.")
goto asknewpass
endif
if strcmp(newpass,oldpass) == 0
message("Sorry!","You can not use the same password!")
goto asknewpass
endif
;BoxDrawRect(1, "0,0,1000,1000", 1)
BoxDrawText(1,"200,200,800,350","Changing Passwords,%@CRLF%Please
Wait...",@TRUE,1)
ErrorMode(@OFF)
for x=1 to numservers
server%x%=itemextract(x,servers,@TAB)
retval = N3ChgPassword(server%x%,user,oldpass,newpass)
if retval == 1 then
res%x% = 1
else
errcode=LastError()
res%x% = "Error %errcode%"
endif
next x
line=""
for x=1 to numservers
server=server%x%
if res%x% == 1
msg = "Changed"
else
error=res%x%
msg = "Not changed"
endif
line = "%line%%server% %@TAB%->%@TAB% %msg% %@CRLF%"
next x
BoxDrawRect(1, "200,200,800,400", 2)
;BoxColor(1,"192,192,192",0)
BoxTextFont(1, "Times Roman", 150, 0, 16)
BoxDrawText(1,"200,200,800,300","Results",@TRUE,1)
BoxTextFont(1, "Times Roman", 70, 0, 16)
BoxTextColor(1,"0,0,0")
BoxDrawText(1,"200,400,800,800",line,@TRUE,1)
BoxButtonDraw(1, 1, "Okay", "400,750,600,850")
bWho=0
while bWho == 0
for x =1 to 1
if BoxButtonStat(1,x) then bWho=x
next
endwhile
exit
:Draw_Sunken
BoxPen(1,DKGRAY,1)
BoxDrawLine(1,"%UL%,%UR%")
BoxDrawLine(1,"%UL%,%LL%")
BoxPen(1,LTGRAY,1)
BoxDrawLine(1,"%UR%,%LR%")
BoxDrawLine(1,"%LL%,%LR%")
return
Article ID: W13602
Filename: How to Change a Novell Password Example.txt