<%

	'返回主页
	'-------------------------------------------------------------------
	sub GoHomePage()
		response.redirect "reg.asp"
	end sub


	'检查字符串长度
	sub CheckLenMax( cs, L, errMsg )
		if Len(cs)>L then
			PrintMsg errMsg & "不能大于 " & L & " 个字符。"
		end if
	end sub

	function FormatDateCN( getdate )
		dim y, m, d
		y = year(getdate)
		m = month(getdate)
		d = day(getdate)
		FormatDateCN = "<font face=verdana>" & y & "</font>年" &_
				"<font face=verdana>" & m & "</font>月" &_
				"<font face=verdana>" & d & "</font>日"
	end function


	function FormatDate_( getdate )
		dim y, m, d
		y = year(getdate)
		m = month(getdate)
		d = day(getdate)
		FormatDate_ = y & "/" & m & "/" & d
	end function





	function IsValidEmail(email)
		dim names, name, i, c
		IsValidEmail = true
		names = Split(email, "@")
		if UBound(names) <> 1 then
			IsValidEmail = false
			exit function
		end if
		if len(email) > 100 then
			IsValidEmail = false
			exit function
		end if
		for each name in names
			if Len(name) <= 0 then
				IsValidEmail = false
				exit function
			end if
			for i = 1 to Len(name)
				c = Lcase(Mid(name, i, 1))
				if InStr("abcdefghijklmnopqrstuvwxyz_-.", c) <= 0 and not IsNumeric(c) then
					IsValidEmail = false
					exit function
				end if
			next
			if Left(name, 1) = "." or Right(name, 1) = "." then
				IsValidEmail = false
				exit function
			end if
		next
		if InStr(names(1), ".") <= 0 then
			IsValidEmail = false
			exit function
		end if
		i = Len(names(1)) - InStrRev(names(1), ".")
		if i <> 2 and i <> 3 then
			IsValidEmail = false
			exit function
		end if
		if InStr(email, "..") > 0 then
			IsValidEmail = false
		end if
	end function




	function IfEnglish( str )
		Dim Letters,i,c,L
		Letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890_-"
		L=len(str)
		if L=0 then
			IfEnglish=false
			exit function
		elseif L>30 then
			IfEnglish=false
			exit function
		end if
		for i=1 to L
			c = mid( str,i,1 )
			if inStr( Letters,c )=0 then
				IfEnglish=false
				exit function
			end if
		next
		IfEnglish=true
	end function




	function isInteger(para)
		on error resume next
		dim str
		dim l,i
		if isNUll(para) then 
			isInteger=false
			exit function
		end if
		str=cstr(para)
		if trim(str)="" then
			isInteger=false
			exit function
		end if
		l=len(str)
		for i=1 to l
			if mid(str,i,1)>"9" or mid(str,i,1)<"0" then
				isInteger=false 
				exit function
			end if
		next
		isInteger=true
		if err.number<>0 then err.clear
	end function





	function IfEnglishOrInteger( str )
		Dim Letters,i,c,L
		Letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890"
		L=len(str)
		if L=0 then
			IfEnglishOrInteger=false
			exit function
		end if
		for i=1 to L
			c = mid( str,i,1 )
			if inStr( Letters,c )=0 then
				IfEnglishOrInteger=false
				exit function
			end if
		next
		IfEnglishOrInteger=true
	end function




Function isELetter( str )
	dim re
	Set re = new RegExp		'建立一个新对像
		re.IgnoreCase = true	'搜索是否区分大小写的 true表是不区分 flase表示区分
		re.Global = true		'搜索是否应用于整个字符串

		re.Pattern = "([\w\+\\\/<>\s(^&nbsp;)(^&quot;)(^&#39;)(^&gt;)(^&lt;)]*[\w\+\\\/<>\s(^&nbsp;)(^&quot;)(^&#39;)(^&gt;)(^&lt;)])"
		str = re.Replace( str,"<span class=Gface>$1</span>" )
	Set re = Nothing
	isELetter = str
End Function



Function isEToArial( str )
	Letters = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWZYZ+/\ "
	Dim C,Tstr
	Dim L,i
	Tstr = ""
	if str<>"" then
		L = len(str)
		for i = 1 to L
			C = mid( str,i,1 )
			if inStr( Letters,C )<>0 then C = "<span class=Aface>" & C & "</span>"
			Tstr = Tstr & C
		next
	else
		Tstr = str
	end if
	isEToArial = Tstr
