📄 news.asp
字号:
<!--#include file="head.asp"-->
<!--#include file="UbbCode.asp"-->
<%Function showuserpic(picurl,picwidth,picheight)
Const const_FaceHeight="20|120"
Const const_FaceWidth="20|120"
dim width_xx,height_xx
If picwidth>120 Then
width_xx="width=120"
Elseif picwidth>0 then
width_xx="width="&picwidth
ElseIf picwidth=0 Then
width_xx=""
End If
If picheight>Int(Split(const_Faceheight,"|")(1)) Then
height_xx="height="&Split(const_FaceWidth,"|")(1)
ElseIf picheight>0 Then
height_xx="height="&picheight
ElseIf picheight=0 Then
height_xx=""
End If
IF lcase(Left(picurl,5))="http:" then
Response.Write "<img name='faceimg' border=0 src='" + picurl + "'" & width_xx & " " & height_xx & " onload=""javascript:if(this.width>120) this.width=120"">"
ElseIf picurl<>"" and (not isnull(picurl)) Then
Response.Write("<img name='faceimg' border=0 src='"&picurl + "' " & width_xx & " " & height_xx & " onload=""javascript:if(this.width>120) this.width=120"">")
End If
End Function %>
<%dim pe,ad,sql,user
pe=request.querystring("pe")
ad=request.querystring("ad")
user=session("wzname")
if pe<>"" then
set rs=conn.execute ("select * from news where id="&ad&" and username='"&user&"'")
IF rs.eof and Session("sitejob")<>3 then%>
<script language="vbscript">
msgbox "你没有这个权限",1+48,"五中校友录"
</script>
<%else
set rs=Server.CreateObject("Adodb.Recordset")
sql="select * from user where username='"&Session("wzname")&"'"
rs.open sql,conn,1,3
rs("newscount")=rs("newscount")-1
rs("money")=rs("money")-3
rs.update
rs.close
set rs=nothing
Set rs = Server.CreateObject("ADODB.Recordset")
sql="delete from news where id="&ad&""
rs.open sql,conn,1,3
Response.Redirect "news.asp"
end if
end if%>
<TABLE style="BORDER-RIGHT: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid"
cellSpacing=0 cellPadding=0 width=778 align=center bgColor=#ffffff>
<TBODY>
<TR vAlign=top>
<TD width=200 bgColor=#f4f4f4>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR borderColor=#999999>
<TD vAlign=center align=middle><IMG height=8 alt=""
src="image/stu.htm" width=1 name=""></TD></TR>
<TR>
<TD vAlign=top height=350>
<TABLE id=AutoNumber4
style="BORDER-RIGHT: #cccccc 1px solid; BORDER-TOP: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; BORDER-BOTTOM: #cccccc 1px solid"
cellSpacing=0 cellPadding=0 width="90%" align=center
bgColor=#ffffff>
<TBODY>
<TR>
<TD align=middle width="100%"><IMG height=40
src="image/vnews.gif" width=180></TD>
</TR>
<TR>
<TD height="12" align=middle><IMG height=8 alt="" src=""
width=1 name=""></TD>
</TR>
<TR><form name="form1" method="post" action="news.asp">
<TD align=middle>
<div align="left">标题:
<input name="title" type="text" id="title" size="20" maxlength="15">
<br>
内容:
<textarea name="content" rows="5" id="content"></textarea>
<% If session("wzname")="" Then%><br>
<font color=red>登录才能发布新闻</font>
<%else%>
<input type="submit" name="Submit2" value="提交">
<input type="reset" name="Submit3" value="重写">
<%End If%>
</div>
</TD></form>
</TR>
<TR>
<TD align=middle><IMG height=8 alt="" src="image/stu.htm"
width=1 name=""></TD></TR></TBODY></TABLE>
<TABLE id=AutoNumber4 cellSpacing=0 cellPadding=0 width="90%"
align=center border=0>
<TBODY>
<TR>
<TD align=middle width="100%"><IMG height=8 alt=""
src="image/stu.htm" width=1 name=""></TD></TR></TBODY></TABLE>
<TABLE
style="BORDER-RIGHT: #cccccc 1px solid; BORDER-TOP: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; BORDER-BOTTOM: #cccccc 1px solid"
cellSpacing=0 cellPadding=0 width="90%" align=center
bgColor=#ffffff>
<TBODY>
<TR>
<TD>
<DIV align=center><img src="image/vnews2.gif" width="180" height="40"></DIV></TD></TR>
<TR>
<TD class=6>
<TABLE cellSpacing=6 cellPadding=0 width="100%"
align=center><TBODY>
<TR>
<TD>
<TABLE id=AutoNumber2 style="BORDER-COLLAPSE: collapse"
cellSpacing=0 cellPadding=3 width="100%" border=0>
<TBODY>
<TR>
<TD colSpan=2 height=22 align=left>
<%
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select top 15 name,username,newscount from user order by newscount desc"
rs.open sql,conn,1,1
if rs("newscount")=0 then
%>还没有人提交新闻
<%else
i=0
do While not rs.eof%>
<a href="datum.asp?username=<%=rs("Username")%>" title="俺已经发布<%=rs("newscount")%>条新闻了"><%=rs("name")%></A><BR>
<%i=i+1
Rs.movenext
if i=20 then
exit do
end if
loop
rs.close
set rs= nothing
end if%></TD>
</TR></TBODY></TABLE> </TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<TABLE id=AutoNumber4 cellSpacing=0 cellPadding=0 width="90%"
align=center border=0>
<TBODY>
<TR>
<TD align=middle width="100%"><IMG height=8 alt=""
src="image/stu.htm" width=1 name=""></TD></TR></TBODY></TABLE>
</TD></TR></TBODY></TABLE></TD>
<TD bgColor=#cccccc><IMG height=1 alt="" src="image/stu.htm" width=1
name=""></TD>
<TD>
<TABLE cellSpacing=0 cellPadding=0 width="100%" align=center
bgColor=#ffffff border=0>
<TBODY>
<TR>
<TD height=8 bgColor=#f4f4f4></TD></TR>
<TD>
<TABLE id=AutoNumber3 style="BORDER-COLLAPSE: collapse"
cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD vAlign=top height=52>
<TABLE id=AutoNumber5 style="BORDER-COLLAPSE: collapse"
borderColor=#111111 cellSpacing=0 cellPadding=3 width="100%"
border=0>
<TBODY>
<TR>
<TD class=6 width=462 background=image/type_bg.gif
height=30><IMG height=12 src="image/type01.gif" width=12
align=absMiddle> <a href="index.asp"><font color="#FF6699">网站首页</font></a> - <a href="news.asp"><font color="#FF6699">新闻</font></a></TD>
<TD width=110 background=image/type_bg.gif>
<DIV align=center><IMG
src="image/more.gif"
border=0></DIV></TD></TR>
<TR>
<TD colSpan=2>
<DIV align=center>
<%
dim content,title,id,cur,rowcount,i
content=request.form("content")
title=request.form("title")
if content<>"" and Session("wzname")<>"" then
set rs=Server.CreateObject("Adodb.Recordset")
sql="select * from user where username='"&Session("wzname")&"'"
rs.open sql,conn,1,3
rs("newscount")=rs("newscount")+1
rs("money")=rs("money")+3
rs.update
rs.close
set rs=nothing
set rs=Server.CreateObject("Adodb.Recordset")
rs.open "select * from news where 1=2",conn,1,3
rs.addnew()
rs("title")=title
rs("username")=Session("wzname")
rs("content")=content
rs("date")=now()
rs.update
rs.close
set rs=nothing
response.redirect "news.asp"
else
Set rs = Server.CreateObject("ADODB.Recordset")
id=request.querystring("id")
if id="" then
sql="select user.*,news.* from news,user where user.username=news.username order by date desc"
else
sql="select user.*,news.* from news,user where id="&id&" and user.username=news.username order by date desc"
end if
cur=request.form("cur")
if cur="" then
cur=1
end if
rs.pagesize=10
rs.open sql,conn,1,1
if rs.eof then
response.write "没有信息"
else
rs.absolutepage=cint(cur)
rowcount=0%>
<table width="100%" border="0">
<%do while not rs.eof and rowcount<rs.pagesize%>
<tr bgcolor="#99CCFF">
<td width="26%" rowspan="2" bgcolor="#FBF6E6"><p align="center"><a href="datum.asp?username=<%=rs("Username")%>">姓名:<%=rs("name")%></a><br><a href="datum.asp?username=<%=rs("Username")%>" title="金钱:<%=rs("money")%>元 新闻:<%=rs("newscount")%>条"><%=showuserpic(rs("userface"),rs("width"),rs("height"))%><br>
</a> </td>
<td width="43%" bgcolor="#FBF6E6"> <font color="#CC3300">·发表于:</font><%=rs("date")%></td>
<td width="31%" bgcolor="#FBF6E6"><a href="news.asp?pe=del&ad=<%=rs("id")%>"><font color="#CC6600">删除</font></a> <font color="#CC3300"> <a href="mail.asp?type2=add&uer=<%=rs("Username")%>">发短信</a> </font></td>
</tr>
<tr>
<td height="80" colspan="2" valign="top">标题:<%=rs("title")%><br>
内容:<%Response.Write BadWords_Deal(UBBCode(rs("content"),2))%>
</td>
</tr><%rowcount=rowcount+1
rs.movenext
loop %>
</table>
<table width="100%" border="0">
<tr><form name="form2" method="post" action=""><TD align=left bgcolor="#FBF6E6"><span class="style2"><font color="#CC3300">共<%=rs.recordcount%>条 分<%=rs.pagecount%>页 每页5条 当前页次:</font><%=cur%>/<%=rs.pagecount%> <font color="#CC3300">
转到:</font> <select name="cur" size="1" onchange="javascript:submit()">
<%for i = 1 to rs.pagecount%>
<option value="<%=i%>" <%if i=cint(cur) then%> selected <%end if%>>第<%=i%>页 </option>
<%next%>
</select>
<%
rs.close
set rs=nothing%>
</td>
</form>
</tr>
</table><%end if
end if%>
</DIV>
</TBODY>
</TABLE>
</TD></TR></TBODY></TABLE></TD></TR></TABLE></TD></TR></TBODY></TABLE>
<!--#include file="bottom.asp"--></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -