成功的ASP批量删除修改操作实例




后台管理中心



<%dim body,selAdminID
   if request("action")="updat" then
    call update()
    response.redirect request.ServerVariables("HTTP_REFERER")
   elseif request("action")="del" then
    call del()
    response.redirect request.ServerVariables("HTTP_REFERER")
        elseif request("action")="pasword" then
    call pasword()
        elseif request("action")="newpass" then
    call newpass()
    response.redirect"?"
   elseif request("action")="add" then
    call addadmin()
   elseif request("action")="savenew" then
    call savenew()
    response.redirect"?"
   else
    call userlist()
   end if

sub userlist()
           if not isempty(request("selAdminID")) then
        selAdminID=trim(request("selAdminID"))
            if request("action")="删除" then
    call deladmin()
    elseif request("action")="激活" then
    call yesActive()
    elseif request("action")="锁定" then
    call noActive()
    else
    response.write "无效参数!"
    response.end
    end if  
end if
%>


                
                  
                
                
                  





                
<%
set rs=server.CreateObject("Adodb.recordSet")
if trim(request("s"))<>"" then
sql="select * from ca_gl where gl_name like '%"&trim(request("s"))&"%' and gl_qx=0 order by gl_time desc"
else
sql="select * from ca_gl where gl_qx=0 order by gl_time desc"
end if
rs.open sql,conn,1,1
if rs.eof and rs.bof then
Response.Write "

对不起!暂时没有任何信息。

"
else
do while not rs.eof
if Not Response.IsClientConnected then responseend
%>







<%
rs.movenext
loop
end if
rs.close
set rs=nothing
%>



管理员管理(点击用户名进行操作)
选择用户名上次登陆时间上次登陆IP操作状态

">
&action=pasword"><%=trim(rs("gl_name"))%><%=trim(rs("gl_time"))%><%=trim(rs("gl_ip"))%>&name=<%=trim(rs("gl_name"))%>" onClick="{if(confirm('此操作将删除该管理员\n 您确定执行此操作吗?')){this.document.myform.submit();return true;}return false;}">删除该用户  
<%
if rs("gl_yn")=1 then
response.write "正常"
else
response.write "锁定"
end if
%>
管理操作:选择/反选
  






<%
end sub

sub del()
dim rss3,sqls3
set rss3=server.CreateObject("Adodb.recordSet")
sqls3="select * from ca_gl where gl_id="&clng(request("id"))
rss3.open sqls3,conn,1,3
if rss3.eof and rss3.bof then
Response.Write "


对不起!无此信息!

"
else
rss3.Delete
rss3.update
Response.Write ""
Response.End
end if
rss3.close
set rss3=nothing
end sub

sub deladmin()
set rs=conn.execute("delete from ca_gl where gl_id In(" & selAdminID & ")")
Response.write""
end sub

sub yesActive()
set rs=conn.execute("update ca_gl set gl_yn = 1 where gl_id In(" & selAdminID & ")")
Response.Write("")
end sub

sub noActive()
set rs=conn.execute("update ca_gl set gl_yn = 0 where gl_id In(" & selAdminID & ")")
Response.Write("")
end sub

sub pasword()
set rs=server.CreateObject("adodb.recordset")
sql="select * from ca_gl where gl_id='"&int(request("id"))&"'"
rs.open sql,conn,1,2
if rs.eof and rs.bof then
Response.Write "


对不起!无此信息!

"
else
%>


              
                  
                
              
            
            
          
          
            
            
          
          
            
          
        
管理员资料管理--密码修改
                  
后台登陆名称:
              ">
            
后台登陆密码:
              ">
              "> (如要修改请直接输入)
            

              ">
              
            

        


<%
end if
rs.close
set rs=nothing
end sub

sub newpass()
if trim(request("username2"))<>"" and trim(request("password2"))<>"" then
dim rss2,sqls2
set rss2=server.CreateObject("Adodb.recordSet")
sqls2="select * from ca_gl where gl_id="&int(request("id"))
rss2.open sqls2,conn,1,3
if rss2.eof and rss2.bof then
Response.Write "


对不起!无此信息!

"
else
rss2("gl_name")=trim(request.form("username2"))
if trim(request.form("password1"))<>trim(request.form("password2")) then
rss2("gl_mima")=md5(trim(request.form("password2")))
Response.Write ""
end if
rss2.update
Response.Write ""
Response.End
end if
rss2.close
set rss2=nothing
else
Response.Write ""
end if

end sub

sub addadmin()
%>


              
                  
                
              
            
            
          
          
            
            
          
          
            
          
        
管理员管理--添加管理员
                  
后台登陆名称:
              
            
后台登陆密码:
              
            

              
            

        


<%
end sub
sub savenew()
dim adminuserid
if trim(request.form("username2"))="" then
Response.Write ""
exit sub
end if
if trim(request.form("password2"))="" then
Response.Write ""
exit sub
end if

dim rss1,sqls1
set rss1=server.CreateObject("Adodb.recordSet")
sqls1="select * from ca_gl where gl_name='"&trim(request("username2"))&"'"
rss1.open sqls1,conn,1,3
if rss1.eof and rss1.bof then
rss1.addnew
rss1("gl_name")=trim(request.form("username2"))
rss1("gl_mima")=md5(trim(request.form("password2")))
rss1("gl_yn")="1"
rss1("gl_qx")="0"
rss1.update
Response.Write ""
else
Response.Write ""
end if
rss1.close
set rss1=nothing

end sub

call admin_footer()
%>


上一篇: ASP批量删除操作代码[全]
下一篇: asp取时间
文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags:
相关日志:
评论: 0 | 引用: 0 | 查看次数: 1264
发表评论
昵 称:
密 码: 游客发言不需要密码.
邮 箱: 邮件地址支持Gravatar头像,邮箱地址不会公开.
网 址: 输入网址便于回访.
内 容:
验证码:
选 项:
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号.
字数限制 300 字 | UBB代码 开启 | [img]标签 关闭