如果自己的服务器也能够实现简记域名就好了。其实这并不复杂。你也可以做一个简记域名系统。
简记域名系统的关键技术在于:实现Web页面的重定向(Redirctory)。在本质上,简记域名系统和虚拟机系统完全不同。虚拟机的虚拟域名和IP是存在一一对应关系的。而简记域名系统不需要将域名和IP做一一映射。也就是说,它根本不需要复杂的域名解析机制和虚拟机来完成,它所做的事情就是当你在请求yourname.somedomain时,将你的浏览器重新定向到你本来存放Html页面的地方。
本程序运行环境是:RedHat 5.1 Linux下的Apache1.3.6 Web服务器+PHP3语言。在编写程序之前,我们首先要设置好我们的服务器。首先要让Apache服务器支持php3。到ftp.redhat.com下载mod_php-2.0.1-9.i386.rpm,安装后,修改/etc/httpd/conf/http.conf文件,去掉#LoadModule php3_module一句前面的#注释号,同样在/etc/httpd/conf/srm.conf文件里去掉#AddType application/x-httpd-php3 .php3前面的注释号,同时在DirectoryIndex一项后添加index.php3。重新启动Apache Server,此时服务器就支持标准的php3语言脚本文件了并能将index.php3作为默认的首页。
设置DNS服务器,使其能对泛域名解析。一般的Unix和Linux系统的DNS解析都是由Bind守护程序完成的,Bind4和Bind8的配置文件分别/etc/named.boot和name.conf,配置时根据你的系统修改。设置Bind的配置文件/etc/named.boot,在其中加入“primary domain.com db.domain”一句,添加一个新的域记录。在/etc/name.conf中加入:
zone "domain.com" {
type master;
file "db.domain”; };
在/var/name/中新建主域记录文件db.domain,其格式为:
N SOA dns.domain.com root.domain.com (
199811291 ;Serial
28800 ;refresh
7200 ;retry
604800 ;expire
86400) ;minimum
dns
MX 10 dns.domain.com.
dns A 202.115.135.50
while (list(, ) = each()) {
if(=="Host"){= strtok(,".");}}
//Jump out the Banner's Window//
echo '<script language="JavaScript">',
'msg=window.open("banner.htm","sample",
"toolbar=no","directories=no",directories=no","menubar=no");',
'</script>';
// seek the user information from the recorded file//
if(!=file("data/user.dat")){echo "Open Data File Error!!";}
="http://";
for(=0;<count();++)
if(strtok(,":")==){
=; }
if(=="http://"){echo "not found the uesrname of Data!";}
else{
echo '<meta http-equiv="refresh" content="0;','url=',,'">';}