SHARE
TWEET

Login.asp

a guest Aug 4th, 2011 290 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html>
  2.  
  3. <head>
  4. <title>Home</title>
  5. </head>
  6. <body>
  7. <form method="post">
  8. Username : <input name="username" type="text"><br>
  9. Password : <input name="password" type="password">
  10. <input type="submit"  value="LogIn" />
  11. </form>
  12.  
  13.  
  14. <%
  15.  
  16. Dim username
  17. Dim password
  18. Dim project
  19.  
  20. 'Getting information from submitted form
  21. username = request.form("username")
  22. password = request.form("password")
  23. project = request.querystring("project")
  24.  
  25.  
  26. Dim objconn,objRS,strSQL
  27. Set objconn = Server.CreateObject("ADODB.Connection")
  28. objconn.ConnectionString = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("db.mdb")
  29. objconn.Open
  30.  
  31. Set objRs = Server.CreateObject("ADODB.Recordset")
  32. Set rs = Server.CreateObject("ADODB.Recordset")
  33.  
  34.  
  35. SQLQuery = "select * from Users where username = '"&username&"' AND password = '"&password&"'"
  36. rs.Open SQLQuery, objconn
  37.  
  38.    if username = "" then
  39.         response.write "Please Enter your username and password"
  40.     else
  41.  
  42.     if rs.BOF and rs.EOF then
  43.         response.write "incorrect username or password , please try again"
  44.     else
  45. 'Files ID's for Current project
  46. 'strSQL = "SELECT FileID FROM Files WHERE ProjectID = "&project&" "
  47. 'Files ID's for Current user
  48. 'strSQL = "SELECT FileID FROM Permissions WHERE USERID = "&rs("ID")&" "  
  49.  
  50. 'Link from Permissions and Files
  51.  
  52. strSQL = "SELECT Files.FileName FROM Files INNER JOIN Permissions ON Files.FileID = Permissions.FileID WHERE Files.ProjectID = "&project&" AND USERID = "&rs("ID")&""
  53.  
  54.  
  55. objRS.Open strSQL, objconn
  56.  
  57. Do While Not objRS.EOF
  58.  
  59. response.write "<a href='" & objRs("FileName") & "'><b>" & objRs("FileName") & "</a><br>"
  60. objRS.MoveNext
  61. Loop
  62.  
  63. objRs.Close
  64. objconn.Close
  65.  
  66. end if
  67. end if  %>
  68. </body>
  69. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top