PageRenderTime 52ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/username.asp

http://baoguan.googlecode.com/
ASP | 235 lines | 225 code | 2 blank | 8 comment | 13 complexity | 340e13d6581d44b7fc4072640193d0c3 MD5 | raw file
Possible License(s): MIT, GPL-2.0
  1. <!--#include file="lib/utf-8.asp"-->
  2. <!--#include file="lib/connopen.asp"-->
  3. <!--#include file="lib/asp-common-lib.asp"-->
  4. <!DOCTYPE HTML>
  5. <html>
  6. <head>
  7. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  8. <title>???????</title>
  9. <!--#include file="lib/plugins.asp"-->
  10. <style type="text/css">
  11. .yform .type-check label {
  12. width: 6em;
  13. display: inline-block;
  14. }
  15. .subcl,.subcr,.subc {
  16. padding-bottom: 100em;
  17. margin-bottom: -100em;
  18. }
  19. h6 {
  20. background: #600;
  21. color: white;
  22. font-weight: bold;
  23. padding: 5px 10px;
  24. }
  25. #tablelist{
  26. font-family:??;
  27. }
  28. </style>
  29. <script type="text/javascript">
  30. $(function() {
  31. $("#form1").validationEngine();
  32. $("input:checked").next().next().prop("disabled",false)
  33. $("input[name='post']").click(function(){
  34. if($(this).prop("checked")){
  35. $(this).next().next().prop("disabled",false)
  36. }else{
  37. $(this).next().next().prop("disabled",true)
  38. }
  39. });
  40. });
  41. </script>
  42. <!--#include file="lib/js-google-analytics.asp"-->
  43. </head>
  44. <%
  45. if not CheckPostFlag(session("aaPostFlag"),0,15) then call JumpErrorPage(2)
  46. id=request("id")
  47. submit=request("submit")
  48. If submit<>"" Then
  49. conn.BeginTrans
  50. username=LCase(request("username"))
  51. password=request("password")
  52. fullname=request("fullname")
  53. active=request("active")
  54. wan=request("wan")
  55. if active="" then active=false
  56. if wan="" then wan=false
  57. if submit="??" then
  58. sql="insert into username(username,[password],fullname,active,wan) values('"&username&"','"&password&"','"&fullname&"',"&active&","&wan&")"
  59. 'response.write(sql)
  60. 'response.end
  61. newuserid=ExecuteCommand(sql,true)
  62. end if
  63. if submit="??" then
  64. sql="update username set username='"&username&"',[password]='"&password&"',fullname='"&fullname&"',active="&active&",wan="&wan&" where id="&id
  65. call ExecuteCommand(sql,false)
  66. sql="delete * from flag where username="&id
  67. call ExecuteCommand(sql,false)
  68. newuserid=id
  69. end if
  70. for i=1 to request.form("post").count
  71. post=request.form("post")(i)
  72. flag=request.form("flag")(i)
  73. sql="insert into flag(username,post,flag) values("&newuserid&","&post&","&flag&")"
  74. call ExecuteCommand(sql,flase)
  75. next
  76. if err.number=0 then
  77. conn.CommitTrans '????conn??????????
  78. else
  79. conn.RollbackTrans '????
  80. '????????
  81. 'strerr=err.Description
  82. url=request.ServerVariables("http_host")&request.ServerVariables("url")
  83. Response.Write "??????<br /><font color=red>Error # " & CStr(Err.Number) & "<br />" & Err.Description & "<br />Source: " & Err.Source &"<br />?????"&url&"</font><br />"
  84. Response.End
  85. end if
  86. end if
  87. if id<>"" then
  88. Set rs = Server.CreateObject("ADODB.Recordset")
  89. sql = "select * from username left join flag on username.id=flag.username where id="&id
  90. rs.Open sql,conn,1,1
  91. username=rs("username.username")
  92. password=rs("password")
  93. fullname=rs("fullname")
  94. active=rs("active")
  95. wan=rs("wan")
  96. aaFlag=rs.getrows(,,array("post","flag"))
  97. rs.close
  98. set rs=nothing
  99. ' else
  100. ' dim aaFlag(1,0)
  101. ' aaFlag(0,0)=null
  102. ' aaFlag(1,0)=null
  103. end if
  104. %>
  105. <body>
  106. <!--#include file="lib/header.asp"-->
  107. <!--#include file="lib/nav.asp"-->
  108. <div id="main">
  109. <!--#include file="lib/col1.asp"-->
  110. <!--#include file="lib/col2.asp"-->
  111. <div id="col3" role="main">
  112. <div id="col3_content" class="clearfix">
  113. <form id="form1" name="form1" method="post" class="yform" role="application">
  114. <div class="subcolumns equalize">
  115. <div class="c50l">
  116. <div class="subcl">
  117. <h6>????</h6>
  118. <div class="type-text">
  119. <label for="username">???*</label>
  120. <input name="username" class="validate[required,minSize[3],maxSize[10],custom[onlyLcaseLetter]]" maxlength="10" id="username" type="text" value="<%=username%>" />
  121. </div>
  122. <div class="type-text">
  123. <label for="password">??*</label>
  124. <input name="password" class="validate[required,minSize[6],maxSize[10],custom[onlyPassword]]" maxlength="10" id="password" type="password" value="<%=password%>" />
  125. </div>
  126. <div class="type-text">
  127. <label for="fullname">??*</label>
  128. <input name="fullname" class="validate[required,minSize[2],maxSize[4]]" maxlength="4" id="fullname" type="text" value="<%=fullname%>" />
  129. </div>
  130. <div class="type-check">
  131. <input name="active" id="active" type="checkbox" value="true" <%if active then response.write("checked='checked'")%> />
  132. <label for="active">????</label>
  133. </div>
  134. <div class="type-check">
  135. <input name="wan" id="wan" type="checkbox" value="true" <%if wan then response.write("checked='checked'")%> />
  136. <label for="wan">????</label>
  137. </div>
  138. </div>
  139. </div>
  140. <div class="c50r">
  141. <div class="subcr">
  142. <h6>????</h6>
  143. <%
  144. Set rs_post = Server.CreateObject("ADODB.Recordset")
  145. sql_post = "SELECT * FROM post order by id"
  146. rs_post.Open sql_post,conn,1,1
  147. do while not rs_post.eof
  148. %>
  149. <div class="type-check">
  150. <input name="post" id="post<%=rs_post("id")%>" type="checkbox" value="<%=rs_post("id")%>" <%if CheckPost(aaFlag,rs_post("id")) then response.write("checked='checked'")%> />
  151. <label for="post<%=rs_post("id")%>"><%=rs_post("post")%></label>
  152. <select name="flag" disabled="disabled">
  153. <%
  154. aAuthKey=dAuthority.keys
  155. aAuthItem=dAuthority.items
  156. for iAuthLoop=0 to dAuthority.count-1
  157. %>
  158. <option value="<%=aAuthKey(iAuthLoop)%>" <%if CheckPost(aaFlag,rs_post("id")) and GetFlagValue(aaFlag,rs_post("id"))=cint(aAuthKey(iAuthLoop)) then response.write("selected")%>><%=aAuthItem(iAuthLoop)%></option>
  159. <%
  160. next
  161. %>
  162. </select>
  163. </div>
  164. <%
  165. rs_post.movenext
  166. loop
  167. rs_post.close
  168. set rs_post=nothing
  169. %>
  170. </div>
  171. </div>
  172. </div>
  173. <div class="type-button">
  174. <%if id="" then%>
  175. <input type="submit" name="submit" value="??" />
  176. <%end if%>
  177. <%if id<>"" and id<>1 then%>
  178. <input type="submit" name="submit" value="??" />
  179. <%end if%>
  180. </div>
  181. </form>
  182. <table id="tablelist" class="full">
  183. <thead>
  184. <tr><th colspan="5" scope="col">????</th></tr>
  185. </thead>
  186. <tbody>
  187. <tr>
  188. <th scope="col">???</th>
  189. <th scope="col">??</th>
  190. <th scope="col">??</th>
  191. <th scope="col">????</th>
  192. <th scope="col">??</th>
  193. </tr>
  194. <%
  195. sql = "select * from username"
  196. Set rs = Server.CreateObject("ADODB.Recordset")
  197. rs.Open sql,conn,1,1
  198. do while not rs.eof
  199. %>
  200. <tr>
  201. <th class="sub" scope="row"><a href="username.asp?id=<%=rs("id")%>"><%=rs("username")%></a></th>
  202. <td><%=rs("fullname")%></td>
  203. <td><%if rs("active") then response.write("??")%></td>
  204. <td><%if rs("wan") then response.write("?")%></td>
  205. <td>
  206. <%
  207. Set rs_flag = Server.CreateObject("ADODB.Recordset")
  208. sql_flag="SELECT post.post,flag from flag inner join post on flag.post=post.id where username="&rs("id")
  209. rs_flag.Open sql_flag,conn,1,1
  210. do while not rs_flag.eof
  211. response.write(FillSpace(rs_flag("post"),12)&"?"&dAuthority(cstr(rs_flag("flag")))&"<br />")
  212. rs_flag.movenext
  213. loop
  214. rs_flag.close
  215. set rs_flag=nothing
  216. %>
  217. </td>
  218. </tr>
  219. <%
  220. rs.movenext
  221. loop
  222. rs.close
  223. set rs=nothing
  224. %>
  225. </tbody>
  226. </table>
  227. </div>
  228. </div>
  229. </div>
  230. <!--#include file="lib/footer.asp"-->
  231. </body>
  232. </html>
  233. <!--#include file="lib/connclose.asp"-->