<!--#include file="Function.asp"-->
<%
Const jyAuthor = "开心就好"
Const jyQQ = "27375"
Const jySiteUrl = "http://www.duoluojie.com/"
Const jyBbsUrl = "http://www.duoluojie.com/bbs/"
Const jyPlusCheckUrl = "http://www.duoluojie.com/Dvbbs/Edition.aspx"

Class JyPlus
	Public PlusId,PlusName,PlusEdition,PlusLastUpdateTime
	Public UserName,UserId
	Public strSqlNow

	Public Sub Class_Initialize()
		UserId=dvbbs.UserId
		UserName=dvbbs.membername
		if IsSqlDataBase = 1 then
			strSqlNow="'"&now()&"'"
		else
			strSqlNow="#"&now()&"#"
		end if
	End Sub
	
	
	Sub SendMessage(FromUser,ToUser,Title,Content)
		Conn.execute("Insert into Dv_Message (sender,title,incept,content,sendtime,isSend,flag) Values('"&FromUser&"','"&title&"','"&ToUser&"','"&Content&"',"&strSqlNow&",1,0)")
	End Sub
	
	
	'更新用户短信通知信息（新短信条数||新短讯ID||发信人名）
	Sub update_user_msg(username)
		Dim msginfo,i,UP_UserInfo,newmsg
		newmsg=newincept(username)
		If newmsg>0 Then
			msginfo=newincept(username) & "||" & inceptid(1,username) & "||" & inceptid(2,username)
		Else
			msginfo="0||0||null"
		End If
		Dvbbs.execute("UPDATE [Dv_User] Set UserMsg='"&Dvbbs.CheckStr(msginfo)&"' WHERE username='"&Dvbbs.CheckStr(username)&"'")
		If username=Dvbbs.MemberName Then
			UP_UserInfo=Session(Dvbbs.CacheName & "UserID")
			UP_UserInfo(30)=msginfo
			Session(Dvbbs.CacheName & "UserID")=UP_UserInfo
		Else
			Call Dvbbs.NeedUpdateList(username,1)
		End If
	End Sub
	'统计留言
	Function newincept(iusername)
		Dim Rs
		Rs=Dvbbs.execute("SELECT Count(id) FROM Dv_Message WHERE flag=0 And issend=1 And DelR=0 And incept='"& iusername &"'")
		newincept=Rs(0)
		Set Rs=nothing
		If isnull(newincept) Then newincept=0
	End Function	
	
	Function inceptid(stype,iusername)
		Dim Rs
		Set Rs=Dvbbs.execute("SELECT top 1 id,sender FROM Dv_Message WHERE flag=0 And issend=1 And DelR=0 And incept='"& iusername &"'")
		If not rs.eof Then
			If stype=1 Then
				inceptid=Rs(0)
			Else
				inceptid=Rs(1)
			End If
		Else
			If stype=1 Then
				inceptid=0
			Else
				inceptid="null"
			End If
		End If
		Set Rs=nothing
	End Function

	Public Sub LoginForm()
	%>
<form action=login.asp?action=chk method=post> 
  <table cellpadding="3" cellspacing="1" class="tableborder1" align="center" style="width:100%;"> 
  <tr>
    <th align=center height=25 colspan="2">用户登录</th>
  </tr>
    <tr> 
      <td height="25" width="100%" align=left class=TableBody1>用户名：</td>
      <td width="100%" align=left class=TableBody1 style="font-weight:normal"><input name=username class=logininput id="username" size=13 maxlength=20></td>
    </tr>
    <tr>
      <td height="25" align=left class=TableBody1 style="font-weight:normal">密　码：</td>
       <td align=left class=TableBody1 style="font-weight:normal"><input name=password type=password class=logininput id="password" size=12 maxlength=20></td>
    </tr>
    <tr>
      <td height="25" align=left class=TableBody1 style="font-weight:normal">Cookies: </td>
       <td align=left class=TableBody1 style="font-weight:normal"><select name=CookieDate class=SELECT >
         <option value=0 selected>不保存</option>
         <option value=1>保存一天</option>
         <option value=2>保存一月</option>
         <option value=3>保存一年</option>
       </select></td>
    </tr>
    <tr align="center">
      <td height="25" colspan="2" class=TableBody1 style="font-weight:normal"> <input type="submit" name="Submit" value="登录">
      <input type="button" name="Submit" value="注册" onClick="location.href='reg.asp';"><input type=hidden name=comeurl value="plus_HappyLover.asp"></td>
    </tr>
    </table> 
</form> 
	
	<%	
	End Sub
		
	Public Sub CheckEdition()
		'检查论坛当前所使用的插件是否为最新版本
		response.write("<script src="&jyPlusCheckUrl&"?PlusId="&PlusId&"&PlusEdition="&PlusEdition&"></script>")
	end sub	
	Public Sub Copyright()
	%>
	<!-- 
	插件名称：<%= PlusName %>
	插件版本：<%= PlusEdition %>
	修改时间：<%= PlusLastUpdateTime %>
	本插件由精益工作室 <%= jyAuthor %> 提供（<%= jySiteUrl %>），本插件版权属精益工作室所有。
	以上注释对Asp文件执行速度没有任何影响，使用时请保留
	本工作室提供主机租用、网站建设、动网插件定制服务，联系QQ：27375
	由于作者时间精力有限，不提供无偿咨询服务。确实需要插件安装帮助服务者，请按30元/小时付费
	-->
	<%
	end sub
End Class
%>