SphereCommunity
Use only letters or numbers ? - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: Use only letters or numbers ? (/Thread-Use-only-letters-or-numbers)



Use only letters or numbers ? - Alias - 05-06-2012 11:17 PM

Hello i have found this password change scp i download section, i have try lot of wyas to do this but still ca't get right, so how could i make when can use only Latin letters and numbers but cant use like )($@# and another languaces for example china.
here the script.
and here is what i was trying to add
Code:
if !(STRMATCH(*a*,*b*,*c*,*d*,<ARGTXT[0]> ))
  src.sysmessage cant.
  else
  SRC.PASSWORD <ARGTXT[0]>
  RETURN 1
ENDIF

Code:
[Function changepassword]
SRC.DIALOG d_password

[dialog d_password]
40,0  
page 0
noclose
nomove
GUMPPIC 130 150 5170 //Top Left
GUMPPIC 150 150 5171 //Top
GUMPPIC 250 150 5171 //Top
GUMPPIC 420 150 5172 //Top right
GUMPPIC 130 188 5173 //LEFT
GUMPPIC 168 188 5174 //MIDDLE
GUMPPIC 250 188 5174 //MIDDLE
GUMPPIC 420 188 5175 //RIGHT
GUMPPIC 130 300 5176 //Bottom Left
GUMPPIC 150 300 5177 //Bottom
GUMPPIC 250 300 5177 //Bottom
GUMPPIC 420 300 5178 //Bottom Right
resizepic 190 250 3600 190 22
TEXT 174 190 00154 0 //
TEXT 254 210 00154 1 //
//TEXTENTRY 200 251 190 20 4 0 2
TEXTENTRY 200 251 190 20 1152 0 2
BUTTON 290 287 242 243 1 0 0 //Cancel
BUTTON 360 287 249 248 1 0 1 //Cancel
[dialog d_password text]
What would you like to change
password to?
0
[dialog d_password button]
onbutton=0
SRC.SYSMESSAGE Cancelled
RETURN 1
//onbutton=1
//IF (STRMATCH( *=*, <ARGTXT[0]> )) || (STRMATCH( *PLEVEL*, <ARGTXT[0]> ))
//SRC.SYSMESSAGE Plevel Hack Doesnt Work Here.
//RETURN 1
//ELSE
//SRC.PASSWORD <ARGTXT[0]>
//RETURN 1
//ENDIF

onbutton=1
IF (STRMATCH( *=*, <ARGTXT[0]> ))
  SRC.SYSMESSAGE You may not include = in your password.
  RETURN 1
elif !(STRCMPI("","<ARGTXT[0]>"))  // thanks to Acratia for
  src.sysmessage You need to supply a password.
  return 1
elif (STRMATCH(*eof*,<ARGTXT[0]> ))
  src.sysmessage You cannot use eof in your password.
  return 1
elif (STRMATCH(*\n*,<ARGTXT[0]> ))
  src.sysmessage You cannot use \n in your password.
  return 1
elif (STRMATCH(*plevel*,<ARGTXT[0]> ))
  src.sysmessage You cannot use plevel in your password.
  return 1
elif (STRMATCH(<src.account.password>,<ARGTXT[0]> ))
  src.sysmessage Whats the point of changing your pass if you're going to use your old one?
  return 1
elif (STRMATCH(* *,<ARGTXT[0]> ))
  src.sysmessage Your password cannot have a space in it.
  return 1
elif (STRLEN(<ARGTXT[0]> ) > 15))
  src.sysmessage Password cannot be longer than 15 characters.
  return 1
elif (STRLEN(<ARGTXT[0]> ) < 4))
  src.sysmessage Password cannot be shorter than 4 characters.
  return 1

ELSE
SRC.PASSWORD <ARGTXT[0]>
RETURN 1
ENDIF

[EOF]



RE: Use only letters or numbers ? - RanXerox - 05-06-2012 11:29 PM

Perhaps try STRREGEX instead of STRMATCH...

Quote:STRREGEX(pattern, text) Returns 1 if text matches the specified regular expression pattern.

Something like this maybe:

Code:
STRREGEX("[0-9a-zA-Z]*", <ARGTXT[0]>)

Disclaimer... I didn't test this :-)


RE: Use only letters or numbers ? - Alias - 05-07-2012 12:01 AM

Did i do it as you think? becouse it all the time say "you cannot" even ir i write abcd
Code:
IF (STRREGEX("[0-9a-zA-Z]*", <ARGTXT[0]>))
SRC.PASSWORD <ARGTXT[0]>
return 1
ELSE
src.sysmessage You canot.
return 1
ENDIF



RE: Use only letters or numbers ? - darksun84 - 05-07-2012 12:19 AM

you have to remove the " "


RE: Use only letters or numbers ? - Alias - 05-07-2012 03:02 AM

still wont work Confused


RE: Use only letters or numbers ? - Terrikate - 05-07-2012 05:16 AM

Code:
IF (STRREGEX(^[a-zA-Z0-9]+$, <ARGTXT[0]>))



RE: Use only letters or numbers ? - Alias - 05-07-2012 07:11 PM

(05-07-2012 05:16 AM)Terrikate Wrote:  
Code:
IF (STRREGEX(^[a-zA-Z0-9]+$, <ARGTXT[0]>))
Oh yeah, this is what i need!
TYVM! Wink