PageRenderTime 49ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 0ms

/username.asp

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