%@ codepage="936" %>
<%@ Language=VBScript%>
<%
Response.Buffer=true
Response.Expires=0
%>
<%
keyno=Request.QueryString("keyno")
classcode=Request.QueryString("classcode")
pageno=Request.QueryString("pageno")
set cn = Server.CreateObject("ADODB.Connection")
cn.Open(mycnstr)
set rs = Server.CreateObject("ADODB.Recordset")
set rs2 = Server.CreateObject("ADODB.Recordset")
if classcode<>"" then
sql="select * from forum_class where state='1' and classcode='"+classcode+"'"
else
sql="select * from forum_class where state='1' order by sortnum"
end if
rs2.Open sql,cn,1,1
if not rs2.EOF then
manager=trim(rs2("manager"))
classcode=trim(rs2("classcode"))
classname=trim(rs2("classname"))
topcount=rs2("topcount")
totcount=rs2("reccount")
flag=rs2("flag")
else
Response.End
end if
rs2.Close
select case Session("userflag")
case "1"
userqx=mid(flag,2,1)
case "2"
userqx=mid(flag,3,1)
case else
userqx=mid(flag,1,1)
end select
if manager<>"" then
keyword=manager+"/"
manager=""
xx1=1
xx2=instr(xx1,keyword,chr(47))
wheretxt=""
do while xx2>0
ttt=mid(keyword,xx1,xx2-xx1)
if ttt<>"" then
sql="select userno from userinfo where state='1' and usercode='"+ttt+"'"
rs2.Open sql,cn,1,1
if not rs2.EOF then
if cstr(Session("userno"))=cstr(rs2(0)) then
userqx="9"
end if
ttt=""+ttt+""
if manager="" then
manager=ttt
else
manager=manager+","+ttt
end if
end if
rs2.Close
end if
xx1=xx2+1
xx2=instr(xx1,keyword,"/")
loop
else
manager="暂无"
end if
if Session("userqx")="9" or Session("userflag")="9" then
userqx="9"
end if
if userqx="0" then
Response.End
end if
if Request.ServerVariables("REQUEST_METHOD")="POST" and userqx="9" then
rectot=Request.Form("rectot")
cn.BeginTrans
for i=1 to rectot
checksele=Request.Form("checksele"&i)
if checksele<>"" then
seleitem=Request.Form("seleitem"&i)
sqltext="delete from forum where parentno="&seleitem
cn.Execute sqltext
end if
next
sql="select count(keyno) from forum where classcode='"+classcode+"' and grade=1"
rs2.Open sql,cn,1,1
topcount=rs2(0)
rs2.Close
sql="select count(keyno) from forum where classcode='"+classcode+"'"
rs2.Open sql,cn,1,1
reccount=rs2(0)
rs2.Close
sql="update forum_class set topcount="&topcount&",reccount="&reccount&" where classcode='"+classcode+"'"
cn.Execute sql
cn.CommitTrans
end if
myurl="forum_list.asp?classcode="+classcode
mymenu="forum"
sql="select * from forum where classcode='"+classcode+"' and grade=1 order by topflag desc,replyno desc"
rs.Open sql,cn,1,1
pagesize=25
rs.PageSize=pagesize
if pageno="" then pageno=1 else pageno=cint(pageno)
if rs.PageCount>0 then rs.AbsolutePage=pageno
pagecount=rs.PageCount
reccount=rs.RecordCount
%>
<%
mybz=0
set rsb1 = Server.CreateObject("ADODB.Recordset")
set rsb2 = Server.CreateObject("ADODB.Recordset")
if Session("userno")="" then
c_usercode=Request.Cookies("usercode")
c_userpass=Request.Cookies("userpass")
c_loginflag=Request.Cookies("loginflag")
if c_usercode<>"" then
sql="select userno,userpass,flag,state,logintime,logincount,picfile,ipaddress from userinfo where usercode='"+c_usercode+"' and state='1'"
rsb1.Open sql,cn,1,3
if rsb1.EOF then
else
oldpass=Lcase(trim(rsb1(1)))
if oldpass=c_userpass then
mybz=1
rsb1("logintime")=now()
rsb1("logincount")=rsb1("logincount")+1
rsb1("ipaddress")=Request.ServerVariables("Remote_HOST")
rsb1.Update
Session("userno")=rsb1(0)
Session("usercode")=c_usercode
Session("userflag")=c_loginflag
userno=rsb1(0)
cn.Execute "delete from user_login where userno="&userno&" or keyno="&Session.SessionID
if databaseflag="access" then
sql="Insert into user_login values ("&Session.SessionID&","&userno&",'"+c_usercode+"',now(),now(),'"+classcode+"','"+loginflag+"','"+Request.ServerVariables("Remote_HOST")+"')"
else
sql="Insert into user_login values ("&Session.SessionID&","&userno&",'"+c_usercode+"',getdate(),getdate(),'"+classcode+"','"+loginflag+"','"+Request.ServerVariables("Remote_HOST")+"')"
end if
cn.Execute sql
end if
end if
rsb1.Close
end if
end if
if mybz=0 then
sql="select * from user_login where keyno="&Session.SessionID
rsb2.Open sql,cn,1,3
if not rsb2.EOF then
rsb2("updatetime")=now()
rsb2("classcode")=classcode
else
rsb2.Addnew
rsb2("keyno")=Session.SessionID
rsb2("userno")=0
rsb2("logintime")=now()
rsb2("updatetime")=now()
rsb2("loginflag")="0"
rsb2("ipaddress")=Request.ServerVariables("Remote_HOST")
rsb2("classcode")=classcode
end if
rsb2.Update
rsb2.Close
end if
%>
<%
select case Session("userflag")
case "1" '内部用户
if databaseflag="access" then
sql="select * from forum_class where state='1' and mid(flag,2,1)>'0' order by sortnum "
else
sql="select * from forum_class where state='1' and substring(flag,2,1)>'0' order by sortnum "
end if
case "2" '高级用户
if databaseflag="access" then
sql="select * from forum_class where state='1' and mid(flag,3,1)>'0' order by sortnum "
else
sql="select * from forum_class where state='1' and substring(flag,3,1)>'0' order by sortnum "
end if
case else
if databaseflag="access" then
sql="select * from forum_class where state='1' and mid(flag,1,1)>'0' order by sortnum "
else
sql="select * from forum_class where state='1' and substring(flag,1,1)>'0' order by sortnum "
end if
end select
if userqx="9" then '管理员或总坛主
sql="select * from forum_class where state='1' order by sortnum "
end if
%>
<%
sql="select count(keyno) from user_login where loginflag='1'"
rs.Open sql,cn,1,1
reccount2=rs(0)
rs.Close
sql="select * from user_login order by logintime "
rs.Open sql,cn,1,1
colzs=8
if rs.RecordCount mod colzs=0 then
rowzs=int(rs.RecordCount/colzs)
else
rowzs=int(rs.RecordCount/colzs)+1
end if
reccount=rs.RecordCount
%>