Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%@ LANGUAGE="VBSCRIPT" %>
- <HTML>
- <HEAD>
- <TITLE>LoginScript</TITLE>
- </HEAD>
- <BODY>
- <%
- dim userName, password, query
- dim conn, rs
- userName = Request.Form("userName")
- password = Request.Form("password")
- response.write userName & "<P>"
- <!--Here is my regex condition to test for whitelist validation -->
- if (System.Text.RegularExpressions.Regex.IsMatch(username, "^[a-zA-Z0-9]+$"))
- response.write("Valid Name");
- set conn = server.createObject("ADODB.Connection")
- set rs = server.createObject("ADODB.Recordset")
- query = "select UserName from users where userName='" & userName & "' and userPass='" & password & "'"
- response.write query & "<P>"
- conn.Open "Provider=SQLOLEDB;server=x.x.x.x; Catalog=SQL_DB; User Id=user; Password=pass"
- rs.activeConnection = conn
- rs.open query
- ' response.write query & "<p>"
- if not rs.eof then
- response.write "Logged In As: " & rs.fields(0).value
- else
- response.write "User or Password combination not found"
- end if
- %>
- else
- response.Write("Invalid Name");
- </BODY>
- </HTML>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement