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

📄 conn.asp

📁 简单整站程序
💻 ASP
字号:
<%
dim conn
dim connstr
dim db
db="/xyadmin/dbdata/data.dat"  '数据库文件所在路径
connstr="DBQ="+server.mappath(""&db&"")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
conn.open connstr

'----------------------------------------------------------------------------------------
'函 数 名:RsClose
'函数作用:关闭记录集
'----------------------------------------------------------------------------------------
function RsClose()
   rs.close
   set rs=nothing
end function

'----------------------------------------------------------------------------------------
'函 数 名:Rs1Close
'函数作用:关闭记录集
'----------------------------------------------------------------------------------------
function Rs1Close()
   rs1.close
   set rs1=nothing
end function

'----------------------------------------------------------------------------------------
'函 数 名: ConnClose
'函数作用:关闭数据库连接
'----------------------------------------------------------------------------------------
function ConnClose()
   conn.close
   set conn=nothing
end function

'=====================================================================================
'flash饼图投票系统多用户版1.0
'=====================================================================================
myday=1'设置重复投票的天数
'=======================================================
'目的:SQL注入攻击预防装置[字符型]

function strtext(str)
    strtext=replace(str,chr(34),"&quot;")
end function

function strSql(str)
    strSql=replace(str,"'","''")
end function

function flashSql(str)
    flashSql=replace(str,"chr(124)","|")
end function

'目的:SQL注入攻击预防装置[数字型]
function intSql(Numeric)
    if IsNumeric(Numeric) then
        intSql=Numeric
    else
        intSql=0
    end if
end function

function inthit(Numeric)
	If(Numeric="") Then
		inthit=1
	else
	    if IsNumeric(Numeric) and Numeric>=1 then
		inthit=Numeric
	    else
		inthit=1
	    end if
	End if
end function

Function validpersonal(username,password)
sql="select * from admin where name='"& strSql(username) &"' and pass ='"& strSql(password) &"'"
	set rs=server.createobject("adodb.recordset")
		rs.open sql,conn,3,2	
	If(rs.eof) Then
		validpersonal=false
	else
		validpersonal=true	
	End if
End Function

'判断发言是否来自外部
function ChkPost()
	dim server_v1,server_v2
	chkpost=false
	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
		chkpost=false
	else
		chkpost=true
	end if
end function
'=====================================================================================
%>

⌨️ 快捷键说明

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