📄 index.asp
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%dim time1,time2
time1=timer
dim page,indexfilename,imdeximg,db,n,x,bookbg,txt,jd100_top,jd100_foot,m,jd100_fla
indexfilename=right(Request.ServerVariables("PATH_TRANSLATED"),(len(Request.ServerVariables("PATH_TRANSLATED"))-instrRev(Request.ServerVariables("PATH_TRANSLATED"),"\")))
imdeximg="img/" '图片文件夹
db="jd100.mdb" '数据库
set Conn=Server.CreateObject("ADODB.Connection")
Conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath(db)
n=10 '每页显示留言数
x=5 '每页显示的页数
m=10
bookbg="horse01.gif" '背景图片
txt=1000 '留言的最大字数
dim webtitle,webname,webyn,webgl,webyn2,view2
set rs1 = conn.execute("select * from admin")
webtitle=rs1("title")
if rs1("webname")<>"" then webname=rs1("webname")
if rs1("gbyn")<>"" then webyn=rs1("gbyn")
webgl=rs1("gl")
rs1.close
set rs1=nothing
jd100_top=""
jd100_fla=0
page =Request.QueryString("page")
if page="" or page=0 then page=1
action = Request.QueryString("action")
action_e = Request.Form("action_e")
if action_e <>"" then
server_v1=Cstr(Request.ServerVariables("HTTP_REFERER"))
server_v2=Cstr(Request.ServerVariables("SERVER_NAME"))
if mid(server_v1,8,len(server_v2))<>server_v2 then
response.write "<br><br><center><table border=1 cellpadding=20 bordercolor=black bgcolor=#EEEEEE width=450>"
response.write "<tr><td style='font:9pt Verdana'>"
response.write "</td></tr></table></center>"
response.end
end if
end if
%>
<html>
<head>
<title>我的留言本</title>
<meta name="keywords" content="留言">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
.style1 {font-family: "华文彩云"}
.style2 {font-size: 36px}
-->
</style>
</head>
<script language="JavaScript">
function gbcount(message,total,used,remain)
{
var max;
max = total.value;
if (message.value.length > max) {
message.value = message.value.substring(0,max);
used.value = max;
remain.value = 0;
alert("留言不能超过 <%=txt%> 个字!");
}
else {
used.value = message.value.length;
remain.value = max - used.value;
}
}
</script>
<% if len(bookbg)<3 then
bookbg=""
else
bookbg="background="& imdeximg & bookbg
end if %>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" height="51" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td height="49" valign="top" <%=bookbg%>>
<div align="center">
<CENTER>
<%=jd100_top%>
</CENTER>
</div></td>
</tr>
</table>
<table width="100%" height="18" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" >
<tr>
<td height="18" align="center" valign="top" <%=bookbg%>>
<%
'主程序
Select Case action_e
Case ""
Case "Add_New"
Call Add_New_Execute()
Case "reply"
Call Reply_Execute()
Case "admin"
Call Admin_Login_Execute()
Case "Edit"
Call Edit_Execute()
Case "Edit_web"
Call Edit_web()
End Select
Call Main_Menu()
Select Case action
Case "Admin_Login"
Call Admin_Login()
Case "Exit"
Call Exit_Admin()
Call View_Words()
Case ""
Call View_Words()
Case "Add_New"
Call Add_New()
Case "reply"
Call Reply()
Case "View_Words"
Call View_Words()
Case "Delete"
Call Delete()
Call View_Words()
Case "Edit"
Call Edit()
Case "Edit_web"
Call Edit_web()
End Select
%>
</td>
</tr>
</table>
<table width="100%" height="28" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td height="100%" valign="top" bgcolor="#FFFFFF"><table align=center cellpadding=0 cellspacing=0>
<tr>
<td width="760" ></td>
</tr>
<tr>
<td class="footline"></td>
</tr>
<tr align=center height=60 style="line-height:130%">
<td> <span class="unnamed1">
<%=jd100_foot%>
</span><br>
<table width="594" border=0 align=center cellPadding=0 cellSpacing=0>
</table></td>
</tr>
</table>
</td>
</tr>
</table>
<%
'添加一条新留言
%>
<% Sub Add_New() %>
<table width="598" border="0" align="center" cellpadding="4" cellspacing="1" class="unnamed1">
<form name="form" method="post" action="<%=indexfilename%>">
<tr>
<td height="25" colspan="3" align="center"> <div align="center"><font size="3"><strong>留 言</strong></font><font color="#000000">
</font></div>
<img src="<%=imdeximg%>line.gif" width="500" height="1"> </td>
</tr>
<tr>
<td width="80" > <div align="right">姓名:</div></td>
<td width="454"> <input type="text" name="name" class="input1" size="20" maxLength=10>
*10个字内</td>
<td width="36"> </td>
</tr>
<tr>
<td align="right"> 性别: </td>
<td>
<select name="sex" size="1" >
<option value="1">男</option>
<option value="0">女</option>
</select>
</td>
<td rowspan="5"> </td>
</tr>
<tr>
<td align="right"> 电子邮箱: </td>
<td> <input name="email" type="text" class="input1" value="@" size="35" maxLength=50>
* </td>
</tr>
<tr>
<td align="right" valign="top">
</td>
<td colspan="2">
</td>
</tr>
<tr>
<td align="right" valign="top"> 留言内容: </td>
<td colspan="2"> <textarea name="words" cols="50" rows="8" class="input1" ></textarea>
*
</td>
</tr>
<tr align="center">
<td colspan="3"> <input type="hidden" name="action_e" value="Add_New"> <input type="submit" name="Submit" value="提交" class="input1">
<input type="reset" name="Submit2" value="重写" class="input1"> <br>
<img src="<%=imdeximg%>line.gif" width="500" height="1">
</td>
</tr>
</form>
</table>
<br>
<% End Sub %>
<% Sub Main_Menu() %>
<p align="center" class="style1 style2">我的留言本</p>
<table width="700" border="0" align="center">
<tr>
<td width="287"> <a href="<%=indexfilename%>?action=View_Words">留言本首页</a> <a href="<%=indexfilename%>?action=Add_New">我要留言</a></td>
<td width="353"> <div align="right">
<% If Session("Admin")="Login" Then %>
<a href="<%=indexfilename%>?action=Exit">退出管理</a>
<% Else %>
<a href="<%=indexfilename%>?action=Admin_Login">管理留言</a>
<% End If %>
</div></td>
</tr>
</table>
<% End Sub
'''''''''''''''''''''''
'查看留言
Sub View_Words()
dim gbcount,y,j,k
set rs = conn.execute("select COUNT(*) as gbcount From words")
gbcount=rs("gbcount")
rs.close
if gbcount/n = int(gbcount/n) then '计算出分页数
y=int(gbcount/n)
else
y=int(gbcount/n)+1
end if
page2= int(page/x)
if page/x>page2 then page2=page2+1
k=page2*x
if k>y then k=y
'打开留言字段'
if page=1 then
sql="select top "&n&" id,name,sex,head,web,email,title,words,date,reply,ip,come,view,qq From words Order By id Desc"
else
sql="select id,name,sex,head,web,email,title,words,date,reply,ip,come,view,qq From words Order By id Desc"
end if
if Page >100 then
rs.Open sql,Conn,1
else
Set Rs=Conn.Execute(sql)
end if
if Page>1 then RS.Move n*page-n
%>
<table width="700" border="0" cellspacing="1" cellpadding="4" align="center">
<tr>
<td width="667" height="20" align="right" class="unnamed1">有<%=gbcount %>条留言 <%=page %>/<%=y %>页 分页
<a href="?page=1"><<</a>
<% if page2>1 then %>
<a href="<%=indexfilename%>?page=<%=page2*x-x%>"><</a>
<% end if %>
<% For m =page2*x-(x-1) To k %>
[<a href="<%=indexfilename%>?page=<%=m%>"><%=m%></a>]
<%
Next
%>
<% if page2*x < y then %>
<a href="<%=indexfilename%>?page=<%=m%>">></a>
<% end if %>
<a href="?page=<%=y %>">>></a>
</td>
</tr>
<% if len(webtitle)>2 then %>
<tr>
<td height="20" align="right" class="unnamed1">
<marquee onMouseOut=start(); onMouseOver=stop(); scrollamount=3>
<%=webtitle %>
</marquee></td>
</tr>
<% end if %>
</table>
<% if rs.bof and rs.eof then Response.Write "当前没有留言记录" %>
<%
dim lou,words,reply,email,qq,web,come
if Request.QueryString("page")<2 then
lou=gbcount
else
lou=gbcount-((Request.QueryString("page")-1)*n)
end if
i=0
do while not rs.eof and i<n
i=i+1
reply=""
words=""
words=rs("words")
reply=rs("reply")
%>
<TABLE width=700 border=0 align="center"
cellPadding=0 cellSpacing=0 borderColor=#111111 style="BORDER-COLLAPSE: collapse">
<TBODY>
<TR>
<TD width="2%"></TD>
<TD width="96%" background=<%=imdeximg%>Tt_bg.gif></TD>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -