/new/administrator/login.asp

https://github.com/akabeko/fusionexcel · ASP · 78 lines · 71 code · 7 blank · 0 comment · 5 complexity · 6540f13a0e822f8df8dafbdc977eb9ad MD5 · raw file

  1. <!--#include file="../libraries.asp" -->
  2. <%
  3. if not Session("login") = "" then
  4. Response.Redirect("Default.asp")
  5. end if
  6. if Request("submit") = "Login" then
  7. username = Request("username")
  8. password = Request("password")
  9. call SetConnection(GetUserDbPath())
  10. call OpenDatabase()
  11. sql = "SELECT * FROM tbl_users WHERE username='" & username & "' AND password='" & password & "'"
  12. call CreateRecordSet(RecordSet, sql)
  13. if not RecordSet.EOF then
  14. Session("login") = username
  15. Session.Timeout = 360
  16. if Request("redirect_url") <> "" then
  17. Response.Redirect(Request("redirect_url"))
  18. else
  19. Response.Redirect("Default.asp")
  20. end if
  21. else
  22. Dim query_string
  23. query_string = "msg=" & Server.URLEncode("Invalid username or password")
  24. if Request("redirect_url") <> "" then
  25. query_string = query_string & "&redirect_url=" & Server.URLEncode(Request("redirect_url"))
  26. End if
  27. Response.Redirect("login.asp?" & query_string)
  28. end if
  29. call CloseRecordSet(RecordSet)
  30. call CloseDatabase()
  31. end if
  32. %>
  33. <html xmlns="http://www.w3.org/1999/xhtml">
  34. <head>
  35. <title><%= title %></title>
  36. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  37. <link href="css/style.css" rel="stylesheet" type="text/css" />
  38. </head>
  39. <body>
  40. <div id="wrap">
  41. <div id="main">
  42. <div id="login_wrap">
  43. <div id="login_box">
  44. <form method="post">
  45. <table width="100%" cellpadding="0" cellspacing"0" border="0">
  46. <tr>
  47. <td colspan="2"><h1>Fusion Excel Content Management</h1></td>
  48. </tr>
  49. <tr>
  50. <td><label>Username: </label></td>
  51. <td><input type="text" name="username" id="username" maxlength="20" /></td>
  52. </tr>
  53. <tr>
  54. <td><label>Passsword: </label></td>
  55. <td><input type="password" name="password" id="password" maxlength="20" /></td>
  56. </tr>
  57. <tr>
  58. <td colspan="2" class="error"><%= Request("msg") %></td>
  59. </tr>
  60. <tr>
  61. <td>&nbsp;</td>
  62. <td><input type="submit" value="Login" name="submit" /></td>
  63. </tr>
  64. </table>
  65. </form>
  66. </div>
  67. </div>
  68. </div>
  69. </div>
  70. </body>
  71. </html>