Advertisement
Guest User

Untitled

a guest
Sep 30th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. <%@ LANGUAGE="VBSCRIPT" %>
  2. <HTML>
  3. <HEAD>
  4. <TITLE>LoginScript</TITLE>
  5. </HEAD>
  6. <BODY>
  7.  
  8. <%
  9.  
  10. dim userName, password, query
  11. dim conn, rs
  12.  
  13. userName = Request.Form("userName")
  14. password = Request.Form("password")
  15.  
  16. response.write userName & "<P>"
  17.  
  18. <!--Here is my regex condition to test for whitelist validation -->
  19. if (System.Text.RegularExpressions.Regex.IsMatch(username, "^[a-zA-Z0-9]+$"))
  20. response.write("Valid Name");
  21.  
  22. set conn = server.createObject("ADODB.Connection")
  23. set rs = server.createObject("ADODB.Recordset")
  24.  
  25. query = "select UserName from users where userName='" & userName & "' and userPass='" & password & "'"
  26. response.write query & "<P>"
  27.  
  28.  
  29. conn.Open "Provider=SQLOLEDB;server=x.x.x.x; Catalog=SQL_DB; User Id=user; Password=pass"
  30. rs.activeConnection = conn
  31. rs.open query
  32.  
  33. ' response.write query & "<p>"
  34.  
  35. if not rs.eof then
  36. response.write "Logged In As: " & rs.fields(0).value
  37. else
  38. response.write "User or Password combination not found"
  39. end if
  40.  
  41. %>
  42.  
  43. else
  44. response.Write("Invalid Name");
  45.  
  46. </BODY>
  47. </HTML>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement