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

📄 inc_common.asp

📁 ASP编写的网站
💻 ASP
字号:
<!--#include file="Inc_connect.asp"-->
<!--#include file="Inc_css.asp"-->
<%
'**************************************
'**    Inc_common.asp
'**
'** 文件说明:公用函数
'** 修改日期:2004-11-12
'** 作者:HACKer007
'** Email:panyisi5201314@tom.com
'**************************************

'----------------访问统计--------------
if not Session("inthissite") = "true" then
  conn.execute("update admin set stat=stat+1 where id=1")
  Session("inthissite") = "true"
end if

'-----------------常用数据提取----------
dim name,password,perpage,site,url,adminmail,maxnum,notice,stat,lock,needcheck,badip
  sql="Select top 1 * from admin"
  set rs=server.CreateObject("adodb.recordset")
  rs.open sql,conn,1,1
  name=rs("name")
  password=rs("password")
  perpage=rs("perpage")
  site=rs("site")
  url=rs("url")
  adminmail=rs("adminmail")
  maxnum=rs("maxnum")
  notice=rs("notice")
  stat=rs("stat")
  lock=rs("lock")
  needcheck=rs("needcheck")
  badip=rs("badip")
  rs.close
  set rs=nothing

'---------------限制IP访问-----------
dim ip
if Request.ServerVariables("HTTP_X_ForWARDED_For")="" then
  ip=Request.ServerVariables("REMOTE_ADDR")
else
  ip=Request.ServerVariables("HTTP_X_ForWARDED_For")
end if

if not badip="" then
  dim allbadip,i
    allbadip=Split(badip,CHR(13)&CHR(10))
  For i = LBound(allbadip) To UBound(allbadip)
    if ip=Trim(allbadip(i)) then
      errinfo="<li>您的IP地址无法访问留言本。"
      call error()
      Response.End
    end if
  Next
end if

'---------------HTML代码过滤-----------
function HTMLEncode(fString)
  if not isnull(fString) then
    fString = replace(fString, ">", "&gt;")
    fString = replace(fString, "<", "&lt;")
    fString = Replace(fString, CHR(32), "&nbsp;")
    fString = Replace(fString, CHR(9), "&nbsp;")
    fString = Replace(fString, CHR(34), "&quot;")
    fString = Replace(fString, CHR(39), "&#39;")
    fString = Replace(fString, CHR(10) & CHR(10), "</P><P> ")
    fString = Replace(fString, CHR(10), "<BR> ")
    fString = Replace(fString, CHR(36), "&#36;")
    HTMLEncode = fString
  end if
end function

'----------------SQL过滤---------------
function filter(text)
  if isnull(text) then
    filter=""
    exit function 
  end if
  filter=replace(text,"'","''")
end function

'----------------错误信息--------------
dim errinfo
errinfo=""

sub error()
if not errinfo="" then
%>
<title>错误</title>
<p align=center><img border="0" src="images/error.gif"></p>
<p>
<table cellpadding=6 cellspacing=1 align=center class=table3 width='550'>
  <tr>
    <td width='100%' class=tablebody3><B><FONT COLOR="red">发现错误:</FONT></B></td>
  </tr>
  <tr>
    <td width='100%' class=tablebody1><%=errinfo%></td>
  </tr>
  <tr align=center>
    <td width='100%' class=tablebody3><a href="javascript:history.back(1)"><B>&lt;&lt; 返回</B></a></td>
  </tr>
</table>
</p>
<%
Response.End
end if
end sub

'----------------页面头部信息--------------
sub pageinfo()
%>
<html>
<head>
<meta name="description" content="HACKer007留言本">
<meta name="keywords" content="HACKer007留言本">
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<%if pagename="查看留言" then%>
<title>HACKer007留言本</title>
<%else%>
<title><%=pagename%>__HACKer007留言本</title>
<%end if%>
</head>

<script language="javascript">
function submitonce(theform){
//if IE 4+ or NS 6+
if (document.all||document.getElementById){
//screen thru every element in the form, and hunt down "submit" and "reset"
for (i=0;i<theform.length;i++){
var tempobj=theform.elements[i]
if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset")
//disable em
tempobj.disabled=true
}
}
}
</script>
<%
end sub

'----------------通用界面前半部分--------------
Sub skin1()
%>

<body TOPMARGIN="0" LEFTMARGIN="0">
<!--#include file="Inc_top.asp"-->
<!--#include file="inc_login.asp"-->
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%">
  <tr>
    <td valign="top" width="100" bgcolor="#7F7F7F" style="border-right: 1px solid #969696">
    <!--#include file="Inc_menu.asp"-->
    </td>
    <td valign="top">
    <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%">
      <tr>
        <td width="400" bgcolor="<%=maincolor%>"><IMG SRC="images/<%=mainpic%>" WIDTH="400" HEIGHT="46"></td>
        <td width="100%" bgcolor="<%=maincolor%>">&nbsp;</td>
        <td width="185" bgcolor="<%=maincolor%>"><IMG SRC="images/pagetitle2.gif" WIDTH="185" HEIGHT="46"></td>
      </tr>
      <tr>
        <td width="100%" colspan="3">
<%
end sub

'----------------通用界面后半部分--------------
Sub skin2()
%>
        </td>
      </tr>
    </table>  
    </td>
  </tr>
  <tr>
  <!--#include file="Inc_foot.asp"-->
  </tr>
</table>
</body>
</html>
<%
end sub

dim pagename,maincolor
maincolor="#3E3E3E"    '留言本的主色调
%>

⌨️ 快捷键说明

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