<%
set conn=Server.CreateObject("ADODB.connection")
conn.Open "Provider=SQLOLEDB.1;Data Source=(local);User ID=iChat;Password=xxxxxxxx"

'ODBC连接串 
'conn.Open"DSN=iChat;UID=ichat;PWD=xxxxxxxxxx;Database=iChat;"

'SQL OLEDB连接串
'conn.Open "Provider=SQLOLEDB.1;Data Source=(local);User ID=iChat;Password=xxxxxxxx;Initial Catalog=iChat;Persist Security Info=True"


function chkstr(string,strlen)
	if len(trim(string))>strlen then
		'记录ip,时间，输入内容
		you_ip=request.servervariables("REMOTE_HOST")
		set rslog=Server.CreateObject("ADODB.RecordSet")                             
		rslog.open "Select * from logs",conn,1,3 
		rslog.addnew 
		rslog("ip")=you_ip 
		rslog("inputstr")=string 
		rslog("tag") = request.servervariables("REQUEST_METHOD") & " " & request.servervariables("SCRIPT_NAME") & " "& request.servervariables("QUERY_STRING")
		if request.servervariables("REQUEST_METHOD") = "POST" then
			for i = 1 to Request.Form.Count
				data = data & Request.Form.Key(i) & "=" & Request.Form.Item(i) & "|"
			next   
			rslog("data") = data
		end if
		rslog.update
		response.end
	else
	    String = replace(String, "'", "")
	    String = replace(String, ",", "")
	    String = Replace(String, "|", "")
	    chkstr = String
	end if
end function
%>