/username.asp
ASP | 235 lines | 225 code | 2 blank | 8 comment | 13 complexity | 340e13d6581d44b7fc4072640193d0c3 MD5 | raw file
Possible License(s): MIT, GPL-2.0
- <!--#include file="lib/utf-8.asp"-->
- <!--#include file="lib/connopen.asp"-->
- <!--#include file="lib/asp-common-lib.asp"-->
- <!DOCTYPE HTML>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>???????</title>
- <!--#include file="lib/plugins.asp"-->
- <style type="text/css">
- .yform .type-check label {
- width: 6em;
- display: inline-block;
- }
- .subcl,.subcr,.subc {
- padding-bottom: 100em;
- margin-bottom: -100em;
- }
- h6 {
- background: #600;
- color: white;
- font-weight: bold;
- padding: 5px 10px;
- }
- #tablelist{
- font-family:??;
- }
- </style>
- <script type="text/javascript">
- $(function() {
- $("#form1").validationEngine();
- $("input:checked").next().next().prop("disabled",false)
- $("input[name='post']").click(function(){
- if($(this).prop("checked")){
- $(this).next().next().prop("disabled",false)
- }else{
- $(this).next().next().prop("disabled",true)
- }
- });
- });
- </script>
- <!--#include file="lib/js-google-analytics.asp"-->
- </head>
- <%
- if not CheckPostFlag(session("aaPostFlag"),0,15) then call JumpErrorPage(2)
- id=request("id")
- submit=request("submit")
- If submit<>"" Then
- conn.BeginTrans
- username=LCase(request("username"))
- password=request("password")
- fullname=request("fullname")
- active=request("active")
- wan=request("wan")
- if active="" then active=false
- if wan="" then wan=false
- if submit="??" then
- sql="insert into username(username,[password],fullname,active,wan) values('"&username&"','"&password&"','"&fullname&"',"&active&","&wan&")"
- 'response.write(sql)
- 'response.end
- newuserid=ExecuteCommand(sql,true)
- end if
- if submit="??" then
- sql="update username set username='"&username&"',[password]='"&password&"',fullname='"&fullname&"',active="&active&",wan="&wan&" where id="&id
- call ExecuteCommand(sql,false)
- sql="delete * from flag where username="&id
- call ExecuteCommand(sql,false)
- newuserid=id
- end if
- for i=1 to request.form("post").count
- post=request.form("post")(i)
- flag=request.form("flag")(i)
- sql="insert into flag(username,post,flag) values("&newuserid&","&post&","&flag&")"
- call ExecuteCommand(sql,flase)
- next
- if err.number=0 then
- conn.CommitTrans '????conn??????????
- else
- conn.RollbackTrans '????
- '????????
- 'strerr=err.Description
- url=request.ServerVariables("http_host")&request.ServerVariables("url")
- Response.Write "??????<br /><font color=red>Error # " & CStr(Err.Number) & "<br />" & Err.Description & "<br />Source: " & Err.Source &"<br />?????"&url&"</font><br />"
- Response.End
- end if
-
- end if
- if id<>"" then
- Set rs = Server.CreateObject("ADODB.Recordset")
- sql = "select * from username left join flag on username.id=flag.username where id="&id
- rs.Open sql,conn,1,1
- username=rs("username.username")
- password=rs("password")
- fullname=rs("fullname")
- active=rs("active")
- wan=rs("wan")
- aaFlag=rs.getrows(,,array("post","flag"))
- rs.close
- set rs=nothing
- ' else
- ' dim aaFlag(1,0)
- ' aaFlag(0,0)=null
- ' aaFlag(1,0)=null
- end if
- %>
- <body>
- <!--#include file="lib/header.asp"-->
- <!--#include file="lib/nav.asp"-->
- <div id="main">
- <!--#include file="lib/col1.asp"-->
- <!--#include file="lib/col2.asp"-->
- <div id="col3" role="main">
- <div id="col3_content" class="clearfix">
- <form id="form1" name="form1" method="post" class="yform" role="application">
- <div class="subcolumns equalize">
- <div class="c50l">
- <div class="subcl">
- <h6>????</h6>
- <div class="type-text">
- <label for="username">???*</label>
- <input name="username" class="validate[required,minSize[3],maxSize[10],custom[onlyLcaseLetter]]" maxlength="10" id="username" type="text" value="<%=username%>" />
- </div>
- <div class="type-text">
- <label for="password">??*</label>
- <input name="password" class="validate[required,minSize[6],maxSize[10],custom[onlyPassword]]" maxlength="10" id="password" type="password" value="<%=password%>" />
- </div>
- <div class="type-text">
- <label for="fullname">??*</label>
- <input name="fullname" class="validate[required,minSize[2],maxSize[4]]" maxlength="4" id="fullname" type="text" value="<%=fullname%>" />
- </div>
- <div class="type-check">
- <input name="active" id="active" type="checkbox" value="true" <%if active then response.write("checked='checked'")%> />
- <label for="active">????</label>
- </div>
- <div class="type-check">
- <input name="wan" id="wan" type="checkbox" value="true" <%if wan then response.write("checked='checked'")%> />
- <label for="wan">????</label>
- </div>
- </div>
- </div>
- <div class="c50r">
- <div class="subcr">
- <h6>????</h6>
- <%
- Set rs_post = Server.CreateObject("ADODB.Recordset")
- sql_post = "SELECT * FROM post order by id"
- rs_post.Open sql_post,conn,1,1
- do while not rs_post.eof
- %>
- <div class="type-check">
- <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'")%> />
- <label for="post<%=rs_post("id")%>"><%=rs_post("post")%></label>
- <select name="flag" disabled="disabled">
- <%
- aAuthKey=dAuthority.keys
- aAuthItem=dAuthority.items
- for iAuthLoop=0 to dAuthority.count-1
- %>
- <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>
- <%
- next
- %>
- </select>
- </div>
- <%
- rs_post.movenext
- loop
- rs_post.close
- set rs_post=nothing
- %>
- </div>
- </div>
- </div>
- <div class="type-button">
- <%if id="" then%>
- <input type="submit" name="submit" value="??" />
- <%end if%>
- <%if id<>"" and id<>1 then%>
- <input type="submit" name="submit" value="??" />
- <%end if%>
- </div>
- </form>
- <table id="tablelist" class="full">
- <thead>
- <tr><th colspan="5" scope="col">????</th></tr>
- </thead>
- <tbody>
- <tr>
- <th scope="col">???</th>
- <th scope="col">??</th>
- <th scope="col">??</th>
- <th scope="col">????</th>
- <th scope="col">??</th>
- </tr>
- <%
- sql = "select * from username"
- Set rs = Server.CreateObject("ADODB.Recordset")
- rs.Open sql,conn,1,1
- do while not rs.eof
- %>
- <tr>
- <th class="sub" scope="row"><a href="username.asp?id=<%=rs("id")%>"><%=rs("username")%></a></th>
- <td><%=rs("fullname")%></td>
- <td><%if rs("active") then response.write("??")%></td>
- <td><%if rs("wan") then response.write("?")%></td>
- <td>
- <%
- Set rs_flag = Server.CreateObject("ADODB.Recordset")
- sql_flag="SELECT post.post,flag from flag inner join post on flag.post=post.id where username="&rs("id")
- rs_flag.Open sql_flag,conn,1,1
- do while not rs_flag.eof
- response.write(FillSpace(rs_flag("post"),12)&"?"&dAuthority(cstr(rs_flag("flag")))&"<br />")
- rs_flag.movenext
- loop
- rs_flag.close
- set rs_flag=nothing
- %>
- </td>
- </tr>
- <%
- rs.movenext
- loop
- rs.close
- set rs=nothing
- %>
- </tbody>
- </table>
- </div>
- </div>
- </div>
- <!--#include file="lib/footer.asp"-->
- </body>
- </html>
- <!--#include file="lib/connclose.asp"-->
-