<!--#include file=conn.asp-->
<!--#include file=config.asp-->
<!--#include file=const.asp-->
<!--#include file=char.asp-->
<%
 '=========================================================
' File: vippaste.asp
' Version:3.0
' Date: 2005-11-4
' 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
'=========================================================
response.buffer=true
stats="Vip即时贴"
call nav()
if founderr then
	call head_var("","")
	call Mslove_error()
else
	call head_var("Vip即时贴","vippaste.asp")
call tumppages()'翻页处理
strFileName="vippaste.asp?action="
Select Case Trim(Request("action"))
	Case "add"
		Stats="发布即时贴"
		Call add()
	Case "addsave"
		Stats="保存即时贴"
		Call addsave()
	Case "view"
		Stats="查看即时贴"
		Call view()
	Case "清空"
		Stats="清空即时贴"
		Call AllDeldata()
	Case "删除"
		Stats="删除即时贴"
		Call Deldata()
	Case else	
		call main()
end Select
if founderr then call Mslove_error()
end if
call activeonline()
call footer()

sub main()
menu()%>
<table width="100%" align=center cellpadding=3 cellspacing=1 class=tableborder1>
  <form action="vippaste.asp" method=POST name="theForm">
    <tr align="left"> 
      <th height="28" colspan="5" align="center"  class=tablebody1><%=stats%>列表</th>
    </tr>
    <tr align="center"> 
      <td width="8%" height="25"  class=tablebody2>ID</td>
      <td width="55%"  class=tablebody2>主　题</td>
      <td width="13%"  class=tablebody2>发布者</td>
      <td width="17%"  class=tablebody2>时间</td>
      <td width="7%"  class=tablebody2>操作</td>
    </tr>
    <%dim ID
	set rs=server.createobject("adodb.recordset")
  sql="select ID,Title,Addtime,username from Ms_News where Typeid=1 order by addtime desc"
rs.Open sql,conn,1,1
if not (rs.eof and rs.bof) then
call rspages()
do while not rs.eof and page_count<Cint(MaxPerPage)
ID=rs("ID")%>
    <tr align="center"> 
      <td align="center"  class=tablebody1><%=rs(0)%></td>
      <td align="left"  class=tablebody1><a href=?action=view&id=<%=id%> title=查看信息><%=rs("Title")%></a></td>
      <td align="center"  class=tablebody1><a href=dispuser.asp?username=<%=rs("Username")%>><%=rs("Username")%></a></td>
      <td align="center"  class=tablebody1><%=rs("Addtime")%></td>
      <td align="center"  class=tablebody1><input type=checkbox name=id value=<%=ID%>></td>
    </tr>
    <%page_count=page_count+1
  rs.movenext
  loop
  else
  response.Write("<tr align=""center""> <td colspan=""5"" align=""left"" class=tablebody2>当前没有任何即时贴。</td></tr>")
  end if
  
  if totalrec>0 then
%>
    <tr align="center"> 
      <td colspan="5" align="left"  class=tablebody2><%call showpage(strFileName)%></td>
    </tr>
<%end if%>
    <tr align="right"> 
      <td colspan="5"  class=tablebody1> <input type=checkbox name=chkall value=on onclick="CheckAll(this.form)">
        选中所有显示记录 
        <input type=submit name=action onclick="{if(confirm('确定清空所有记录吗?')){this.document.theForm.submit();return true;}return false;}" value="清空" <%if not (master or Supermaster or Standmaster) then response.write "disabled"%>> 
        <input type=submit name=action onclick="{if(confirm('确定删除选定的记录吗?')){this.document.theForm.submit();return true;}return false;}" value="删除" <%if not (master or Supermaster or Standmaster) then response.write "disabled"%>> 
      </td>
    </tr>
  </form>
</table>
<%
end sub

sub add()
menu()
if not vipuser then
	Errmsg=Errmsg+"<br>"+"<li>你的等级不够，不能发布即时贴。"
	founderr=true
	exit sub
end if%>
  <table width="100%" align=center cellpadding=3 cellspacing=1 class=tableborder1>
  <form action="?action=addsave" method=POST name="theForm">
    <tr> 
      <th height="28" colspan="2" align="center"  class=tablebody1><%=stats%></th>
    </tr>
    <tr> 
      <td width="22%" height="12" align="right" class=tablebody1>用户名：</td>
      <td width="78%" class=tablebody1><input disabled value="<%=trim(membername)%>" name="Postname" size="20"> 
          <input type="hidden" value="<%=trim(membername)%>" name="Postname">
		  </td>
    </tr>
    <tr>
      <td width="22%" height="13" align="right" class=tablebody1>标　题：</td>
      <td class=tablebody1><input name="title" type="text" id="title"></td>
    </tr>
    <tr> 
      <td height="25" align="right" class=tablebody1>内　容：</td>
      <td height="25" class=tablebody1><textarea name="Content" cols="60" rows="5" id="IDContent"></textarea> 
        <a style=cursor:hand onclick="if (parseInt(IDContent.rows)-3>0)(IDContent.rows=parseInt(IDContent.rows)-3)"><img src="Skins/Default/minus.gif" unselectable="on" border='0'></a> 
        <a style=cursor:hand onclick="if (parseInt(IDContent.rows)+3>3)(IDContent.rows=parseInt(IDContent.rows)+3)"><img src="Skins/Default/plus.gif" unselectable="on" border='0'></a></td>
    </tr>
    <tr align="center"> 
      <td height="27" colspan="2" class=tablebody1> <input class=2 type=Submit value="保存" name=Submit> 
        &nbsp; <input class=2 type="reset" name="Clear" value="清除"></td>
    </tr>
  </form>
