⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 deluserinfo.asp

📁 同学录的设计
💻 ASP
字号:
<!--#include file=../../INC/txlconst.asp-->
<!--#include file=../../INC/txlfun.asp-->

<%
Dim const_txl_HomeUrl,sql,i,TXL_goodstr
const_txl_HomeUrl = "../../"
%>
<!--#include file=../checkadmin.asp-->
<%
OpenDatabase
txl_SiteHead const_txlname&"- 删除用户"
call online
IF Request.QueryString("action")="del" Then
	Call Del
Else
	call main
End If
CloseDatabase
SiteBottom
sub main
dim username,tmpcount
username=Trim(Request.QueryString("username"))
%>
<p><a href="<%=const_txl_HomeUrl&const_txlurl%>"><%=const_txlname%></a> &gt;&gt;后台管理&gt;&gt;<a href="usermanage.asp">用户管理</a>&gt;&gt;删除用户信息</p>
<form name="form1" method="post" action="?action=del&username=<%=username%>">
  <table width="571" border="0" cellspacing="2" cellpadding="2">
    <tr> 
      <td colspan="2">&nbsp;&nbsp;下面的操作将删除用户888的信息,请选择下面的删除选项</td>
    </tr>
    <tr> 
      <td width="36">&nbsp;</td>
      <td width="521"> 
        <%
	  tmpcount=fourm_info(username,"forum","studentid")
	  %>
        <input name="delitem1" type="checkbox" id="delitem1" value="checkbox" <%If not tmpcount>0 Then Response.Write("disabled") %>>
        删除该用户的留言信息 
        <%
		Response.Write("(目前信息条数:<font color=red>"&tmpcount&"</font>)")
		%>
      </td>
    </tr>
    <tr> 
      <td>&nbsp;</td>
      <td> 
        <%
	  tmpcount=fourm_info(username,"permsg","username")
	  %>
        <input name="delitem2" type="checkbox" id="delitem2" value="checkbox" <%If not tmpcount>0 Then Response.Write("disabled") %>>
        删除该用户的短信信息 
        <%
		Response.Write("(目前信息条数:<font color=red>"&tmpcount&"</font>)")
		%>
      </td>
    </tr>
    <tr> 
      <td>&nbsp;</td>
      <td> 
        <%
	  tmpcount=fourm_info(username,"Announce","username")
	  %>
        <input name="delitem3" type="checkbox" id="delitem3" value="checkbox" <%If not tmpcount>0 Then Response.Write("disabled") %>>
        删除该用户的班级论坛帖 
        <%
		Response.Write("(目前信息条数:<font color=red>"&tmpcount&"</font>)")
		%>
      </td>
    </tr>
    <tr> 
      <td>&nbsp;</td>
      <td> 
        <%
	  tmpcount=fourm_info(username,"photoforum","studentid")
	  %>
        <input name="delitem4" type="checkbox" id="delitem4" value="checkbox" <%If not tmpcount>0 Then Response.Write("disabled") %>>
        删除该用户的班级相册留言帖 
        <%
		Response.Write("(目前信息条数:<font color=red>"&tmpcount&"</font>)")
		%>
      </td>
    </tr>
    <tr> 
      <td>&nbsp;</td>
      <td> 
        <%
	  tmpcount=fourm_info(username,"photo","studentid")
	  %>
        <input name="delitem5" type="checkbox" id="delitem5" value="checkbox" <%If not tmpcount>0 Then Response.Write("disabled") %>>
        删除该用户上传的图片信息 
        <%
		Response.Write("(目前信息条数:<font color=red>"&tmpcount&"</font>)")
		%>
      </td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>
        <%
	  tmpcount=fourm_info(username,"ordersong","username")
	  %>
        <input name="delitem6" type="checkbox" id="delitem6" value="checkbox" <%If not tmpcount>0 Then Response.Write("disabled") %>>
        删除该用户的点歌信息 
        <%
		Response.Write("(目前信息条数:<font color=red>"&tmpcount&"</font>)")
		%>
      </td>
    </tr>
    <tr> 
      <td>&nbsp;</td>
      <td> <input name="delitem7" type="checkbox" id="delitem7" value="checkbox">
        删除该用户的基本信息&nbsp;&nbsp;<font color="gray">(删除基本信息前,请保证已删除了该用户以上条目信息)</font></td>
    </tr>
    <tr> 
      <td colspan="2"><font color="#FF0000">&nbsp;&nbsp;删除用户的基本信息之后请取消该用户在班级论坛的版主权限!</font></td>
    </tr>
    <tr> 
      <td>&nbsp;</td>
      <td><input type="submit" name="Submit" value="删除信息"></td>
    </tr>
    <tr> 
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
  </table>
</form>
<%End Sub%>
<%
Function fourm_info(username,tablename,colname)
	dim rs
	set rs=conn.execute ("select count(*) from "&tablename&" where "&colname&"='"&username&"'")
	fourm_info=rs(0)
	rs.close
	set rs=nothing
End Function
Function del_info(username,tablename,colname)
	conn.execute ("delete from "&tablename&" where "&colname&"='"&username&"'")
End Function
Sub del
	dim username,tmpcount,tmpstr
	tmpstr=""
	username=Trim(Request.QueryString("username"))
	If Request.Form("delitem1")<>"" Then
		tmpcount=fourm_info(username,"forum","studentid")
		If tmpcount>0 Then
			Call del_info(username,"forum","studentid")
			tmpstr=tmpstr&"<li>删除该用户留言帖信息成功,影响的记录数为:<font color=red>"&tmpcount&"</font></li>"
		End If
	End If
	
	If Request.Form("delitem2")<>"" Then
		tmpcount=fourm_info(username,"permsg","username")
		If tmpcount>0 Then
			Call del_info(username,"permsg","username")
			tmpstr=tmpstr&"<li>删除该用户短信信息成功,影响的记录数为:<font color=red>"&tmpcount&"</font></li>"
		End If
	End If
	
	If Request.Form("delitem3")<>"" Then
		tmpcount=fourm_info(username,"Announce","username")
		If tmpcount>0 Then
			Call del_info(username,"Announce","username")
			tmpstr=tmpstr&"<li>删除该用户班级论坛帖成功,影响的记录数为:<font color=red>"&tmpcount&"</font></li>"
		End If
	End If
	
	If Request.Form("delitem4")<>"" Then
		tmpcount=fourm_info(username,"photoforum","studentid")
		If tmpcount>0 Then
			Call del_info(username,"photoforum","studentid")
			tmpstr=tmpstr&"<li>删除该用户班级相册留言帖成功,影响的记录数为:<font color=red>"&tmpcount&"</font></li>"
		End If
	End If
	
	If Request.Form("delitem5")<>"" Then
		tmpcount=fourm_info(username,"photo","studentid")
		If tmpcount>0 Then
			dim photo_del_rs
			set photo_del_rs=conn.execute("select * from photo where studentid='"&username&"'")
			while not photo_del_rs.eof
				Call towrite_dellog(photo_del_rs("studentid"),photo_del_rs("pic"))
				photo_del_rs.movenext
			wend
			Call del_info(username,"photo","studentid")
			tmpstr=tmpstr&"<li>删除该用户上传的图片信息成功,同时删除信息已写入日志,影响的记录数为:<font color=red>"&tmpcount&"</font></li>"
		End If
	End If
	
	If Request.Form("delitem6")<>"" Then
		tmpcount=fourm_info(username,"ordersong","username")
		If tmpcount>0 Then
			Call del_info(username,"ordersong","username")
			tmpstr=tmpstr&"<li>删除该用户点歌信息成功,影响的记录数为:<font color=red>"&tmpcount&"</font></li>"
		End If
	End If
	
	If Request.Form("delitem7")<>"" Then
		If not checkuser_otherinfo(username) Then
			tmpstr=tmpstr&"<li><font color=red>删除基本信息出错,该用户的"&TXL_goodstr&"并没有删除,所以无法删除该用户的基本资料</font></li>"
		Else
			conn.execute ("delete from ec where studentid='"&username&"'")
			tmpstr=tmpstr&"<li>删除该用户基本资料成功</font></li>"
		End IF
	End If
	If tmpstr="" Then
		 Call printerror ("删除用户出错","<li>请选择相关操作</li>",779)
	Else
		Call	printsuc ("删除用户成功",tmpstr,779)
	End If
End Sub
Function towrite_dellog(sname,pic)
	dim rs,id,deltime
	set rs=Server.CreateObject("Adodb.Recordset")
	rs.open "select top 1 * from dellog order by id desc",conn,1,3
	If rs.eof Then
		ID=1
	Else
		ID=rs("Id")+1
	End if
	rs.addnew()
		Rs("ID")=ID
		Rs("sname")=sname
		Rs("pic")=pic
		Rs("deltime")=now()
	Rs.update
	Rs.close
	set rs=nothing
End Function
Function checkuser_otherinfo(username)
	Dim tmpcount
	TXL_goodstr=""
	tmpcount=fourm_info(username,"forum","studentid")
	If  tmpcount>0  Then
		TXL_goodstr="用户留言帖 "
	End If
	tmpcount=fourm_info(username,"permsg","username")
	If  tmpcount>0  Then
		TXL_goodstr=TXL_goodstr&"短信信息 "
	End If
	tmpcount=fourm_info(username,"Announce","username")
	If  tmpcount>0  Then
		TXL_goodstr=TXL_goodstr&"班级论坛帖 "
	End If
	tmpcount=fourm_info(username,"photoforum","studentid")
	If  tmpcount>0  Then
		TXL_goodstr=TXL_goodstr&"班级相册留言帖 "
	End If
	tmpcount=fourm_info(username,"photo","studentid")
	If  tmpcount>0  Then
		TXL_goodstr=TXL_goodstr&"用户上传的图片信息 "
	End If
	tmpcount=fourm_info(username,"ordersong","username")
	If  tmpcount>0  Then
		TXL_goodstr=TXL_goodstr&"点歌信息 "
	End If

	If 	TXL_goodstr="" Then
		checkuser_otherinfo=True
	Else
		checkuser_otherinfo=False
	End If
End Function
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -