<!-- #include file="include/config_forum.asp" -->
<!-- #include file="include/conn.asp" -->
<!--#include file="z_zvm_conn.asp"-->
<%
response.buffer=true
    dim Gzdays,Gzlbt,Gzhmon,Gzwealth,Gzuserep,Gzusercp,Gzpower,Gzifmess,Gzjbgz,pagenum,sucmsg,errmsg
    dim gzifarticle,gzsuperfj,glygz,gzparticle,gzplogins,gzplogs,gziflogs,gziflogins,ifautocancel,autocday
    Gzdays=7		'工资日间隔，每7天发放一次
    gzifmess="1"	'发薪是否短信通知版主,0否1是
    pagenum=8		'每页工资条列出多少行

    Gzjbgz=50		'版主的每版实质工资
    gzsuperfj=100	'超级版主附加工资(无作用)
    glygz=200          '管理员附加工资
    ifautocancel="1"	'是否自动取消失职版主职务，1自动，0手动
    autocday=30		'超过多少天未登陆取消版主职务

    gzifarticle="1"	'积分计算公式是否计算发贴量，1计算，0不计算
    gzparticle=0.05	'发贴量计算系数，如100发贴，计入工作积分50
    gziflogins="1"	'积分计算公式是否计算登陆次数，1计算，0不计算
    gzplogins=0.005      '登陆次数计算系数，如登陆100*0.5，实际计入50
    gziflogs="1"        '积分计算公式是否计算维护量，1计算，0不计算
    gzplogs=1		'维护量计算系数，默认为1

    Gzlbt=20		'得到业绩工资所需工作积分底线
    gzhmon=20		'积分每增加多少涨一级业绩工资
    gzwealth=100	'一级业绩工资加多少钱
    gzuserep=50		'一级业绩工资加多少积分
    gzusercp=50		'一级业绩工资加多少魅力
    gzpower=1		'一级业绩工资加多少威望(无作用)

	dim LeaveTimeout,rUrl
	LeaveTimeout=7	'允许超过请假时限的最大天数
	rUrl="z_zvm_index.asp"	'调用成功和失败后可返回的位址

'------------按照你的实际需求修改以上参数-----
tit="版主评定"
call web_head(0,0,2,0,0)
page_power="1.2" 
	select case Request.QueryString("action")
		case "hy" 
			call hy()
		case "leave" 
			call Leave()
		case "saveleave"
			call saveleave()
		case "cancelleave"
			call CancelLeave()
		case "checkleavelog"
			call CheckLeaveLog()
		case "dellog"
			call DelLog()
		case else
			call start()
	end select
call web_end(0) 
'=========================================================
sub start()
	if request("action")="reset" and format_power(login_mode,0)="admin" and login_username<>"" then
		connplus.execute("delete * from [fuser]")
        Response.Redirect "z_zvm_index.asp"
	end if
	dim Absentday,pagecount,p,rs1,countnum,flowers,tubiao
	dim RsB,RsU,RsL,RsF,Rstmp,Bcount,Bgzday,Btgz,savemoney,saveep,savecp,savepower
	dim UserName,BoardName,article,Message,Bnumgz,Bnumlog,saveMessage,masterlist,Barticle
	
	dim IsLeave,RsLeave,LeaveTime,LeaveDays,RestDays,IsSendMail,IsDelete		'added by bigqiang

       If Request.QueryString("Pagecount") = "" or Request.QueryString("Pagecount") = 0 then
		 Pagecount = 1
       Else
         Pagecount = CINT(Request.QueryString("Pagecount"))
       End If
    p=0
   	set RsB=conn.execute("select forum_name,forum_power,forum_id from [bbs_forum]")
  	sql="select id,UserName,power,last_tim,bbs_counter,login_num from [user_data] where power='admin' OR power='super' OR power='guan' order by bbs_counter desc"
    set RsU=server.createobject("adodb.recordset")
       RsU.open sql,conn,1,1
       Rsu.PageSize = Pagenum
       If Pagecount>RsU.Pagecount Then
          Pagecount=RsU.Pagecount
       end if
%>
<table cellpadding=2 cellspacing=0 border="0" style="border-collapse: collapse" width="97%" height="1"><tr><td>&nbsp;</td></tr></table>
<table cellpadding=2 cellspacing=0 border="1" bordercolor="#808080" style="border-collapse: collapse" width="97%" height="5">
	<tr>
		<th valign=middle colspan=8 align=center height=25 width='100%'>
<SCRIPT LANGUAGE='JavaScript' SRC='style/fader.js' TYPE='text/javascript'></script>
<SCRIPT LANGUAGE='JavaScript' TYPE='text/javascript'>
prefix="";
arNews = ["斑 竹 工 作 业 绩 公 示","","感谢各位版主对 <font color=red><%=web_var(web_config,1)%></font> 的大力支持，本站每 <fotn color=red><%=gzdays%></font> 天对各位版主进行积分奖励","","工作积分的计算公式为：(版主<%=gzdays%>天内<%
if gziflogins="1" then 
    response.write "登陆次数*"&cstr(gzplogins)
    if gzifarticle="1" or gziflogs="1" then response.write "+"
end if
if gzifarticle="1" then 
    response.write "本期发贴量*"&cstr(gzparticle)
    if gziflogs="1" then response.write "+"
end if
if gziflogs="1" then response.write "版面维护次数*"&cstr(gzplogs)%>)。","","实际给付工资为实质工资加上业绩工资","","版主的实质工资为<font color=red>每版<%=Gzjbgz%></font>元，超级版主另有<font color=red><%=gzsuperfj%></font>元附加奖励","","管理员除实质工资外，另有<font color=red><%=glygz%></font>元附加奖励","","工作积分超过 <font color=red><%=Gzlbt%></font> 点后给付业绩工资","","业绩工资计算方法：版主的工作积分每提升 <font color=red><%=gzhmon%> </font>点，奖励金钱<font color=red><%=gzwealth%></font>，积分<font color=red><%=gzuserep%></font>，魅力<font color=red><%=gzusercp%></font>","","看看您的工资条吧！","","请各位斑竹注意，超过<%=autocday%>天未登陆的斑竹将被取消斑竹资格","","感谢大家的支持！",""]
</SCRIPT>
<div id="elFader" style="position:relative;visibility:hidden; height:16" ></div>
</td>
	</tr>
	<tr height=20 width='100%'>
		<td  align="center" colspan=2 width='10%'>斑竹</td>
    	        <td  align="center">担任版块</td>
		<td  align="center" width='8%'>发贴数</td>
		<td  align="center" width='20%'>发薪/登陆日</td>
		<td  align="center" width='8%'>登陆</td>
		<td  align="center" width='10%'>维护量</td>
		<td  align="center" width='30%'>预期工资/评语</td>
	</tr>
<%rsu.AbsolutePage=pagecount
	do while not RsU.eof
		if Pagecount = 1 then
		countnum = countnum + 1
		select case countnum
			case 1		
				flowers="<img src=images/down/star5.gif align=absmiddle>"
			case 2
				flowers="<img src=images/down/star4.gif>"
			case 3 
				flowers="<img src=images/down/star3.gif>"
			case 4 
				flowers="<img src=images/down/star2.gif>"
			case 5
				flowers="<img src=images/down/star1.gif>"
			case else
				flowers=""
		end select
		else 
			flowers=""
		end if
if RsU("power")="" then 
                                bubiao="无"
elseif RsU("power")="admin" then
				tubiao="<img src=images/"&web_var(web_config,5)&"/icon_admin.gif alt=管理员 height=18 border=0>"
elseif RsU("power")="super" then
				tubiao="<img src=images/"&web_var(web_config,5)&"/icon_super.gif alt=总版主 height=18 border=0>"
elseif RsU("power")="guan" then
				tubiao="<img src=images/"&web_var(web_config,5)&"/icon_guan.gif alt=版主 height=18 border=0>"
end if

		AbsentDay=DateDiff("d",RsU("last_tim"),Now)	'缺席的天数
		article=RsU("bbs_counter")
		UserName=RsU("UserName")
		IsDelete=False
		set RsLeave=Connplus.execute("select IsLeave,LeaveTime,LeaveDays,IsSendMail,Leave from [fuser] where username='"&UserName&"'")
		if RsLeave.eof then 
			Connplus.execute("insert into [fuser] (username,FuLiDate) values ('"&UserName&"',date()-1)")
			set RsLeave=Connplus.execute("select IsLeave,LeaveTime,LeaveDays,IsSendMail,Leave from [fuser] where username='"&UserName&"'")
		end if
			dim Leave
			IsLeave=RsLeave(0)
			LeaveTime=RsLeave(1)
			LeaveDays=RsLeave(2)
			IsSendMail=RsLeave(3)
			Leave=RsLeave(4)
		set RsLeave=nothing		
		dim Email_Subject,Email_Body
		Email_Subject="'"&web_var(web_config,1)&"'通知：请尽快登录网站"
		if not Isleave then
			if AbsentDay>=Autocday-3 and not IsSendMail then	'提前三天通知即将删除的版主登录
				Email_Body="您已经有"&AbsentDay&"天没有登录网站了。请您尽快登录"&web_var(web_config,1)&"论坛，履行您的版主职责。如果三天内你仍不能登录，系统将鉴于您的工作繁忙的情况，于"&(date()+3)&"，解除您的版主职务。"
'				call SMail(UserName,Email_Subject,Email_Body)
				Connplus.Execute("update [fuser] set IsSendMail=true where username='"&UserName&"'")
			end if
			if AbsentDay =< 2  then
				if IsSendMail then Connplus.Execute("update [fuser] set IsSendMail=true where username='"&UserName&"'")
				Message="<font color=#0080d5><b>此版主比较勤快，值得嘉奖！</b></font>"
			elseif AbsentDay =< 7  then
				Message="<font color=#99cc00><b>此版主 <font color=#ff0000>7</font> 天之内有登录</b></font>"
			elseif AbsentDay =< 15 then
				Message="<font color=#ff6780><b>此版主 <font color=#ff0000>15</font> 天内有登录</b></font>"
			elseif AbsentDay =< 30 then
				Message="<font color=#ff6600><b>此版主<font color=#ff0000> "&AbsentDay&" </font>天以上未登录</b></font>"
			else
				Message="<b>此版主已<font color=#ff0000>严重失职</font>，将取消资格！<b>"
			end if
		else
			RestDays=DateDiff("d",Now,DateAdd("d",LeaveDays,LeaveTime))	'假期剩余天数
			if RestDays<=0 and not IsSendMail then
				Email_Body="由于您请假，您已经有"&AbsentDay&"天没有登录网站了,您的请假时间已经结束。请您尽快登录"&web_var(web_config,1)&"论<br>坛，履行您的版主职责。系统从即日起系统对您的版主资格提供"&LeaveTimeout&"天保留期。如果这段时间内你仍不能登录手动取消你的假期，系统会鉴于您工作的繁忙情况，将在"&LeaveTimeout&"天后，即"&(date()+LeaveTimeout)&"，解除您版主职务。"
'				call SMail(UserName,Email_Subject,Email_Body)
				Connplus.Execute("update [fuser] set IsSendMail=true where username='"&UserName&"'")
			end if
			if RestDays<=0-LeaveTimeout then
				Message="<font face=Webdings color=red>i</font><font color=blue>已超过请假假期的<font color=red><b>"&LeaveTimeout&"</b></font>天限制，已删除并EMail通知</font>"
				IsDelete=true
			elseif RestDays<0 then
				Message="<font face=Wingdings color=blue>i</font><font color=blue>超过请假天数，系统延长<font color=red><b>"&LeaveTimeout&"</b></font>天等待期后删除</font>"
			else
				Message="<font face=Wingdings color=blue>v</font><font color=blue><a title="&Leave&">已请假,还有<font color=red><b>"&RestDays&"</b></font>天假期</a></font>"
			end if
		end if
		
		if ifautocancel="1" and AbsentDay>autocday or IsDelete then
	    	dim VIPtitle
			VIPtitle="user"
			conn.execute("update [user_data] set power='"&VIPtitle&"' where username='"&Username&"'")	'取的是注册会员头衔，该会员下次登录时会自动更新正确头衔

'---------------------------------------------------
dim temp,post
do while not RsB.eof
if RsB("forum_power")<>"" then
	masterlist=split(RsB("forum_power"),"|")
	temp=-1
	for i=0 to ubound(masterlist)
		if instr(masterlist(i),UserName) then
			temp=i
			exit for
		end if
	next
	if temp<>-1 then
	if temp<>ubound(masterlist) then
		for i=ubound(masterlist) to 0 step -1
			if i=temp then
				post=post
			elseif i=ubound(masterlist) then
				post=masterlist(i)
			else
				post=masterlist(i)&"|"&post
			end if
		next
	else
		for i=ubound(masterlist)-1 to 0 step -1
			if i=ubound(masterlist)-1 then
				post=masterlist(i)
			else
				post=masterlist(i)&"|"&post
			end if
		next
	end if
	if ubound(masterlist)=0 then
	conn.execute("update [bbs_forum] set forum_power='' where forum_id="&rsb("forumid")&"")
	else
	conn.execute("update [bbs_forum] set forum_power='"&post&"' where forum_id="&rsb("forumid")&"")
	end if
	end if
end if
RsB.movenext
loop
RsB.movefirst
'--------------------------------------------------- 
			dim canclemessage
			canclemessage="系统消息：您被解除版主职务,由于您超过"&autocday&"天未履行版主职责，已经被降为注册会员，请与站长联系！"
			if IsLeave  then 
				canclemessage="系统消息：您被解除版主职务,由于您的假期超过您所申请的时间，而且在系统额外提供的"&LeaveTimeout&"天保留期内没有及时登录，长时间没履行版主职责，你已经被降为注册会员，请与站长联系！"
			end if
conn.Execute("insert into user_mail(accept_u,send_u,topic,word,tim,types,isread) values('"&web_var(web_config,3)&"','"&Username&"','系统消息：您被解除版主职务','"&canclemessage&"',Now(),1,false)")
           	connplus.execute("delete * from [fuser] where username='"&Username&"'")
        end if
		BoardName=""
		Bcount=0
		do while not RsB.eof
forumid=rsb("forum_id")
		  if RsB("forum_power")<>"" then
                masterlist=split(RsB("forum_power"),"|")
                for i=0 to ubound(masterlist)
			   if instr(masterlist(i),UserName) then
			     Bcount=Bcount+1
			        if BoardName="" then
				BoardName="<option value="&left(RsB("forum_name"),8)&">"&left(RsB("forum_name"),8)&"</option><br>"
                            else
				BoardName=boardname&"<option value="&left(RsB("forum_name"),8)&">"&left(RsB("forum_name"),8)&"</option><br>"
			       end if
			   end if
               next
               end if
		  RsB.movenext
   	       loop
  		RsB.movefirst
		if BoardName="" then BoardName="-------"
		set RsF=connplus.execute("select * from [fuser] where username='"&Username&"' ")
              if RsF.eof then
                   set Rstmp=conn.execute("select count(*) from [log] where l_username='"&UserName&"'")
                   connplus.execute("insert into fuser(username,FuLiDate,oldlogs,oldlogins,oldarticle) values('"&UserName&"',date()-1,"&Rstmp(0)&","&RsU("login_num")&","&bbs_counter&")")
              end if
	            set Rsl=conn.execute("select count(*) from [log] where l_username='"&UserName&"'")
	       if RsF.eof then
                  Bnumgz=0
                  Bnumlog=0
                  Barticle=0
                  Bgzday=(date()-1+gzdays)
             else
'                  Bnumgz=cint(Rsf("oldlogs"))
                  Bnumgz=cint(Rsl(0)-Rsf("oldlogs"))
                  Bnumlog=cint(RsU("login_num")-Rsf("oldlogins"))
                  Bgzday=(RsF("Fulidate")+gzdays)
                  Barticle=(RsU("bbs_counter")-Rsf("oldarticle"))
             end if
              '积分计算公式
              if gziflogins<>"1" then gzplogins=0
                        if gzifarticle<>"1" then gzparticle=0
                        if gziflogs<>"1" then gzplogs=0
		Btgz=(Bnumlog*gzplogins+Barticle*gzparticle+Bnumgz*gzplogs)
		if AbsentDay<=gzdays then
		 if Btgz>Gzlbt then
		  savemoney=(((Btgz-Gzlbt)\Gzhmon)*Gzwealth+gzjbgz*Bcount)
'		  savepower=(((Btgz-Gzlbt)\Gzhmon)*Gzpower)
		  saveep=(((Btgz-Gzlbt)\Gzhmon)*Gzuserep)
		  savecp=(((Btgz-Gzlbt)\Gzhmon)*Gzusercp)
		 elseif Btgz>=0 then
		  savemoney=gzjbgz*Bcount
'		  savepower=0
		  saveep=0
		  savecp=0
		 end if
		 if savemoney>0 and RsU("power")="super" or RsU("power")="guan" then savemoney=cint(savemoney+gzsuperfj)
                 if savemoney>0 and RsU("power")="admin" then savemoney=cint(savemoney+glygz)
 		 if savemoney=0 and RsU("power")="super" then savemoney=cint(gzsuperfj)
 		 if savemoney=0 and RsU("power")="guan" then savemoney=cint(gzsuperfj)
		 if savemoney=0 and RsU("power")="admin" then savemoney=cint(glygz)                 
                 else
		  savemoney=0
'		  savepower=0
		  saveep=0
		  savecp=0
		end if
		if IsLeave then savemoney=0		'Added by bigqiang
		if date()>=Bgzday and not RsF.eof and savemoney>0 then
		  savemessage="("&FormatDateTime(Rsf("Fulidate"),2)&"至"&FormatDateTime(Bgzday,2)&")：工作积分("&cint(Btgz)&")，金钱("&savemoney&")，积分("&saveep&")，魅力("&savecp&")"
		  connplus.execute("update [fuser] set Fulidate=date(),oldlogs="&Rsl(0)&",oldlogins="&RsU("login_num")&",lastinfo='"&savemessage&"',oldarticle="&Rsu("bbs_counter")&" where username='"&Username&"'")
'		  connplus.execute("update [fuser] set Fulidate=date(),oldlogins="&RsU("login_num")&",lastinfo='"&savemessage&"',oldarticle="&Rsu("bbs_counter")&" where username='"&Username&"'")
		  conn.execute("update [user_data] set emoney=emoney+"&savemoney&",integral=integral+"&saveep&",usercp=usercp+"&savecp&" where username='"&Username&"'")
		  if gzifmess="1" then
		    savemessage=savemessage&"。　再次对您为本站所做工作表示感谢！继续努力呦:)"
conn.Execute("insert into user_mail(accept_u,send_u,topic,word,tim,types,isread) values('"&web_var(web_config,1)&"','"&Username&"','系统消息：您的工资','"&savemessage&"',Now(),1,false)")
               end if
	      end if
%>
	<tr>
        <td rowspan=2  align=center><%=tubiao%></td>
        <td rowspan=2  align=center><a href=user_view.asp?username=<%=UserName%> target=_blank title="查看<%=UserName%>的讯息"><%if login_username=username then%><font color=blue><%end if%><%=UserName%></a><a href=user_message.asp?action=write&accept_uaername=<%=UserName%> target=_blank title="给<%=UserName%>发短信"><img src=images/mail/msg.gif border=0 alt=给<%=UserName%>发短信></a><%if Rsu("power")="guan" then%><br><font color=#556600>（版主）</font><%end if%><%if Rsu("power")="super" then%><br><font color=#556600>（总版主）</font><%end if%><%if Rsu("power")="admin" then%><br><font color=#5566ff>（管理员）</font><%end if%><br><font color=#0080d5><%=flowers%></font></td>
        <td rowspan=2  align=center>
<select name=groupname>
<%=BoardName%>
</select>
</td>
 	<td rowspan=2  align=center><img src=images/small/mini_write.gif align=absmiddle alt=已发表文章和回复共<%=Article%>篇><font color=red><%=Article%></font>篇</td>
        <td  >发薪日：<%=FormatDateTime(Bgzday,2)%></td>
        <td  >本期：<font color=blue><%=Bnumlog%></font></td>
   		<td >维护量：<font color=blue><%=Bnumgz%></font></td>
        <td  height=21 valign=top><img src=images/small/mini_write.gif align=absmiddle alt=该版主上期工资<%if Rsf.eof then 
        response.write "0"
        else
        response.write Rsf("lastinfo")
        end if%>><font color=blue>积分：<%
         response.write "<b><font color=red>"&cint(Btgz)&"</font></b> <font color=black>|</font> "
         if AbsentDay<=gzdays and (not IsLeave) then  
           response.write "工资：金钱(<b><font color=red>"&savemoney&"</font></b>)"		   
         elseif IsLeave then
           response.write " <b><font color=red>此版主停薪留职</font></b>"
		 else
		   response.write " <b><font color=red>此版主本期停薪</font></b>"
         end if
'         if savepower>0 then response.write "威望(<b><font color=red>"&savepower&"</font></b>)"
         if saveep>0 then response.write "积分(<b><font color=red>"&saveep&"</font></b>)"
         if savecp>0 then response.write "魅力(<b><font color=red>"&savecp&"</font></b>)"
           %></font></td>
     </tr>
     <tr>
            <td  >最后登陆：<%=FormatDateTime(rsU("last_tim"),2)%></td>
            <td   >失踪：<font color=blue><%=AbsentDay%></font></td>
    		<td  >发贴量：<font color=blue><%=Barticle%></font></td>
            <td  ><font color=#0080d5>评定：<%=Message%></font></td>
     </tr>
     <tr height=9><td colspan=8 height=4 align=right>&nbsp;</td></tr>
<%
		'end if
                      p=p+1  
		RsU.movenext
  if p>= rsu.PageSize then exit do
	loop
