<!--#include file=conn.asp-->
<!--#include file=config.asp-->
<!--#include file=const.asp-->
<!--#include file=char.asp-->
<%
 '=========================================================
' File: art_admin.asp
' Version:3.0
' Date: 2005-10-23
' Script Written by xmrxw
'=========================================================
' Copyright (C) 2004,2005 Xmrxw.Com All rights reserved.
' Web: http://www.xmrxw.com,http://www.xmzxw.com
' Email: info@mssky.com,super@mssky.com
' QQ：10689579　Msn：zdlmicr@hotmail.com
'=========================================================
dim id,action,Ctrl
response.buffer=true
Boardid=checkStr(Request("Boardid"))
ID=checkStr(Request("ID"))
Ctrl=checkStr(Request("Ctrl"))
if Boardid="" or not isInteger(Boardid) then
founderr=true
Errmsg=Errmsg+"<br>"+"<li>非法版块参数。"
end if
if ID="" or not isInteger(ID) then
founderr=true
Errmsg=Errmsg+"<br>"+"<li>非法参数。"
end if
action=Checkstr(Trim(Request("action")))
if action="isbest" then
stats="加为精华"
elseif action="istop" then
stats="文章固顶"
elseif action="islock" then
stats="文章屏蔽"
elseif action="ismoney" then
stats="文章评价"
elseif action="isdele" then
stats="永久删除"
elseif action="lockuser" then
stats="用户锁定"
else
stats="操作保存"
end if
call nav()
if not founduser then
	Errmsg=Errmsg+"<br>"+"<li>您还没有登陆，无管理权限。"
	founderr=true
end if

if founderr then
	call head_var("","")
	call Mslove_error()
else
	call head_var("玫瑰首页","Artlist.asp?Boardid="&Boardid&"")
if action<>"" then
call main()
end if
Select Case Ctrl
	Case "isbest_save"
		Stats="加为精华"
		Call isbest_save()
	Case "istop_save"
		Stats="固顶文章"
		Call istop_save()
	Case "islock_save"
		Stats="文章屏蔽"
		Call islock_save()
	Case "ismoney_save"
		Stats="文章评价"
		Call ismoney_save()
	Case "isdele_save"
		Stats="永久删除"
		Call isdele_save()
	Case "lockuser_save"
		Stats="锁定用户"
		Call lockuser_save()
	End Select			
if founderr then call Mslove_error()
end if
call activeonline()
call footer()

sub main()%>
<table width="100%" align=center cellpadding=3 cellspacing=1 class=tableborder1>
  <form action="art_admin.asp?Ctrl=<%=action%>_save" method=POST name="theForm">
    <tr align="left"> 
      <th width="60%" height="28" align="center"  class=tablebody1>文章管理中心－您进行操作是 
        <%=stats%></th>
    </tr>
    <tr align="center"> 
      <td width="100%" height="25" align="left"  class=tablebody1><b> 操作理由</b>： 
        <select name="title" size=1>
<option value="">自定义</option>
<option value="灌水">灌水</option><option value="广告">广告</option><option value="奖励">奖励</option><option value="惩罚">惩罚</option><option value="好文章">好文章</option><option value="内容不符">内容不符</option><option value="重复发文">重复发文</option>
</select>
<input type="text" name="content" size=60>  * </td>
    </tr>
    <tr align="center">
      <td align="left"  class=tablebody2><SCRIPT LANGUAGE="JavaScript">
