Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBscript Server-side Password Validator needed 1

Status
Not open for further replies.

pandapark

Technical User
Jan 29, 2003
92
GB
Hi
I'm writing some basic server-side validation - must be vbscript
I'd like to incorporate within the code below a password checker for fields Pass1 and Pass2 i.e. they must be at least 6 characters, no spaces, at least one number and of course must match + anything else I've forgot !
I also could do with an email validator to fit in below

any help much appreciated
thanks

If Request.Form.Count > 0 Then
OrganisationName = Request.Form("Org_Name")
OrganisationType = Request.Form("Org_Type")
PostCode = Request.Form("PostCode")
Address = Request.Form("Address1_1")
Password = request.form("Pass1")
Password1 = request.form("Pass2")

If OrganisationName = "" Then
ErrorMsg1 = ErrorMsg11 & "Please enter your Organisation Name<br>"
End If
If OrganisationType = "" Then
ErrorMsg1 = ErrorMsg1 & "Please enter an Organisation type<br>"
End If
If PostCode = "" Then
ErrorMsg1 = ErrorMsg1 & "Please enter a PostCode<br>"
End If
If Address = "" Then
ErrorMsg1 = ErrorMsg1 & "Please enter an Address<br>"
End If

If ErrorMsg1 = "" Then
SQLString = "INSERT INTO tbl???("

For each Field in Request.Form
SQLString = SQLString & Field & ", "
Next

SQLString = Left(SQLString, (Len(SQLString) -2))

SQLString = SQLString + ") VALUES ("


For each Field in Request.Form
TheString="<input type=""HIDDEN"" name=""" & Field & """ value="""
StrValue = Request.Form(Field)
TheString=TheString + cstr(StrValue) & """>" & VbCrLf
Response.Write TheString
SQLString = SQLString + "'" & Request(Field) & "', "
Next

SQLString = Left(SQLString, (Len(SQLString) -2))
SQLString = SQLString + ");"
objCon.Execute(SQLString)
'if you need to perform any database validations
'this would be a good place.

'once you are all done redirect to a final page
Response.Redirect "main.asp?page=???"
End If
End If
 
thanks jason

I've seen a Password expression (although I wouldn't want the forced upper-case) as below
^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?!.*\s).{4,8}$

so how would I fit that in to my code above ?

thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top