发表时间:2013年07月14日 星期日

<%
domain = getdomain("blog.likai.cc")
function getdomain(byval dom)  '返回空则表示域名不复合域名根要求 
 dim i,ext,exts 
 exts = "com.cn,net.cn,org.cn,hk.cn,gov.cn,com.au,com.hk,com.tw,me.uk,o
rg.uk,ltd.uk,plc.uk,cn.com,net.au,com,net,cn,hk,cc,tw,vg,im,li,hu,at,bz
,cx,xn--55qx5d,asia,gd,pk,se,jobs,be,xn--fiqs8s,so,mu,co,ph,tk,xn--fiQs
8S,cm,ca,me,org,info,name,biz,tv,mobi,sh,ac,io,tw,ws,travel,us,tm,la,in
,eu,it,jp"  '复根在前,单根在后 
 ext = split(exts,",") 
 for i = 0 to ubound(ext) 
  if lcase(ext(i)) = right(lcase(dom),len(ext(i))) then 
   dim dom_ext,dom_pre 
   dom_ext = lcase(ext(i)) 
   dom_pre = split(left(dom,len(dom)-len(dom_ext)-1),".") 
   getdomain = dom_pre(ubound(dom_pre)) & "." & dom_ext 
   exit function 
  end if 
 next 
 getdomain = "域名输入错误" 
end function
%>