response.write "<tr><td  colspan=2 align=center>"
response.write "<a href=z_zvm_index.asp?action=hy><font color=blue>[会员情况]</font></a>"
response.write "</td><td  colspan=6>"
response.write ""
response.write "</td></tr>"
response.write "<tr height=20><td colspan=8>"
	set rs1=conn.execute("select username from [user_data] where datediff('d',last_tim,date())>"&autocday&" ")
	if not rs1.EOF then
	 response.write "<marquee scrolldelay=200 scrollamount=4 onmouseout=""if (document.all!=null){this.start()}"" onmouseover=""if (document.all!=null){this.stop()}"">"
     do while not rs1.EOF
	 response.Write "<a href=""user_view.asp?username="&rs1("username")&""">"&rs1("username")&"</a>，"
     rs1.MoveNext
     loop
       response.write "以上版主超过"&autocday&"天未登陆，已经严重失职，将被本考评室终止版主资格！</MARQUEE>"
	set rs1=nothing
 end if
response.write "</td></tr>"
response.write "	<tr><td height=25 valign=middle colspan=5 align=left  style='font-weight:normal' colspan=2> ◇ <font color=red>"&web_var(web_config,1)&"</font> 目前共有版主 <font color=red>"&rsu.RecordCount&"</font> 人，第 <font color=red>"&pagecount&"</font> 页，共 <font color=red>"&rsu.PageCount&"</font> 页</td>"
response.write "<td height=25  valign=middle colspan=3 align=right  style='font-weight:normal' >"
set RsLeave=connplus.execute("select IsLeave from [fuser] where username='"&login_username&"'")
if format_power(login_mode,0)="admin" then
	response.write "<a href=?action=checkleavelog title='仅限于管理员查询'>[请假日志]</a>"
end if
if format_power(login_mode,0)="super" or format_power(login_mode,0)="admin" or format_power(login_mode,0)="guan" then
	response.write "<a href=?action=leave title='非版主勿进'>[版主请假]</a>"
	response.write "<a href=?action=cancelleave title='非版主勿进'>[取消请假]</a>"
end if
set RsLeave=nothing
if format_power(login_mode,0)="admin" then response.write "<a href=z_zvm_index.asp?action=reset title='站长注意：只有在你清空了管理日志log表后，才需要进行此项操作'>[重建工资数据]</a>&nbsp;"
if pagecount>1 then response.write "<a href=z_zvm_index.asp?pagecount=1>[首页]</a>&nbsp; <a href=z_zvm_index.asp?pagecount="&(pagecount-1)&">[上页]</a>&nbsp; "
if pagecount<Rsu.pagecount then response.write "<a href=z_zvm_index.asp?pagecount="&(pagecount+1)&">[下页]</a>&nbsp; <a href=z_zvm_index.asp?pagecount="&RsU.PageCount&">[尾页]</a>"
%>

</td>
	</tr>
	</table>
	<BR>
<%rsU.close
end sub


'===========版主请假=======Added by bigqiang 2003-6-3

sub Leave()
	dim RsA,i
	set RsA=connplus.execute("select IsLeave from [fuser] where username='"&login_username&"'")
	if RsA.Eof then
		errmsg="<font color=red><li>你不是版主，这是版主请假的地方<li>请不要从外部非法提交而非法获得你的资料</font>"
		set RsA=nothing
		call z_err()
		call web_end(0)
		response.end
	elseif RsA(0)=true then
		errmsg="<font color=red><li>对不起你已经请过假了，如果要取消请假请重新进入版主评定<li>请不要从外部提交你的申请<li>请不要重复刷己经提交的页面</font>"
		set RsA=nothing
		call z_err()
		call web_end(0)
		response.end
	end if
%>
<form method="POST" action="?action=saveleave">
<table cellpadding=3 cellspacing=1  align="center">
  <tr height=20>
     <th valign=middle align=center height=25 colspan="3">版&nbsp;主&nbsp;请&nbsp;假</th>
  </tr>
  <tr>
    
	<td  rowspan=2 align="left" width=40%><center><B>注&nbsp;&nbsp;意</B></center>
		<ol><li>版主请假期满后注意要手动取消假期
		<li>版主在假期过后仍未登录的，则将发送mail通知，三日后仍置之不理则删除
		<li>版主请假在15天以上者可在此中请，最高时限为30天。
		<li>版主请假后，第二周不会发放请假当周的工资；版主取消请假后，版主工资会从请假当周开始算
		<li>请假理由不要超过200个字
		</ol>
	</td>
	<td  align="center"><B>请假事由</B></td>
    <td  align="left">
        <textarea rows="8" name="S1" cols="50"></textarea>
    </td>

  </tr>
  <tr>
  <td  align="center"><B>请假天数</B></td>
	<td  align="left">
		<select size="1" name="D1">
          <%
		  for i=15 to 30
			response.write "<option>"&i&"</option>"
		  next
		  %>
         </select>天      
    </td>
  </tr>
  <tr>
    <td  colspan="3" height=10>
      <p align="center"><input type="submit" value="提交" name="B1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
      <input type="button" value="重置" name="B2"></td>
  </tr>
</table>
</form>
<%
	set RsA=nothing 
end sub

'======保存接收请假要求=======Added by bigqiang 2003-6-3
sub saveleave()
	dim leave,leavedays,finderror,sql
	leavedays=request.form("D1")
	leave=request.form("S1")
	finderror=false
	if len(leave)=0 then
		errmsg="<font color=red><li>您要填写请假理由的，请假理由不能为空</font>"
		finderror=true
	end if
	if len(leave)>=200 then
		errmsg="<font color=red><li>请假理由的字数超过了200个字</font>"
		finderror=true
	end if
	if leavedays<15 or leavedays>30 then
		errmsg=errmsg&"<font color=red><li>你请假天数超出了规定的限制！</font>"
		finderror=true
	end if
	if finderror then
		call z_err()
		call web_end(0)
		response.end
	end if
	sql="update [fuser] set IsLeave=true,Leave='"&Leave&"',LeaveTime=Now(),Leavedays='"&Leavedays&"' where username='"&login_username&"'"
	connplus.execute(sql)	'记录保存
	sql="insert into [LeaveLog] (username,LeaveTime,LeaveDays,Leave) values ('"&login_username&"',Now(),'"&Leavedays&"','"&Leave&"')" 
	connplus.execute(sql)	'日志保存
	
	sucmsg="您所提交的 <font color=red>"&leavedays&"</font> 天请假申请己获受理<li>谢谢你对<font color=red>"&web_var(web_config,1)&"</font>始终如一的支持，辛苦了！好好休息一下"
	call z_suc()
end sub


'=======取消请假======added by bigqiang
Sub CancelLeave()
	dim sql,RsLeave
	sql="update [fuser] set IsLeave=False,LeaveDays=0,IsSendMail=False where username='"&login_username&"'" 
	set RsLeave=connplus.execute(sql)
	sql="update [leavelog] set CancelLeave=Now() where username='"&login_username&"' and CancelLeave=#2008-10-1#" 
	set RsLeave=connplus.execute(sql)
	sucmsg="<font color=red><li>您的假期已经顺利取消，欢迎回来！</font>"
	set RsLeave=nothing
	call z_suc()	
End sub


'=======管理员检查请假日志======added by bigqiang
Sub CheckLeaveLog()
	dim sql,RsLeave
	if not (format_power(login_mode,0)="admin") then
		Errmsg="<li><font color=red>仅授予管理员查看权限，请不要非法进入！</font>"
		founderr=true
		exit sub
	end if
	
	set RsLeave=connplus.execute("select * from [LeaveLog]")
%>
<BR>
<table cellSpacing=1 cellPadding=3 width="90%" border=1 bordercolor="#808080" style="border-collapse: collapse">
  <tbody>
    <tr>
      <th vAlign="center" align="middle" colSpan="5" height="25">版主请假日志查询
    </tr>
    <tr height="20">
      <td  align="center" width=80>请假版主</td>
      <td  align="center" width=80>请假时间</td>
      <td  align="center" width=30>天数</td>
      <td  align="center" width=80>取消时间</td>
      <td  align="center" width="*">请假留言</td>
    </tr>
<%  do while not RsLeave.Eof 
		response.write "<tr>"
		response.write "<td  align='middle'>"&RsLeave("username")&"</td>"
		response.write "<td  align='middle'>"&RsLeave("LeaveTime")&"</td>"
		response.write "<td  align='middle'>"&RsLeave("LeaveDays")&"</td>"
		if RsLeave("CancelLeave")=#2008-10-1# then
			response.write "<td align=center><font color=red>仍在假期中</font></td>"
		else
			response.write "<td align=center>"&RsLeave("CancelLeave")&"</td>"
		end if
		response.write "<td >"&RsLeave("Leave")&"</td>"
		RsLeave.MoveNext
    response.write "</tr>"
    response.write "<tr height='9'>"
    response.write "<td  colspan=5 align='right' height='4'>&nbsp;</td></tr>"
	loop
	set RsLeave=nothing
%>
	<tr height="20">
      <td  colSpan="5"></td>
    </tr>
    <tr>
      <td height=25 vAlign=middle colSpan=5 align=middle><a href=<%=rUrl%>><b>[返回版主评定]</a>&nbsp;&nbsp;&nbsp;<a href="?action=dellog" title="仅管理员进入" ><b>[删除假期已取消的记录]</b></a>
    </tr>
  </tbody>
</table>
<BR>
<%
End Sub


'=======删除假期已取消的日志记录=======
Sub DelLog()
	dim sql
	if not (format_power(login_mode,0)="admin") then
		Errmsg="<li><font color=red>仅授予管理员删除日志权限，请不要非法进入！</font>"
		founderr=true
		exit sub
	end if
	connplus.execute("delete * from [LeaveLog] where CancelLeave<>#2008-10-1#")
	sucmsg="<li><font color=red>按你要求，删除日志记录成功！</font>"
	call z_suc()	
End Sub


'=====要用到的函数====Added by bigqiang
sub z_suc()	'调用成功
%>
<table cellspacing=1 cellpadding=3 align=center  style="width:75%">
	<tr><th height=25>操作成功讯息</th></tr>
	<tr><td width="100%" ><b>操作成功：</b><br><br><li>你现下使用<%=web_var(web_config,1)%>的版主请假功能
	<font color=navy><%=sucmsg%></font><br></td></tr>
	<tr><td align=center height=26 ><a href=<%if rUrl="" or isnull(rUrl) then%><%=Request.ServerVariables("HTTP_REFERER")%><%else%><%=rUrl%><%end if%>>返回上一页</a></td></tr>
</table>
<%
end sub

sub z_err() 
%>
<table cellspacing=1 cellpadding=3 align=center  style="width:75%">
	<tr><th height=25>操作错误讯息</th></tr>
	<tr><td width="100%" ><b>产生错误的可能原因：</b><br><br><li>您是否仔细阅读了<a href="boardhelp.asp?forum_id=0">帮助文件</a>，可能您还没有登陆或者不具有使用当前功能的权限
	<font color=red><%=errmsg%></font><br></td></tr>
	<tr><td align=center height=26 ><a href=<%if rUrl="" or isnull(rUrl) then%><%=Request.ServerVariables("HTTP_REFERER")%><%else%><%=rUrl%><%end if%>>返回上一页</a></td></tr>
</table>
<%end sub


'======发送Email通知的函数=====
'Added by bigqiang. Modifed the usersms.asp written by fssunwin

Sub SMail(UserName,subject,body)
	dim smaildate,sendname,sendbody,email,topic
	dim mailbody 
	email=conn.execute("select UserEmail from [user_data] where username='"&Username&"'")
	sendname=Username
	smaildate=date()+time()
	sendbody=trim(body)
	topic=trim(request("subject"))
	mailbody="<table><tr><td><br>收信者"&sendname&",您好:<br><br>"&sendbody&"<br><br><center><br><center>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF="&Forum_info(3)&">"&web_var(web_config,1)&"<br></A><a href="&Forum_info(3)&"><img border='0' src='../logo.gif' width='88' height='31'></a><br><center>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"&smaildate&"</td></tr></table>"
	
	select case Cint(webmail(0))
		case 1
			call jmail(email,topic,mailbody)
		case 2
			call Cdonts(email,topic,mailbody)
		case 3
			call aspemail(email,topic,mailbody)
		case else
			dim SystemMessage,RsA
			set RsA=conn.execute("select username from [user_data]")
			SystemMessage="来自版主评定的系统消息："&web_var(web_config,1)&"不支持电子邮件发送，无法将一些情况有效通知版主。"
                        conn.Execute("insert into user_mail(accept_u,send_u,topic,word,tim,types,isread) values('"&web_var(web_config,3)&"','"&RsA(0)&"','系统消息：关于邮件发送','"&SystemMessage&"',Now(),1,false)")
			set RsA=nothing
	end select
end Sub

sub hy()
dim page,Pcount,totalrec,endpage
If Request("page") = "" or not isInteger(Request("page")) then
	page = 1
Else
	page = CINT(Request("page"))
End If
	dim GlTime,sex
	dim PageCount
	set rs = server.CreateObject ("adodb.recordset")
	sql="select username,tim,Sex,power,last_tim from [user_data] where login_num <= 1 and bbs_counter=0 and datediff('d',last_tim,date())>15 order by last_tim"
	rs.open sql,conn,1,1
	response.write "<BR>"
	response.write "<table cellSpacing=0 cellPadding=3 border=1 bordercolor='#808080' style='border-collapse: collapse'>"
	response.write "<tr>"
	response.write "<th height=25 align=center colspan=6>会员登录情况</td>"
	response.write "</tr>"
	if rs.eof or rs.bof then
		response.write "<tr><td colspan=6  height=30 align=center>所有会员全部比较热心！</td></tr>"
		response.write "<tr>"
		response.write "<td  align=center height=25 colspan=6><a href=z_zvm_index.asp><font class=blue>[版主工作]</font></a></td>"
		response.write "</tr>"
	else
		response.write "<tr>"
		response.write "<td colspan=6 ><br>"
		response.write "　　欢迎光临 <font color=red>"&web_var(web_config,1)&"</font> ！<br><br>"
		response.write "　　这里列出的是只登录过一次，又没发表过任何文章的会员，看到这么多的人上黑名单真让人伤心！<br>"
		response.write "　　所以如果你打算只来一次的话，请不要注册了！<br>"
		response.write "　　这样即节省了数据库的空间，又省了你的时间，不是吗？<br><br>"
		response.write "</td>"
		response.write "</tr>"
		response.write "<tr height=25>"
		response.write "<td align=center>会员姓名</td>"
		response.write "<td align=center>注册日期</td>"
		response.write "<td align=center>消失天数</td>"
		response.write "<td align=center>会员性别</td>"
		response.write "<td align=center>会员门派</td>"
		response.write "<td align=center>发送讯息</td>"
		response.write "</tr>"
		rs.AbsolutePage=Page
		rs.PageSize=10 '每页显示数量
	PageCount=0
      	totalrec=rs.recordcount
		while (not rs.eof) and (not pagecount = rs.PageSize)
			response.write "<tr height=25 align=center>"
			response.write "<td  align=center><a href=user_view.asp?username="&rs(0)&" target=""_blank"" title=""查看"&rs(0)&"的个人资料"">"&rs(0)&"</a></td>"
			response.write "<td  align=center>"&rs(1)&"</td>"
			GlTime= datediff("d",rs(1),date())
			response.write "<td  align=center><b><font color=red>"&GlTime&"</font></b> 天</td>"
			if rs(2)=true then
				sex="男"
			elseif rs(2)=false then
				sex="女" 
			end if
			response.write "<td  align=center>"&sex&"</td>"
			response.write "<td  align=center>暂 无</td>"
			response.write "<td  align=center><a target=""_blank"" href=user_message.asp?action=write&accept_uaername="&rs("username")&"><img src=images/mail/msg.gif alt=给他留言 border=0></a></td>"
			response.write "</tr>" 
		pagecount = pagecount + 1
			rs.movenext

		wend
		response.write "<td height=25 COLSPAN=6><a href=z_zvm_index.asp><font color=blue>[版主工作]</font></a>"
		response.write "&nbsp;&nbsp;共 <b>"&rs.RecordCount&"</b> 人 第 <b>"&page&"</b> / <b>"&rs.PageCount&"</b> 页 分页："
  	if totalrec mod rs.PageSize=0 then
     		Pcount= totalrec \ rs.PageSize
  	else
     		Pcount= totalrec \ rs.PageSize+1
  	end if

	if page > 4 then
	response.write "<a href=""?action=hy&page=1"">[1]</a> ..."
	end if
	if Pcount>page+3 then
	endpage=page+3
	else
	endpage=Pcount
	end if
	for i=page-3 to endpage
	if not i<1 then
		if i = clng(page) then
        response.write " <font color=red>["&i&"]</font>"
		else
		response.write " <a href=""?action=hy&page="&i&""">["&i&"]</a>"
		end if
	end if
	next
	if page+3 < Pcount then 
	response.write "... <a href=""?action=hy&page="&Pcount&""">["&Pcount&"]</a>"
	end if
	response.write "</td>"

	end if
	response.write "</table><br>"
	rs.Close
	set rs = nothing 
end sub
%>