zl程序教程

您现在的位置是:首页 >  其他

当前栏目

二级域名原理以及程序

程序原理 以及 二级域名
2023-06-13 09:13:46 时间
二级域名原理以及程序,申请即可开通[普通框架式二级域名]
要达到二级名的效果,必须一下条件以及流程:
1、必须有一个顶级域名,而且此域名必须做好泛解析并做好指向。
2、必须有一台独立的服务器。泛解析的域名指向该服务器。
3、在服务器上的IIS建一个空的主机头名的web站点。
4、将默认的页面设置为你的二机解析程序(比如:freedns.asp)
5、二级域名系列程序(包括申请页:shenqing.htm,添加页add.asp,解析页,)


此程序的优点:
a,可以限制申请域名的敏感字,比如hacker,wwww,sex,china等
b,可以限制申请域名的非法字,比如:!·#¥%……—*()——?‘“/等
c,每个地址只能申请一个域名。
d,限制申请域名的长度,
e,如果用户所访问的域名没人申请则转到特定的页面,本例中的http://www.51bxg.com/miss.html
f,申请了域名:***.yourname.com可以同时支持:http://***.yourname.com以及http://www.***.youranme.com两个域名的访问。


一下为系列程序代码:
shenqing.htm

<formaction=adddns.aspmethod=postname=FrmonSubmit="returncheck_input()"><br><fontcolor=red>加*号为必填内容</font><br>
您想注册的域名:
http://<inputname="nowurl"size=12
style="BORDER-BOTTOM:1pxdouble;BORDER-LEFT:1pxdouble;BORDER-RIGHT:1pxdouble;BORDER-TOP:1pxdouble;COLOR:#000000;FONT-SIZE:9pt">.51bxg.com
    <br>
你实际的网站地址:
<inputname="tourl"size=12
style="BORDER-BOTTOM:1pxdouble;BORDER-LEFT:1pxdouble;BORDER-RIGHT:1pxdouble;BORDER-TOP:1pxdouble;COLOR:#000000;FONT-SIZE:9pt">
你要求显示的title:
<inputname="company"size=12
style="BORDER-BOTTOM:1pxdouble;BORDER-LEFT:1pxdouble;BORDER-RIGHT:1pxdouble;BORDER-TOP:1pxdouble;COLOR:#000000;FONT-SIZE:9pt">


<br>
<inputtype="submit"name="Submit"value="提交信息"style="border:1pxdoublergb(88,88,88);font:9pt">
  
<inputtype="reset"name="Reset"value="重新填写"style="border:1pxdoublergb(88,88,88);font:9pt">
</p>
</form>


添加记录页面add.asp
<!--#includefile="char.inc"-->
<!--#includefile="conn.asp"-->
<%
uID=request.cookies("*****")
%>
<%
dimnowurl,tourl,company,along,pbkey
nowurl=trim(request.form("nowurl"))+".51bxg.com"
nurl=trim(request.form("nowurl"))
tourl=trim(request.form("tourl"))
company=trim(request.form("company"))
along=20
pbkey="www,sex,admin,w,ww,wwww,hacker,hack"


setrs=server.createobject("adodb.recordset")
sql="select*fromdnswhereuserid=""&uid&"""
rs.opensql,conn,1,1
ifnotrs.EOFthen
response.write"很抱歉,你已经申请过二级域名,每个用户只能申请一个二级域名!<br>你申请的二级域名是:http://"+rs("nowurl")
response.end
endif


setrs=server.createobject("adodb.recordset")
sql="select*fromdnswherenowurl=""&nowurl&"""
rs.opensql,conn,1,1
ifnotrs.eofthen
response.write"很抱歉,你申请的域名:http://"+nowurl+"已经被其他公司申请,请另外申请域名。"
response.end
endif

iflen(nurl)>alongthen
response.write"很抱歉,你输入的域名太长,请重新输入"
response.end
endif

ifinstr(pbkey,nurl)then
response.write"很抱歉,你输入的域名因为含有敏感字而不管理员屏蔽,请重新输入。"
response.end
endif

"判断字符的合法性
ifinstr(nurl,"~")orinstr(nurl,"`")orinstr(nurl,"/")orinstr(nurl,"?")orinstr(nurl,">")orinstr(nurl,"<")orinstr(nurl,";")orinstr(nurl,":")orinstr(nurl,"}")orinstr(nurl,"{")orinstr(nurl,")")orinstr(nurl,"(")orinstr(nurl,"*")orinstr(nurl,"&")orinstr(nurl,"^")orinstr(nurl,"%")orinstr(nurl,".")orinstr(nurl,",")orinstr(nurl,""")orinstr(nurl,"~")orinstr(nurl,"!")orinstr(nurl,"$")then
response.write"很抱歉,你输入的域名含有非法字符,请重新输入,以下字符为非法字符:<br>~`/?><;:}{)(*&^%$#@!"
response.end
endif


setrs=server.createobject("adodb.recordset")
sql="select*from**wheretheidisnull"
rs.opensql,conn,3,3
rs.addnew
rs("userid")=uID
rs("nowurl")=nowurl
rs("tourl")=tourl
rs("company")=company
rs.update
response.write"祝贺,申请成功,你马上就可使用你的域名:http://"+nowurl
%>


域名解吸程序:freedns.asp
<!--#includefile="conn.asp"-->
<%
dimgeturl
geturl=replace(Request.ServerVariables("HTTP_HOST"),"www.","")

setrs=server.createobject("adodb.recordset")
sql="select*fromtbwherenowurl=""&geturl&"""
rs.opensql,conn,1,1
ifrs.eofthen
response.redirect"http://www.51bxg.com/miss.html"
else
dimtourl,company
tourl=rs("tourl")
company=rs("company")
%>
<HTML>
<HEAD>
<METAhttp-equiv="Content-Type"content="text/html;charset=gb2312">
<METACONTENT="text/html;CHARSET=UTF-8"HTTP-EQUIV="Content-Type">
<TITLE><%=company%></TITLE>
</HEAD>


<framesetframeborder="0"framespacing="0"scrolling="no"border="0"marginheight="0"marginwidth="0"rows="0,*">
<framescrolling="NO"noresize="0"marginwidth="0"marginheight="0"framespacing="0"frameborder="0"target="main"name="main"SRC="about:blank">

<framescrolling="yes"noresize="0"marginwidth="0"marginheight="0"framespacing="0"frameborder="0"target="main"name="main"SRC="<%=tourl%>">

<noframes>
<body>
<p>Thispageusesframes,butyourbrowserdoesn"tsupportthem.</p></body>
</noframes>
</frameset>
</HTML>
<%endif%>