<!--#include file="Inc.asp"-->
<!--#include file="ydzq.asp"-->

<%call head()

call saycardd("工资发放管理")

%>


<%dim TP,act
TP=request("TP")
  if TP="1" then
dim num,book,gettxt
num=request("num")
st=request("st")
act=request("act")
if num="" or Isnumeric(num)=False then
  Call Error("币数无效！")
  end if
if st="" or Isnumeric(st)=False then
  Call Error("选择类型出错！")
st=clng(st)
  end if

if act<>"ok" then
if st=0 then
 Response.Write "确定要发放"&num&getcent&"到所有版主？<br/>"
 else
 Response.Write "确定要发放"&num&getcent&"到所有管理员？<br/>"
 end if
 if saytk>1 then
 call xlanlj("admincent.asp?saytk="&saytk&"&amp;sid="&sid&"&amp;sct=ok&amp;tp=1")
 call xltjlj("num",""&num&"")
 call xltjlj("st",""&st&"")
 call xlanlj1("是的,我决定了")
 else
 Response.write "<anchor>是的,我决定了<go href='admincent.asp?saytk="&saytk&"&amp;sid="&sid&"' method='post' accept-charset='utf-8'>"
Response.write "<postfield name='num' value='"&num&"'/>"
Response.write "<postfield name='st' value='"&st&"'/>"
Response.write "<postfield name='act' value='ok'/>"
Response.write "<postfield name='TP' value='1'/>"
Response.write "</go></anchor><br/>"
end if
if saytk>1 then
response.Write"<a href=""/admin/index.asp?saytk="&saytk&"&amp;sid="&sid&""">我要返回</a>"
else
 Response.Write "<anchor>取消,我要返回<prev/></anchor>"
 end if
 call head1()
Response.end
end if


if st=0 then

  conn.execute("update Users Set myjb = myjb + "&abs(int(num))&" where skey > 0")

else
  conn.execute("update Users Set myjb = myjb + "&abs(int(num))&" where keys = 1")
end if
dim usid
 set rs=Server.CreateObject("ADODB.Recordset")
 if st=0 then
  rs.open"select ID from users where skey>0 order by id desc",conn,1,1
  else
  rs.open"select * from users where keys=1  order by id desc",conn,1,1
  end if
 Do While Not rs.EOF
      usid=rs("id")
      call qfmsg
     rs.MoveNext
  Loop
rs.close
set rs=nothing

sub qfmsg
dim msgx,rsmsg
if st=0 then
msgx = "版主您好，您辛苦了！"
else
msgx = "管理员您好，您辛苦了！"
end if

msgx = msgx & "\您已获得本月工资"&num&getcent&"，感谢您对"&waptitle&"的支持！"
   set rsmsg=server.createobject("adodb.recordset")
   rsmsg.open "select * from Guest",conn,1,2
   rsmsg.addnew
   rsmsg("sid")     = usid
   rsmsg("fid")    = 0
   rsmsg("fnr")     = msgx
   rsmsg.update
   rsmsg.close
 set rsmsg=Nothing
 end sub
'==========系统消息==============


if st=0 then
 Response.Write "发放"&num&getcent&"到所有版主成功！<br/>"
 else
 Response.Write "发放"&num&getcent&"到所有管理员成功！<br/>"
 end if


else
call xlanlj("admincent.asp?saytk="&saytk&"&amp;sid="&sid&"")
if saytk>1 then
response.write"发放工资数目:<input name='num' value='0' size='3'/><br/>"
response.write"发放对象:<select name='st' value='0'>"
else
response.write"发放工资数目:<input name='num"&tt&"' value='0' size='3'/><br/>"
response.write"发放对象:<select name='st"&tt&"' value='0'>"
end if
response.write"<option value='0'>发放版主</option>"
response.write"<option value='1'>发放管理员</option>"
response.write"</select><br/>"
if saytk>1 then
call xltjlj("tp","1")
call xlanlj1("确定发放")
else
response.write"<anchor>[确定发放]<go href='admincent.asp?saytk="&saytk&"&amp;sid="&sid&"' method='post' accept-charset='utf-8'>"
response.write"<postfield name='num' value='$(num"&tt&")'/>"
response.write"<postfield name='st' value='$(st"&tt&")'/>"
response.write"<postfield name='TP' value='1'/>"
response.write"</go></anchor><br/>"
end if
response.write"建议每月1号发放工资，版主和管理员会收到内线通知"
end if
%>
<!--#include file="fanhui.asp"-->
<%
call headsay()
%>
