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

📄 functions.asp

📁 心里在线咨询系统 怎么还有字数限制
💻 ASP
字号:
<%
'===================================================================系统部分
Function check_session()
	session.Timeout=20
	if session("user_name")="" then
           response.redirect "index.asp"
	end if
End function


Function logout()
	response.buffer=true
	session.abandon 
	Session("BottleAdmin")=""
	session("admin")=""
	session("flog")=""
	session("user_name")=""
	session("user_password")=""
	session("showmodal")=""
	cookiePath=request.servervariables("path_info")
	cookiePath=left(cookiePath,instrRev(cookiePath,"/"))
	response.cookies("chenfeng").Path=cookiePath
	response.cookies("chenfeng").expires=now-1
	response.Redirect "main.asp"
End function


Function selectWord(StrTemp) 
If Instr(StrTemp,"select") or Instr(StrTemp,"insert") or Instr(StrTemp,"delete%20from") or Instr(StrTemp,"count(") or Instr(StrTemp,"drop%20table") or Instr(StrTemp,"update%20") or Instr(StrTemp,"truncate%20") or Instr(StrTemp,"asc(") or Instr(StrTemp,"mid(") or Instr(StrTemp,"char(") or Instr(StrTemp,"xp_cmdshell") or Instr(StrTemp,"exec%20master") or Instr(StrTemp,"net%20localgroup%20administrators") or Instr(StrTemp,"net%20user") or Instr(StrTemp,"%20or%20") or Instr(StrTemp,"’") or Instr(StrTemp,"%20") or Instr(StrTemp,"""") or Instr(StrTemp,"“") or Instr(StrTemp,"”") or Instr(StrTemp,":") or Instr(StrTemp,":") or Instr(StrTemp,";") or Instr(StrTemp,";") or Instr(StrTemp,",") or Instr(StrTemp,",") or Instr(StrTemp,"-") or Instr(StrTemp,"%27") then
	response.Redirect url&"error.asp?msg=请不要使用非法字符!" 	
else
	selectWord=StrTemp
end if
End Function

'====================================================================系统设置部分

Function composition_data(str)
	sqlnum="select count(*) from "&str&" "
	num=conn.execute(sqlnum)(0)
	composition_data=num
End function

Function composition_dataII(str,str2,str3)
	sqlnum="select count(*)  from "&str&" where  '"&str2&"'= '"&str3&"' "
	num=conn.execute(sqlnum)(0)
	composition_dataII=num
	'composition_dataII=1
End function

'====================================================================放松一刻部分

Function del_data(str,str2)
	sqloo="delete from "&str&" where ID="&str2&""
	conn.execute(sqloo)
End function

Function del_data2(str,str2,str3)
	sqloo="delete from "&str&" where ID="&str2&" and types='"&str3&"'"
	conn.execute(sqloo)
End function

'====================================================================BBS部分

 Function msn(string)
   Dim str1
   Dim i,j,k,l
   j = Len(string)
   k = 0
   for i = 1 to j
     str1=Mid(string,i,1)
  if str1 = "@" then
  k = k + 1
  l = i
  end if
   next
   str2 = Mid(string,l+1,1)
   if (k=1) And ((str2>="a") And (str2<="z")) or ((str2>="A") And (str2<="Z")) then
   msn= left(string,l-1)
   end if
 End Function



Function selectlook(str,menu)
	sqlp = "select "&menu&" from user_info where u_id ='"&str&"'" 
		set rsp=server.createobject("adodb.recordset")
		rsp.open sqlp,conn,1,1
			if not rsp.eof then
			selectlook=rsp(""&menu&"")
			end if
		rsp.close
End Function

Function selectbbs(str,menu,bit)

	sqlpp="update postings set "&menu&"='"&bit&"' where id="&str
	conn.execute(sqlpp)

End Function

Function selectnews(str)
	sqlp = "select title from newstype where id ="&str&"" 
		set rsp=server.createobject("adodb.recordset")
		rsp.open sqlp,conn,2,1
			if not rsp.eof then
			selectnews=rsp("title")
			end if
		rsp.close
End Function

Function selectROLE(str,STR2)
	sqlp = "select USER_ROLE_id from user_info where u_id ='"&str&"'" 
		set rsp=server.createobject("adodb.recordset")
		rsp.open sqlp,conn,1,1
			if not rsp.eof then
				IF rsp("USER_ROLE_id")=1 OR rsp("USER_ROLE_id")=2 THEN
				BIT_DATA=TRUE
				ELSE
					IF STR=STR2 THEN 
					BIT_DATA=TRUE
					ELSE
					BIT_DATA=FALSE
					END IF
				END IF
			end if
		rsp.close
	selectROLE=BIT_DATA
End Function

Function selectROLE1(str)
	sqlp = "select USER_ROLE_id from user_info where u_id ='"&str&"'" 
		set rsp=server.createobject("adodb.recordset")
		rsp.open sqlp,conn,1,1
			if not rsp.eof then
				IF  rsp("USER_ROLE_id")=1 THEN
				BIT_DATA=TRUE
				ELSE
					BIT_DATA=FALSE
				END IF
			end if
		rsp.close
	selectROLE1=BIT_DATA
End Function


Function selectROLE2(str)
	sqlp = "select USER_ROLE_id from user_info where u_id ='"&str&"'" 
		set rsp=server.createobject("adodb.recordset")
		rsp.open sqlp,conn,1,1
			if not rsp.eof then
				IF  rsp("USER_ROLE_id")=2 THEN
				BIT_DATA=TRUE
				ELSE
					BIT_DATA=FALSE
				END IF
			end if
		rsp.close
	selectROLE2=BIT_DATA
End Function

Function selectROLE3(str)
	sqlp = "select USER_ROLE_id from user_info where u_id ='"&str&"'" 
		set rsp=server.createobject("adodb.recordset")
		rsp.open sqlp,conn,1,1
			if not rsp.eof then
				IF  rsp("USER_ROLE_id")=3 THEN
				BIT_DATA=TRUE
				ELSE
					BIT_DATA=FALSE
				END IF
			end if
		rsp.close
	selectROLE3=BIT_DATA
End Function

Function selectROLE4(str)
	sqlp = "select USER_ROLE_id from user_info where u_id ='"&str&"'" 
		set rsp=server.createobject("adodb.recordset")
		rsp.open sqlp,conn,1,1
			if not rsp.eof then
				IF rsp("USER_ROLE_id")=1 OR rsp("USER_ROLE_id")=3 OR rsp("USER_ROLE_id")=2 THEN
				BIT_DATA=TRUE
				ELSE
					BIT_DATA=FALSE
				END IF
			end if
		rsp.close
	selectROLE4=BIT_DATA
End Function

Function selectROLE5(str)
	sqlp = "select title from USER_ROLE where id="&str&"" 
		set rsp=server.createobject("adodb.recordset")
		rsp.open sqlp,conn,1,1
	selectROLE5=rsp("title")
		rsp.close
End Function


Function formatierung(strMessage)
  Dim strTemp
	strTemp = Server.HTMLEncode(strMessage)
	strTemp = Replace(strTemp, "       ", "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", 1, -1, 1)
	strTemp = Replace(strTemp, "      ", "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", 1, -1, 1)
	strTemp = Replace(strTemp, "     ", "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", 1, -1, 1)
	strTemp = Replace(strTemp, "    ", "&nbsp;&nbsp;&nbsp;&nbsp;", 1, -1, 1)
	strTemp = Replace(strTemp, "   ", "&nbsp;&nbsp;&nbsp;", 1, -1, 1)
	strTemp = Replace(strTemp, vbCrLf, "<BR>" & vbCrLf, 1, -1, 1)
	formatierung = strTemp
End Function

Function DelFile(path)
    set objfso=server.CreateObject("Scripting.FileSystemObject")
    if objfso.fileExists(Server.MapPath(path)) then
        objfso.Deletefile(Server.MapPath(path))
    end if
    set objfso=nothing
end Function


Function selectfile(strfile,strtable,strid)
	sqlp = "select "&strfile&" from "&strtable&" where id="&strid&"" 
		set rsp=server.createobject("adodb.recordset")
		rsp.open sqlp,conn,1,1
			if not rsp.eof then
			selectfile=rsp(""&strfile&"")
			end if
		rsp.close
End Function

Function selectuserfile(str)
	sqlp = "select myface from user_info where u_id='"&str&"'" 
		set rsp=server.createobject("adodb.recordset")
		rsp.open sqlp,conn,1,1
			if not rsp.eof then
			selectuserfile=rsp("myface")
			end if
		rsp.close
End Function
%>

⌨️ 快捷键说明

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