end Function








function DateToStr(dtDateTime)
    DateToStr = year(dtDateTime) & doublenum(Month(dtdateTime)) & doublenum(Day(dtdateTime)) & doublenum(Hour(dtdateTime)) & doublenum(Minute(dtdateTime)) & doublenum(Second(dtdateTime)) & ""
end function


function doublenum(fNum)
    if fNum > 9 then 
        doublenum = fNum 
    else 
        doublenum = "0" & fNum
    end if
end function




function browser(info)
    if Instr(info,"NetCaptor 6.5.0")>0 then
        browser="浏 览 器：NetCaptor 6.5.0"
    elseif Instr(info,"MyIe 3.1")>0 then
        browser="浏 览 器：MyIe 3.1"
    elseif Instr(info,"NetCaptor 6.5.0RC1")>0 then
        browser="浏 览 器：NetCaptor 6.5.0RC1"
    elseif Instr(info,"NetCaptor 6.5.PB1")>0 then
        browser="浏 览 器：NetCaptor 6.5.PB1"
    elseif Instr(info,"MSIE 5.5")>0 then
        browser="浏 览 器：Internet Explorer 5.5"
    elseif Instr(info,"MSIE 6.0")>0 then
        browser="浏 览 器：Internet Explorer 6.0"
    elseif Instr(info,"MSIE 6.0b")>0 then
        browser="浏 览 器：Internet Explorer 6.0b"
    elseif Instr(info,"MSIE 5.01")>0 then
        browser="浏 览 器：Internet Explorer 5.01"
    elseif Instr(info,"MSIE 5.0")>0 then
        browser="浏 览 器：Internet Explorer 5.00"
    elseif Instr(info,"MSIE 4.0")>0 then
        browser="浏 览 器：Internet Explorer 4.01"
    else
        browser="浏 览 器：未知"
    end if
end function


function system(info)
    if Instr(info,"NT 5.1")>0 then
        system=system+"操作系统：Windows XP"
    elseif Instr(info,"Tel")>0 then
        system=system+"操作系统：Telport"
		    elseif Instr(info,"webzip")>0 then
        system=system+"操作系统：webzip"
		    elseif Instr(info,"flashget")>0 then
        system=system+"操作系统：flashget"
		    elseif Instr(info,"offline")>0 then
        system=system+"操作系统：offline"
    elseif Instr(info,"NT 5")>0 then
        system=system+"操作系统：Windows 2000"
    elseif Instr(info,"NT 4")>0 then
        system=system+"操作系统：Windows NT4"
    elseif Instr(info,"98")>0 then
        system=system+"操作系统：Windows 98"
    elseif Instr(info,"95")>0 then
        system=system+"操作系统：Windows 95"
    else
        system=system+"操作系统：未知"
    end if
end function




'用户来源
function address(sip)
	dim Arrsip,str1,str2,str3,str4
	if sip="127.0.0.1" then sip="192.168.0.1"
	Arrsip=split(sip,".")
	if ubound(Arrsip)>=3 then
		str1=Arrsip(0)
		str2=Arrsip(1)
		str3=Arrsip(2)
		str4=Arrsip(3)
	end if
	'str1=left(sip,instr(sip,".")-1)
	'sip=mid(sip,instr(sip,".")+1)
	'str2=left(sip,instr(sip,".")-1)
	'sip=mid(sip,instr(sip,".")+1)
	'str3=left(sip,instr(sip,".")-1)
	'str4=mid(sip,instr(sip,".")+1)
	if isNumeric(str1)=0 or isNumeric(str2)=0 or isNumeric(str3)=0 or isNumeric(str4)=0 then

	else
		set iprs=server.createobject("adodb.recordset")
		num=cint(str1)*256*256*256+cint(str2)*256*256+cint(str3)*256+cint(str4)-1
		ipsql="select Top 1 country,city from address where ip1 <="&num&" and ip2 >="&num&" order by ip2"
		iprs.open ipsql,conn,1,1
			if iprs.eof and iprs.bof then 
				country="亚洲"
				city=""
			else
				country=iprs("country")
				city=iprs("city")
			end if
		iprs.close
		set iprs=nothing
	end if
	address=country&city
end function
%>