⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 topic.asp

📁 一个不错的论坛原代码
💻 ASP
📖 第 1 页 / 共 3 页
字号:
<!--#include file="Connections.asp" -->
<!--#include file="top.asp" -->
<!--#include file="checkuser.asp" -->
<!--#include file="ubb.asp" -->

<%  dim l_id,t_id,r_id,viewtopic,errornum
l_id=chktopic(trim(request.querystring("l_id")))
t_id=chktopic(trim(request.querystring("t_id")))
r_id=chktopic(trim(request.querystring("r_id")))
viewtopic=trim(request.querystring("viewtopic"))
if r_id="" then r_id=-1

errornum=0
 if h_viewcpb=1 and isuser=false then response.redirect("login.asp")
if l_id="" or t_id="" then 
errornum=1
errormsg="<li>很抱歉,参数错误,请从论坛首页正确登陆</li>"
 end if

 if errornum=0 then
isbanzhu=false
sql_topic= "select l_id,t_top,t_lock,t_jinhua,t_buysend,t_count,t_title,t_content,t_time,t_face,t_lock,t_ip,t_replynum,t_lastedit,t_username,t_vote,t_id,t_autourl,t_lockubb,t_sign from topic where t_id="&trim(t_id)&""
set rs_topic=conn.Execute (sql_topic) 
if  rs_topic.eof then
errornum=1
errormsg=errormsg&"<li>很抱歉,此帖已经不存在,可能已经被删除,如果有什么问题,请跟管理员联系</li>"
elseif rs_topic("t_lock")=2 and issupermaster=false and ismaster=false then
errornum=1
errormsg=errormsg&"<li>很抱歉,此帖已经移到回收站,只有管理员和总版主才可以查看</li>"
end if
end if

 if errornum=0  then

	sql="select l_password,l_access,l_banzhu from lanmu where l_id="&rs_topic("l_id")&""
	set rs=conn.execute(sql)
	if not rs.eof then	
	l_banzhu=rs("l_banzhu")
	
	if issupermaster=false and ismaster=false then
	
	if not isnull(l_banzhu) and l_banzhu<>"" and isuser and isbordermaster then
    if instr(l_banzhu,cpbusername)>0 then
 isbanzhu=true'获得斑竹的身份
  end if
  end if
	'此段检查是否为加密区
	if isbanzhu=false then
	if rs("l_password")<>""  and session("fy_lpassword")<>rs("l_password") then response.redirect"login.asp?action=password&l_id="&l_id&""
if rs("l_access")=2 and  isbordermaster=false then
errornum=1
errormsg="<Li>很抱歉,您没有权限进入,只有版主和总版主才可以进入!</li>"
elseif rs("l_access")=1 and isuser=false then
errornum=1
errormsg="<Li>很抱歉,您没有权限进入,只有注册用户才可以进入!</Li>"

elseif rs("l_access")=4 and isvipuser=false and isbordermaster=false then
errornum=1
errormsg="<Li>很抱歉,您没有权限进入,只有认证用户才可以进入!</Li>"
end if

end if

end if

else
errornum=1
errormsg="<Li>很抱歉,无此论坛!</Li>"
end if
set rs=nothing


 if errornum=0 then
sqlt_count="update topic set t_count=t_count+1 where t_id="&trim(t_id)&""
 conn.Execute (sqlt_count)
sqllanmu="select l_access,l_title,l_id,l_lockuser from lanmu where l_id="&l_id&""
set rslanmu=conn.execute(sqllanmu) 
end if

end if

if errornum=1 then
call toptitle(l_title,cpbtitle)
call error(errormsg)
call login()
else
checklockubb=0
checklockubbreply=1
checklocksign=0
rcount=-1
 bgcolor1=""&tColor2&""
if rs_topic("t_autourl")=1 then checkurl=1
if rs_topic("t_lockubb")=1 then checklockubb=1
if rs_topic("t_sign")=1 then checklocksign=1
t_buysend=rs_topic("t_buysend")
page=request.querystring("page")
  if page="" then  page=1
 l_lockuser=rslanmu("l_lockuser")
 '更新online表
 sqlonline = "update online set o_lanmu = "&l_id&" ,o_topic="&trim(t_id)&" where o_ip = '" & o_ip & "'"
conn.Execute (sqlonline)
cpbtitle="浏览主题:"&HTMLEncode(rs_topic("t_title"))
 ltitle=rslanmu("l_title")
call toptitle(l_title,cpbtitle)
call head(3,"论坛信息",Request.ServerVariables("HTTP_REFERER"),cpbtitle)

'取出变量

 sql="select t_size,h_lesstopic,t_viewtree from home"
 set rsconn1=conn.execute(sql)
 if not rsconn1.eof then
t_size=rsconn1("t_size")
t_viewtree=rsconn1("t_viewtree")
h_lesstopic=rsconn1("h_lesstopic")'最少发表字节
end if
set rsconn1=nothing
if viewtopic="" and t_viewtree=1 then viewtopic="tree"
 %>
 <script src=js/addubb.js></SCRIPT>
<script language="JavaScript">
var currentpos,timer;
function initialize() {
	timer = setInterval("scrollwindow()", 10);
}
function sc() {
	clearInterval(timer);
}
function scrollwindow() {
	currentpos=document.body.scrollTop;
	window.scroll(0,++currentpos);
	if (currentpos != document.body.scrollTop) sc();
}
document.onmousedown = sc;
document.ondblclick  = initialize;
function judge_size(){
    var height=document.all.avatar.height;
    var width=document.all.avatar.width;
    var b=height/width;
    if (height>width & height>100){
        document.all.avatar.height=100;
        document.all.avatar.width=100/b;
    }
    if (width>=height & width>100){
        document.all.avatar.width=100;
        document.all.avatar.height=100*b;
    }
}

function copyText(obj) {var rng = document.body.createTextRange();rng.moveToElementText(obj);rng.select();rng.execCommand('Copy');}

  function openwindow(url1){
  var focusok;
  var newwin=window.open(url1,"newWin","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,top=0,left=0,width=500,height=400");
  
  	if(focusok){
  		newwin.focus();
  	}
  return false;
  }
  

//-->
</script>

 <%if rs_topic("t_vote")=1 then'判断是否为投票贴      
      sqlv="select top 1 * from vote where v_num="&rs_topic("t_id")&" order by v_num desc"
      set rs=conn.execute(sqlv)
      v_user=rs("v_user") 
      v_count1=rs("v_count")  
      if v_count1=0 then v_count1=1                 
    if IsNull(v_user) then v_user=","    
      v_user=split(v_user,",")
      if not (cpbusername)="" then
		 for i=ubound(v_user) to 0 step -1
		if cpbusername=v_user(i) then noVote="true"
		next
	else
		noVote="true"
end if
if rs("v_type")="1" then
votetype="checkbox"
else
votetype="radio"
end if
  sqlv1="select * from vote where v_num="&rs_topic("t_id")&" and v_id<>"&rs("v_id")&""
      set rs1=conn.execute(sqlv1)
      response.write "<center><table border=1 borderColor="&tdc2&" cellPadding=1 cellSpacing=1 width="&tdc3&" style=""border-collapse: collapse""><form name=vote method=post action=postvote.asp>"
response.write "<tr valign='middle' "&tColor&" height='22'><td align=center colspan=2 "&tColor&" style='Word-Break:Break-all'><font class=tdc1><b>投票主题:"&htmlencode(rs("v_title"))&"</b></font></td></tr>"
v=0
vv=1
do while not (rs1.eof or rs1.Bof)

v_id=rs1("v_id")
    response.write "<tr valign='middle' bgcolor='"&tColor2&"' ><td width='55%' class=tdc tyle='Word-Break:Break-all'>"&vv&".<input type="&votetype&" name=v_id value='"&v_id&"' >"&rs1("v_title")&"</td><td align='left' width='45%' class=tdc><img src=""image/vote/bar"&v&".gif"" width="""&int(replace(FormatPercent(rs1("v_count")/v_count1),"%",""))*2.5&""" height=8><b>"&rs1("v_count")&"票/"&round(((rs1("v_count")/v_count1)*100),2)&"%</b></td></tr>"

rs1.movenext
vv=vv+1
if v=9 then
v=0
else
v=v+1
end if

loop

if noVote="true" then
        response.write "<tr valign='middle' bgcolor='"&tColor1&"' height='22'><td align=center colspan=2 bgcolor='"&tColor1&"' class=tdc><font class=tdc><b>您已经投过票,或你还未登陆</b> <a href='viewvoter.asp?t_id="&request("t_id")&"' onClick='return openwindow(this.href);')>查看投票用户</a> </font></td></tr>"
    else
        response.write "<tr valign='middle' bgcolor='"&tColor1&"'><td align=center colspan=2 bgcolor='"&tColor1&"' class=tdc><input type=submit name=Submit value='投 票' class='bdtj'><input type=hidden name=l_id value="&l_id&"> <a href='viewvoter.asp?t_id="&request("t_id")&"' onClick='return openwindow(this.href);')>查看投票用户</a> <input type=hidden name=t_id value="&t_id&"></td></tr>"
    end if 
rs.close()
response.write"</form></table></center>"
set rs=nothing
set rs1=nothing
end if
%>
  <center>
<table  border=0 cellspacing=0 cellPadding=1 class=tb1>
  <tr class=tdc> 
         <td bgcolor=<%=tColor2%> valign="bottom" align="LEFT"><a href=postnew.asp?l_id=<%=l_id%>><img alt=发表新主题 src="<%=t_reply%>" border="0" align="absbottom"></a><a href=postnew.asp?l_id=<%=l_id%>&action=vote><img alt=发起新投票 src="<%=v_reply%>" border="0" align="absbottom"></a><a href=reply.asp?l_id=<%=l_id%>&t_id=<%=trim(t_id)%>><img alt=发表回复 src="<%=r_reply%>" border="0" align="absbottom"></a></td>  
         <td bgcolor=<%=tColor2%> valign="bottom">◇您是本帖第 <%=rs_topic("t_count")%> 位阅读者,共有回复 <%=rs_topic("t_replynum")%> 篇◇</td>
           <td bgcolor=<%=tColor2%> valign="bottom">    <% if viewtopic="tree" then
    response.write(" <a href=""?l_id="&l_id&"&t_id="&t_id&"&viewtopic=pb"" title=""平板显示贴""><img src=image/flatview.gif border=0></a>")
    else
    response.write(" <a href=""?l_id="&l_id&"&t_id="&t_id&"&viewtopic=tree"" title=""树型显示贴""><img src=image/treeview.gif border=0></a>")
    end if
    %>
    <a href="javascript:this.location.reload()" title="刷新本主题"><img src=image/refresh.gif border=0></a> </td>

         <td bgcolor=<%=tColor2%> valign="bottom" ALIGN=RIGHT><% '写出斑竹 
    response.write("<select name=banzhu class=bdtj3>"&_
    "<option>本版版主</option>")    
    if not isnull(l_banzhu) and l_banzhu<>"" then
		l_banzhu1=split(l_banzhu,",")
		for i=0 to (ubound(l_banzhu1)-1)
		 response.write("<option>"&l_banzhu1(i)&"</option>")
    next
    end if
    response.write("</select>")
    set rs_banzhu=nothing%></td>

  </tr>
</table>
<%
'开始读取用户资料
sql_user= "select sex,fen,locktopic,u_todaytime,time,username,send,home,imgwidth,u_name,imgheight,imghead,address,u_weiwang,u_beauty,u_money,sign,grade,qq,email,face from user where username='"&rs_topic("t_username")&"'"
set rs_user=conn.Execute (sql_user)
if not rs_user.eof then
fyusername=rs_user("username")
fysex=rs_user("sex")
fysign=rs_user("sign")
fyimghead=chkimg(rs_user("imghead"))
fyimgwidth=rs_user("imgwidth")
fyimgheight=rs_user("imgheight")
fyaddress=rs_user("address")
fygrade=rs_user("grade")
fyweiwang=rs_user("u_weiwang")
fyfen=rs_user("fen")
fybeauty=rs_user("u_beauty")
fymoney=rs_user("u_money")
fyhome=rs_user("home")
fyname=rs_user("u_name")
fyqq=rs_user("qq")
fyemail=rs_user("email")
fyface=rs_user("face")
fysend=rs_user("send")
fytime=year(rs_user("time"))&"-"&month(rs_user("time"))&"-"&day(rs_user("time"))
fytodaytime=rs_user("u_todaytime")
fylocktopic=rs_user("locktopic")
end if
set rs_user=nothing
%>
<table  border=1 borderColor=<%=tdc2%> cellPadding=1 cellSpacing=0 width=<%=tdc3%> style="border-collapse: collapse" >
  <tbody>
  <tr > 
    <td valign=center width="21%" height="22" <%=tColor%> class=tdc1 colspan=2> 
    <table width=98% align=center>
    <tr><td  <%=tColor%> class=tdc1 width="68%">主题:&nbsp;&nbsp;<%=htmlencode(rs_topic("t_title"))%></td>
    <td  <%=tColor%> class=tdc1 align=right>
    <object id="WebBrowser" width=0 height=0 classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></object>
    <a href=# onclick="javascript:WebBrowser.ExecWB(4,1)"><img src="image/save.gif" border=0 alt=保存该页为文件></a> 
    
    
    <a href="report.asp?l_id=<%=l_id%>&t_id=<%=t_id%>" title="本贴有问题,报告此贴给斑竹"><img src=image/report.gif border=0></a> 
<a href="sendpage.asp?action=email&l_id=<%=l_id%>&t_id=<%=trim(t_id)%>" title="把本贴打包邮递 "><img src=image/emailpage.gif border=0></a> 
<a href="printpage.asp?l_id=<%=l_id%>&t_id=<%=trim(t_id)%>" target=_blank title="显示可打印的版本 "><img src=image/printpage.gif border=0></a> 
          <a href="fav.asp?action=add&f_title=<%=htmlencode(rs_topic("t_title"))%>" title="将本主题加入论坛收藏夹"><img src=image/fav.gif border=0></a> 
          <span style="CURSOR: hand" onClick="window.external.AddFavorite('<%=l_urlf%>/topic.asp?l_id=<%=l_id%>&t_id=<%=t_id%>', ' <%=cpbtitle%>')"><IMG SRC=image/favadd.gif BORDER=0 alt=把本贴加入IE收藏夹></span>
          <a href="sendpage.asp?l_id=<%=l_id%>&t_id=<%=trim(t_id)%>" title="推荐此主题给朋友"><img src=image/sendpage.gif border=0></a> 
    </td></tr></table>
    </td>
  </tr>
  </tbody>
  
  <tbody><tr> 
    <td valign=top noWrap width="21%" bgcolor=<%=tcolor1%> class=tdc> 
    <%if page=1 and r_id=-1 then%>
     <%if fyusername<>"" then%>
     <table border=0 width=96%   align=center>
    <tr>
    <td width=80% valign=middle style="filter:glow(color=none,strength=2)">&nbsp;<b><font class=tdc1><%=fyusername%></font></b></td>
    <td width=20% valign=middle align=right>
    <%sqlo="select o_username from online where o_username='"&fyusername&"'"
            set rso=conn.execute(sqlo)
            if rso.bof or rso.eof then 
            ouser="离线"
            else
           ouser="在线"
           end if
           set rso=nothing
    if fysex="男" then 
    response.write("<img src=image/boy.gif alt=帅哥哟,"&ouser&">")
    else
    response.write("<img src=image/girl.gif alt=美女哟,"&ouser&">")
    end if
       %>
  </td></tr>  
  <tr>
      <td valign=top bgcolor=<%=tcolor1%>    class=tdc  colspan=2>
   
  
      <% if fyimghead<>"" then%>
      <img src=<%=fyimghead%> width=<%=fyimgwidth%> height=<%=fyimgheight%> vspace=5>
      <%else%>
      <img src=<%=fyface%> vspace=5>
       <%end if
response.write("<BR>")
if int(fygrade)>10 then 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -