<!--#INCLUDE FILE="conn.asp" -->
<!--#include file="Diary_Conn.asp"-->
<!--#INCLUDE FILE="Class_Checkuser.asp" -->
<!--#INCLUDE FILE="Class_Top.asp" -->
<%
locat="风铃日记"

if membername="" Then
  	ErrMsg=ErrMsg+"<br>"+"<li>您还没有<a href=Class_Login.asp><font color=red>登录或注册校友录</font></a>。"
	Call pagehead()
	Call Error("Information",ErrMsg)
	 call footer() 
Else
	dim id,msgs
msgs="Error"
	for each id in request("id")
	if c_check(id) then call del(id)
	Response.Write(id)
	next

	Response.Write "<script>"
	Response.Write "alert('操作完成;"&msgs&"');"
	Response.Write("parent.window.location.reload();")
	Response.Write "</script>"


sub del(a)

 set rs=server.createobject("adodb.recordset")
    sql="select * from clasky_diary where id = "&a
		rs.open sql,clasky_cn,1,3
		rs("state")="d"
		rs.update
		rs.close	
end sub 

function c_check(a)
if not sysadmin then 
	 set rs=server.createobject("adodb.recordset")
     sql="select whois from clasky_diary where id = "&a
	 rs.open sql,clasky_cn,1,3
		if not rs.eof then
			if rs(0)=membername then
			c_check=true
			msgs="ok"
			else
			c_check=false
			msgs="你没有权限删除该日记！"
			end if 
		else
			c_check=false
			msgs="你没有权限删除该日记！"
		end if
	rs.close

else
	c_check=true
	msgs="ok"
end if		
end function

clasky_cn.close
end if
%>