</table>
<%
end sub

sub addsave()''保存留言
if not vipuser  then
	Errmsg=Errmsg+"<br>"+"<li>你的等级不够，不能发布即时贴。"
	founderr=true
end if
dim Title,Content,touser,postname
Title=checkStr(trim(request("Title")))
Content=checkStr(trim(request("Content")))
Postname=checkStr(trim(request("Postname")))
if Title="" then
	errmsg=errmsg+"<br>"+"<li>标题不能为空。"
	founderr=true
end if
if Content="" then
	errmsg=errmsg+"<br>"+"<li>内容不能为空。"
	founderr=true
end if
if Postname="" then
	errmsg=errmsg+"<br>"+"<li>即时贴用户名不能为空。"
	founderr=true
end if
if founderr=true then exit sub
conn.execute("Insert into Ms_News (Title,Content,Username,Addtime,Typeid) VALUES ('"&Title&"','"&Content&"','"&Postname&"','"&now()&"',1)")
	sucmsg=sucmsg+"<br>"+"<li><b>您已经成功发布即时贴信息。"
		call Mslove_suc()
end sub

sub view()''查看即时贴信息
dim id
id=checkStr(trim(request("id")))
if id="" or not isInteger(id) then
	Errmsg=Errmsg+"<br>"+"<li>参数错误。"
	founderr=true
	exit sub
else
id=Clng(id)
end if
menu()
set rs=server.createobject("adodb.recordset")
 sql="select Title,Content,Addtime,Username from Ms_News where id="&id&""
 rs.Open sql,conn,1,1
if not (rs.eof and rs.bof) then%>
<table width="100%" align=center cellpadding=3 cellspacing=1 class=tableborder1>
  <tr align="left"> 
    <th width="100%" height="26" align="center"  class=tablebody1>&gt;&gt; <%=rs(0)%> &lt;&lt;</th>
  </tr>
  <tr align="center"> 
    <td class="tablebody1" style="LEFT: 0px; WIDTH: 100%; WORD-WRAP: break-word" vAlign="top" align="left"> 
      <blockquote><%=rs(1)%></blockquote></td>
  </tr>
  <tr align="center"> 
    <td height="26" align="center" valign="top"  class=tablebody1> <table cellSpacing="0" cellPadding="0" width="100%" border="0">
        <tr> 
          <td height="24" align="left">&nbsp;&nbsp;&nbsp;<b>发布人</b>： <%=rs(3)%></td>
          <td align="right"><b>发布时间</b>： <%=rs(2)%>&nbsp;&nbsp;</td>
        </tr>
      </table></td>
  </tr>
</table>
<%end if
rs.close
end sub

sub menu()''菜单%>
<table width="100%" align=center cellpadding=3 cellspacing=0  class=tableborder1 style="border-right:#999999 1px solid;border-left:#999999 1px solid">
  <tr align="left"> 
    <td width="100%" height="26" align="center"  class=tablebody1><a href=?action=add>发布即时贴</a> | <a href=vippaste.asp>管理即时贴</a></td>
  </tr>
  </table>
<%end sub

sub AllDeldata()''清空
if not (master or standmaster or supermaster) then
Errmsg=Errmsg+"<li>"+"只有管理员可以管理网站即时贴。"
Founderr=true
exit sub
end if
conn.execute("delete from Ms_News")
sucmsg=sucmsg+"<br>"+"<li>您已成功清空所有记录。"
	call Mslove_suc()
end sub

sub Deldata()''删除记录
dim delid,FixID
delid=replace(request("id"),"'","")
delid=replace(delid,";","")
delid=replace(delid,"--","")
delid=replace(delid,")","")
fixid=replace(delid,",","")
fixid=Trim(replace(fixid," ",""))
If Not IsNumeric(fixid) Then
	Errmsg=Errmsg+"<br><li>错误的参数。"
	founderr=true
End If
if delid="" or isnull(delid) then
Errmsg=Errmsg+"<li>"+"错误的参数。"
Founderr=true
end if
if not (master or standmaster or supermaster) then
Errmsg=Errmsg+"<li>"+"只有管理员可以管理网站即时贴。"
Founderr=true
exit sub
end if
if founderr=true then exit sub
conn.execute("delete from Ms_News where id in("&delid&")")
sucmsg=sucmsg+"<br>"+"<li>您已成功删除所选定的记录。"
	call Mslove_suc()
end sub
%>