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

📄 function.asp

📁 用ASP写的一个论坛的程序 数据库是ACCESS 很简单
💻 ASP
字号:
<%
function hits(sj,zd,n)
		set rs=server.createobject("adodb.recordset")
		if n=0 then
		sql="select * from "&sj&" where id="&cint(id)&""
		end if
		if n=1 then
		sql="select * from "&sj&" where tiebaname='"&tiebaname&"'"
		end if
		rs.open sql,conn,1,3
		if rs.eof=false then
			rs(""& zd &"")=cint(rs(""& zd &""))+1
			rs.update
		end if
		rs.close
		set rs=nothing
end function

function cktiebaname()
    tiebaname=request.QueryString("tiebaname")
	set rs=server.createobject("adodb.recordset")
	sql="select  * from  tiebaname  where tiebaname = '"& tiebaname &"'"
	rs.open sql,conn,1,1
	if rs.eof=false then
		rs.close
		set rs=nothing
	else
	    set rs=server.createobject("adodb.recordset")
		sql="select * from tiebaname where id is null"
		rs.open sql,conn,1,3
		rs.addnew
		rs("tiebaname")=tiebaname
		rs("regtime")=now()
		rs("ip")=request.ServerVariables("REMOTE_ADDR")
		rs.update
		rs.close
		set rs=nothing
	end if
end function

function tf(sj,lm,z)
	set rs=server.createobject("adodb.recordset")
	sql="select  * from  "&sj&"  where "&lm&" = '"& z &"'"
	rs.open sql,conn,1,1
	if rs.eof=false then
		rs.close
		set rs=nothing
	tf=true
	else
	tf=false
	response.Write("<script language=javascript>alert('数据不存在!');")
	response.Write("</script>")
	end if
end function

sub replyn(id,author)
		set rs=server.createobject("adodb.recordset")
		sql="select * from msg where id="&cint(id)&""
		rs.open sql,conn,1,3
		if rs.eof=false then
		rs("replyn")=cint(rs("replyn"))+1
		rs("replyer")=author
		rs("replytime")=now()
		rs.update
		end if
		rs.close
		set rs=nothing
end sub

sub msgadd(sj,n)
	    set rs=server.createobject("adodb.recordset")
		sql="select * from "&sj&" where id is null"
		rs.open sql,conn,1,3
		rs.addnew
		if n=1 then
			rs("tiebaname")=tiebaname
			rs("msgtitle")=msgtitle
			rs("msg")=msg
			rs("msgtime")=now()
			rs("author")=author
			rs("picurl")=picurl
			rs("replyer")=replyer
			rs("replytime")=now()
			rs("ip")=request.ServerVariables("REMOTE_ADDR")
			rs.update
		rs.close
		set rs=nothing
		end if
		if n=0 and tf("msg","msgtitle",msgtitle)=true then
			rs("tiebaname")=tiebaname
			rs("msgtitle")=msgtitle
			rs("msg")=msg
			rs("msgtime")=now()
			rs("author")=author
			rs("picurl")=picurl
			rs("id")=id
			rs("ip")=request.ServerVariables("REMOTE_ADDR")
			rs.update
		rs.close
		set rs=nothing
		end if
		
		

end sub

function strformat(str,n)
strlen=len(str)
strtc=""
 	if strlen < n then
	  for i=0 to n-strlen  step 1
	  strtc=strtc&"&nbsp;"
	  next
	 strformat=str&strtc
	end if
	if strlen > n then
	strformat=mid(str,1,n)
	end if
	if strlen = n then
	strformat=str
	end if
end function

%>

⌨️ 快捷键说明

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