# File Name:domain.cgi
# Author: yuxiaoyanran
# Email: zjs@cnpeople.net QQ:195259815
# WebSite : http://www.cnpeople.net
# BLOG: http://www.cnpeople.net/blog
# Date : 2005-04-21
###########################################################
#!/bin/sh
echo "Content-Type:text/html"
echo ""
echo "
""
echo ""
Domain query system
echo "
"
echo "Please Input your query domain:"
echo "
echo ""
#######################################################
# File Name : query.cgi
# Author: yuxiaoyanran
# Email: zjs@cnpeople.net QQ:195259815
# WebSite : http://www.cnpeople.net
# BLOG: http://www.cnpeople.net/blog
# Date : 2005-04-21
########################################################
#!/bin/sh
if [ "$REQUEST_METHOD" = "GET" ]; then
domainname=$QUERY_STRING
#delete the variable name
domainname=`echo $domainname |sed 's/domainname=//g'`
# start HTML page
echo "Content-Type:text/html"
echo ""
echo ""
echo "
echo ""
echo "
"
echo ""
Domain Query Result
echo "
"
#check the variable
if [ "$domainname" = "" ]
then
echo "None domain for query"
echo "Please Input domain name"
else
# IPAd=`echo $domainname | sed 's/\./ /g' |awk '{print $1}'`
# if [ $IPAd -lt 255 ]
## repaire
IPAD=`echo $domainname |grep -c '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}'`
if [ $IPAD -eq 1 ]
then
whois $domainname > tmp.txt || echo "write file err";exit 1
tmp=`cat tmp.txt |sed -n '/NameServer/'p|sed -n '1'p|sed 's/NameServer://g'`
if [ "$tmp" ="" ]
then
strString="This IP address is invalidation"
boo="false"
else
strString="This IP address is register."
boo="true"
fi
else
domaintmp=`echo $domainname |sed 's/\./ /g'|awk '{print $2}'`
# check the type of domain's name
if [ "$domaintmp" = "com" || "$domaintmp" = "net" ]
then
domain="=$domainname"
else
domain="$domainname"
fi
whois $domain >tmp.txt || echo "open file err";exit 1
tmp=`cat tmp.txt | sed -n '/Name Server:/'p |sed -n '1'p |sed 's/Name Server://g'`
if [ "$tmp" = "" ] ;then
strString="This domain is not register"
boo="false"
else
strString="$domainname is register.detail Information:"
boo="true"
fi
fi
fi
echo "$strString"
if [ "$boo" = "true" ]; then
result=`cat tmp.txt`
echo "$result"
fi
fi