邪恶八进制信息安全团队技术讨论组's Archiver

yezhan 2005-11-26 23:50

[原创]实现虚拟二级域名的方法!

<P>[作者]yezhan <A href="http://www.okhtm.com">[url]http://www.okhtm.com[/url]</A></P>
<P>来源:[邪八]</P>
<P></P>
<P>default.htm<BR></P>
<DIV class=code><script language="java script"><BR><!--<BR>str_host=this.location.href;<BR>if(str_host.indexOf("@")>7)<BR>{<BR>document.write("<frameset><frame src=domain.asp?domain="+str_host+"></frameset>");<BR>}<BR>else<BR>{<BR>location.href="index.asp";<BR>}<BR>//--><BR></script></DIV>
<P><BR>domain.asp<BR></P>
<DIV class=code>domain=request.querystring("domain")<BR>username = mid(domain,8,instr(domain,"@")-8)<BR>if not check_user(username) then<BR>url="reg.asp?Err_Msg_id=1"<BR>else<BR>set rs=server.createobject("adodb.recordset")<BR>sql="select homepage,hits from domain where username='" & username & "'"<BR>rs.open sql,conn,1,3<BR>if rs.bof or rs.eof then<BR>url="reg.asp?Err_Msg_id=1"<BR>else<BR>url=rs("homepage")<BR>end if<BR>rs.close<BR>set rs=nothing<BR>end if<BR>conn.close<BR>set conn=nothing<BR>response.redirect url<BR>response.end<BR><BR>function check_user(str)<BR>check_user=true<BR>checkstr="abcdefghijklmnopqrstuvwxyz0123456789_"<BR>for i=1 to len(str)<BR>if instr(checkstr,mid(str,i,1))<=0 then<BR>check_user=false<BR>exit for<BR>end if<BR>next<BR>end function<BR>%></DIV>
<P><BR>流程:<BR><BR>default.htm进行判断,也可以是index.htm,但是一定要是这两个中一个,因为他们在目录里优先级是比default.asp或者index.asp高的<BR><BR>然后判断完毕后再进行二级前缀的判断,如果数据库中存在的话就直接转向该地址,如果不存在的话就转向default.asp或者index.asp<BR></P>

页: [1]
© 1999-2008 EvilOctal Security Team