<!--
var seldisable='';
var doWealth=-50;
var dousercp=-10;
var douserep=-30;
document.write ('<B>用户操作</B>：');
document.write ('&nbsp;&nbsp;金钱 <select name="doWealth" size=1 '+seldisable+'>');
for (i=-50;i<51 ;i++ )
{
	document.write ('<option value="'+i+'" ');
	if (doWealth==i)
	{
		document.write ('selected');
	}
	document.write ('>'+i+'</option>');
}
document.write ('</select>&nbsp;魅力');
document.write (' <select name="douserCP" size=1 '+seldisable+'>');
for (i=-50;i<51 ;i++ )
{
	document.write ('<option value="'+i+'" ');
	if (dousercp==i)
	{
		document.write ('selected');
	}
	document.write ('>'+i+'</option>');
}
document.write ('</select>&nbsp;经验');
document.write (' <select name="douserEP" size=1 '+seldisable+'>');
for (i=-50;i<51 ;i++ )
{
	document.write ('<option value="'+i+'" ');
	if (douserep==i)
	{
		document.write ('selected');
	}
	document.write ('>'+i+'</option>');
}
document.write ('</select>&nbsp;<input type="checkbox" name="upuser" value="1" onclick="nocent();" '+seldisable+'>不对用户进行分值操作');

function nocent()
{
	if(document.theForm.doWealth.disabled==true)
	{
		document.theForm.doWealth.disabled=false;
		document.theForm.douserCP.disabled=false;
		document.theForm.douserEP.disabled=false;
	}
	else
	{
		document.theForm.doWealth.disabled=true;
		document.theForm.douserCP.disabled=true;
		document.theForm.douserEP.disabled=true;
	}

}
//-->
</SCRIPT></td>
    </tr>
	<input type=hIdden value="<%=ID%>" name="ID">
<input type=hIdden value="<%=Boardid%>" name="Boardid">
    <tr align="center">
      <td align="left"  class=tablebody1><B>短信通知</B>：<input type=text size=70 name="msg">&nbsp;<input type="checkbox" name="ismsg" value="1">使用</td>
    </tr>
    <tr align="center">
      <td align="left"  class=tablebody2><B>管理说明</B>：<BR>
        ①请慎重使用所有操作！<BR>
        ②如果选择了短信通知，则将会把原因发送给用户，您也可以在短信中附上简短说明。</td>
    </tr>
    <tr align="center"> 
      <td width="100%"  class=tablebody1 align="center">
<input type="submit" name=submit value="确认操作">
      </td>
    </tr>
  </form>
</table>
<%
end sub

sub sendmsg()''短信发送并对用户分值操作
dim title,content,doWealth,douserCP,douserEP,msg,ismsg,upuser,postname
dim Msgtitle,rsu
	title=checkStr(trim(Request("title")))
	content=checkStr(trim(Request("content")))
	doWealth=checkStr(trim(Request("doWealth")))
	douserCP=checkStr(trim(Request("douserCP")))
	douserEP=checkStr(trim(Request("douserEP")))
	msg=checkStr(trim(Request("msg")))
	ismsg=checkStr(trim(Request("ismsg")))
	upuser=checkStr(trim(Request("upuser")))
	if title="" and content="" then
	ErrMsg=ErrMsg+"<Br>"+"<li>操作理由不为能空。"
   	FoundErr=True
	end if
	if content<>"" and strLength(content)>70 then
	ErrMsg=ErrMsg+"<Br>"+"<li>操作理由长度不大于70个字符。"
   	FoundErr=True
	end if
	if title="" then
	Msgtitle=content
	else
	Msgtitle=title
	end if
	if ismsg=1 then''短信内容
	if msg="" or strLength(msg)>70 then
	ErrMsg=ErrMsg+"<Br>"+"<li>短信内容长度不大于70个字符。"
   	FoundErr=True
	end if
	end if
	if FoundErr=True then exit sub
''读取文章数据库用户名
	set rsu=conn.execute("select U.Username from Ms_Article a inner join [Ms_user] u on a.username=u.username where a.id="&ID)
	if not(rsu.eof and rsu.bof) then
	postname=rsu("username")
	else
	ErrMsg=ErrMsg+"<Br>"+"<li>参数错误。"
   	FoundErr=True
	exit sub
	end if
	rsu.close
	if ismsg=1 then''是否发送短信
	sql="insert into Ms_message (incept,sender,title,content,sendtime,flag,issend) values ('"&postname&"','"&trim(membername)&"','"&Msgtitle&"','"&msg&"',Now(),0,1)"
	conn.execute(sql)
	sucmsg=sucmsg+"<Br>"+"<li>短信发送成功。"
	else
	sucmsg=sucmsg+"<Br>"+"<li>不使用短信发送。"
	end if
	if upuser<>"1" then''是否对用户分值操作
	conn.execute("update Ms_user set UserWealth=UserWealth+"&doWealth&",UserEP=UserEP+"&douserEP&",UserCP=UserCP+"&douserCP&" where Username='"&postname&"'")
	sucmsg=sucmsg+"<Br>"+"<li>成功对用户进行分值操作。"
	else
	sucmsg=sucmsg+"<Br>"+"<li>不使用分值操作。"
	end if
