<!--#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 top(1,1)
	Call Error("Information",ErrMsg)
	
Else
dim title,content,weather,xinqing,ispub,addtime,sampname

title=clasky_string(request("title"))
content=clasky_string(request("content"))
weather=clasky_string(request("weather"))
xinqing=clasky_string(request("xinqing"))
sampname=clasky_string(request("sampname"))
ispub=clasky_string(request("ispub"))

if ispub="" then ispub="1"
addtime=clasky_string(request("a_year"))&"-"&clasky_string(request("a_month"))&"-"&clasky_string(request("a_day"))
	Response.Write "<script>"
if datediff("d",addtime,now)>=0 then
	set rs=server.createobject("adodb.recordset")
	sql="select * from clasky_diary where (state = 'v' and addtime like '"&addtime&"' and whois='"&membername&"')"			
    rs.open sql,clasky_cn,1,3
	if rs.eof then
		clasky_cn.execute("insert into clasky_diary (weather,xinqing,sampname,title,content,addtime,whois,ispub) values ('"&weather&"','"&xinqing&"','"&sampname&"','"&title&"','"&content&"','"&addtime&"','"&membername&"','"&ispub&"')")
		'Response.Write("insert into clasky_diary (weather,xinqing,title,content,addtime,whois) values ('"&weather&"','"&xinqing&"','"&title&"','"&content&"','"&addtime&"','"&membername&"')")

		Response.Write "alert('您的操作已经成功！');"
		Response.Write "top.window.close();"
	else
		Response.Write "alert('这天的日记你已经写过了，请到个人日记里面查看！');"
	end if
	rs.close
else
	Response.Write "alert('你写的是以后的日记，呵呵，不可以哦！');"
end if
Response.Write "</script>"
call Close_clasky_cn
 end if%>
