www.gusucode.com > 中网景企业网站源码时尚版 2009.73码程序 > common/checkid.asp

    <!--#include file="../opendb.asp" -->

<%
Response.Buffer = True
Response.CacheControl = "no-cache"
dim chkusername,TempLenth
chkusername=Trim(Request("username"))

chkusername=Replace(replace(chkusername,"'","''"),Chr(39),"")
TempLenth=GotLenth(chkusername)
If TempLenth<2 then 
	Response.write "4"	
	Response.end
End if

rs.Open "select userid from cnk_users where username='"&chkusername&"'",conn,1,1,1
If rs.eof then
	Response.write "1"
	Response.end
Else
	Response.write "2"	
	Response.end
End if
rs.close



Function GotLenth(Str)
	Dim l,t,c, i,LableStr,regEx,Match,Matches
	if IsNull(Str) then
		GotLenth =0
		Exit Function
	end if
	if Str = "" then
		GotLenth=0
		Exit Function
	end If
	Str=Replace(Replace(Replace(Replace(Str,"&nbsp;"," "),"&quot;",Chr(34)),"&gt;",">"),"&lt;","<")
	l=len(str)
	t=0
	for i=1 to l
		c=Abs(Asc(Mid(str,i,1)))
		if c>255 then
			t=t+2
		else
			t=t+1
		end if
	Next
	GotLenth = t
End Function
%>