上一篇:无组件上传图片到数据库中,最完整解决方案 >>
二级域名原理以及程序,申请即可开通
::::::: 在sql2000,2000s中测试通过::::::::
::::::: 联系我:qq:21112856,email:yangzinet@hotmail.com:::::::::
::::::: http://www.tingfo.net ::::::
要达到二级名的效果,必须一下条件以及流程:
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
<form action=adddns.asp method=post name=frm onsubmit="return check_input()"> <br> <font color=red>加*号为必填内容</font> <br>
您想注册的域名:
http://<input name="nowurl" size=12
style=" border-bottom: 1px double; border-left: 1px double; border-right: 1px double; border-top: 1px double; color: #000000; font-size: 9pt"> .51bxg.com
<br>
你实际的网站地址:
<input name="tourl" size=12
style=" border-bottom: 1px double; border-left: 1px double; border-right: 1px double; border-top: 1px double; color: #000000; font-size: 9pt">
你要求显示的title:
<input name="company" size=12
style=" border-bottom: 1px double; border-left: 1px double; border-right: 1px double; border-top: 1px double; color: #000000; font-size: 9pt">
<br>
<input type="submit" name="submit" value=" 提 交 信 息 " style="border:1px double rgb(88,88,88);font:9pt">
<input type="reset" name="reset" value=" 重 新 填 写 " style="border:1px double rgb(88,88,88);font:9pt">
</p>
</form>
添加记录页面add.asp
<!--#include file="char.inc"-->
<!--#include file="conn.asp"-->
<%
uid=request.cookies("*****")
%>
<%
dim nowurl,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"
set rs=server.createobject("adodb.recordset")
sql="select * from dns where userid="&uid&""
rs.open sql,conn,1,1
if not rs.eof then
response.write"很抱歉,你已经申请过二级域名,每个用户只能申请一个二级域名!<br>你申请的二级域名是:http://"+rs("nowurl")
response.end
end if
set rs=server.createobject("adodb.recordset")
sql="select * from dns where nowurl="&nowurl&""
rs.open sql,conn,1,1
if not rs.eof then
response.write"很抱歉,你申请的域名:http://"+nowurl+"已经被其他公司申请,请另外申请域名。"
response.end
end if
if len(nurl)>along then
response.write"很抱歉,你输入的域名太长,请重新输入"
response.end
end if
if instr(pbkey,nurl) then
response.write"很抱歉,你输入的域名因为含有敏感字而不管理员屏蔽,请重新输入。"
response.end
end if
判断字符的合法性
if instr(nurl,"~") or instr(nurl,"`") or instr(nurl,"/") or instr(nurl,"?") or instr(nurl,">") or instr(nurl,"<") or instr(nurl,";") or instr(nurl,":") or instr(nurl,"}") or instr(nurl,"{") or instr(nurl,")") or instr(nurl,"(") or instr(nurl,"*") or instr(nurl,"&") or instr(nurl,"^") or instr(nurl,"%") or instr(nurl,".") or instr(nurl,",") or instr(nurl,"") or instr(nurl,"~") or instr(nurl,"!") or instr(nurl,"$") then
response.write"很抱歉,你输入的域名含有非法字符,请重新输入,以下字符为非法字符:<br>~ ` / ? > < ; : } { ) ( * & ^ % $ # @ ! "
response.end
end if
set rs=server.createobject("adodb.recordset")
sql="select * from ** where theid is null"
rs.open sql,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
<!--#include file="conn.asp"-->
<%
dim geturl
geturl=replace(request.servervariables("http_host"),"www.","")
set rs=server.createobject("adodb.recordset")
sql="select * from tb where nowurl="&geturl&""
rs.open sql,conn,1,1
if rs.eof then
response.redirect"http://www.51bxg.com/miss.html"
else
dim tourl,company
tourl=rs("tourl")
company=rs("company")
%>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<meta content="text/html; charset=utf-8" http-equiv="content-type">
<title><% =company %></title>
</head>
<frameset frameborder="0" framespacing="0" scrolling="no" border="0" marginheight="0" marginwidth="0" rows="0,*">
<frame scrolling="no" noresize="0" marginwidth="0" marginheight="0" framespacing="0" frameborder="0" target="main" name="main" src="about:blank">
<frame scrolling="yes" noresize="0" marginwidth="0" marginheight="0" framespacing="0" frameborder="0" target="main" name="main" src="<% =tourl %>">
<noframes>
<body>
<p>this page uses frames, but your browser doesnt support them.</p></body>
</noframes>
</frameset>
</html>
<% end if %>
()
下一篇:Java学习过程的一些重点 >>
相关文章:
- · 利用ASP+JMAIL进行邮件群发的新思路
- · 关于处理GET方式提交的含有特殊字符的参数
- · 关于Adodb.Stream 的使用说明
- · 多文件多文本框上传程序
- · 让妙客家标准版使用 SQL Server 数据库后台
- · 关于用SQL SERVER2000建立分布式网站系统的认识
- · 使用SQLSERVER的扩展存储过程实现远程备份与恢复
- · MySQL数据库类的定义
- · SQL语句导入导出大全
- · SQL Server的用户及权限
- · 深入理解C语言指针的奥秘
- · VC快捷键大全
- · 简体中文编码对应器
- · WEB打印大全
- · 用ASP实现远程批量文件改名
- · 想深入学习SQL injection的人这个可要好好看看
- · 用PHP创建PDF中文文档
- · PHP生成带有雪花背景的验证码
- · 用PHP和MySQL保存和输出图片
- · 拼音码表的生成
- · 一个odbc连mssql分页的类
- · 用PHP动态创建Flash动画
- · 如何使用PHP获取网络上文件
- · 新浪新闻小偷
- · PHP中路径问题的解决方案
- · 一个可查询所有表的“通用”查询分页类
- · xml 解析类
- · 用PHP制作静态网站的模板框架
- · 一个目录遍历函数
- · 用Socket发送电子邮件
- · PHP树的代码,可以嵌套任意层
- · MYSQL的操作类(修改后的新版本)
- · 使用PHP DOM-XML创建和解析XML文件
- · 在 PHP 中用描点法“绘制”中文
- · 编写自己的php扩展函数
- · PHP输出控制功能在简繁体转换中的应用
- · PHP 中执行系统外部命令
- · PHP实现文件安全下载