end sub

sub isbest_save()''精华操作
if not (master or supermaster or Standmaster) then
if Cint(GroupSetting(113))=0 then
	ErrMsg=ErrMsg+"<Br>"+"<li>您没有加为精华的权限，请与管理员联系。"
   	FoundErr=True
	exit sub
end if
end if
call sendmsg()
conn.execute("update Ms_Article set Istop=1 where id="&id&"")
sucmsg=sucmsg+"<Br>"+"<li>文章已经加为精华。"
call Mslove_suc()
end sub

sub istop_save()''固顶操作
if not (master or supermaster or Standmaster) then
if Cint(GroupSetting(114))=0 then
	ErrMsg=ErrMsg+"<Br>"+"<li>您没有固顶文章的权限，请与管理员联系。"
   	FoundErr=True
	exit sub
end if
end if
call sendmsg()
dim id
conn.execute("update Ms_Article set Istop=2 where id="&ID&"")
sucmsg=sucmsg+"<Br>"+"<li>文章固顶成功。"
call Mslove_suc()
end sub

sub islock_save()''屏蔽操作
if not (master or supermaster or Standmaster) then
if Cint(GroupSetting(115))=0 then
	ErrMsg=ErrMsg+"<Br>"+"<li>您没有屏蔽文章的权限，请与管理员联系。"
   	FoundErr=True
	exit sub
end if
end if
call sendmsg()
conn.execute("update Ms_Article set locktopic=2 where id="&id&"")
sucmsg=sucmsg+"<Br>"+"<li>文章屏蔽成功。"
call Mslove_suc()
end sub

sub isdele_save()''删除操作
if not (master or supermaster or Standmaster) then
if Cint(GroupSetting(116))=0 then
	ErrMsg=ErrMsg+"<Br>"+"<li>您没有删除文章的权限，请与管理员联系。"
   	FoundErr=True
	exit sub
end if
end if
call sendmsg()
conn.execute("delete from Ms_Article where id="&id&"")
sucmsg=sucmsg+"<Br>"+"<li>文章删除成功。"
call Mslove_suc()
end sub

sub ismoney_save()''分值操作
if not (master or supermaster or Standmaster) then
if Cint(GroupSetting(117))=0 then
	ErrMsg=ErrMsg+"<Br>"+"<li>您没有文章评价的权限，请与管理员联系。"
   	FoundErr=True
	exit sub
end if
end if
call sendmsg()
call Mslove_suc()
end sub

sub lockuser_save()''锁定操作
if not (master or supermaster or Standmaster) then
if Cint(GroupSetting(118))=0 then
	ErrMsg=ErrMsg+"<Br>"+"<li>您没有锁定用户的权限，请与管理员联系。"
   	FoundErr=True
	exit sub
end if
end if
call sendmsg()
dim lockname,rs''读取数据库用户名
set rs=conn.execute("select U.Username from Ms_Article a inner join [Ms_user] u on a.username=u.username where a.id="&ID)
	if not(rs.eof and rs.bof) then
	lockname=rs("username")
	else
	ErrMsg=ErrMsg+"<Br>"+"<li>参数错误。"
   	FoundErr=True
	exit sub
	end if
	rs.close
conn.execute("update Ms_user set LockUser=1 where username='"&lockname&"'")
sucmsg=sucmsg+"<Br>"+"<li>用户锁定成功。"
call Mslove_suc()
end sub
%>