The web has found this very good stuff oh, dedicated to everyone. We do not have to pay to register the domain name, hehe!
Many netizens may find that there are virtual domain names in some websites, especially personal websites, that use youname@xxx.com. When I told my friends, they all said it wasn't an e-mail address? Actually it is, but if you enter it into the browser's address, it is not, but literally a child domain name. If you don't believe it, you type http://bbs@luyu.net and http://guestbook@luyu.net in the browser. is not found that they are two different addresses, the former is the site BBS login page, the latter is the website, and this site is the home page is http://luyu.net, very cool bar. Some netizens also asked why not http://bbs.luyu.net and http://guestbook.luyu.net do virtual domain name, this is the real two-level subdomain. Because it's no different in terms of implementation, just ". "In the domain name role can be very different, you can use http://www.luyu.net access, it is not http://www@luyu@net it, because". "To take into account an analytic decoding problem." So to do. " "The virtual domain name must enable the domain Name service provider to open the role of the pan-domain name, is as long as in the browser's address bar type *.luyu.net domain name, will first go to the Luyu.net server to request resolution decoding service, so that, to achieve unlimited number of free". "The virtual domain name is not difficult." Most of the key universal domain name Open is to receive 100 to 200 yuan, so we do not consider the use of free @ domain name. Some netizens also ask why not to "!#$%" other symbols and must use @ it, this point in reading the following article you will naturally understand.
Through this article you can make your own @ domain name. Then I will be the administrator, want to add any links can, including Chinese, think directly to play http://wallpaper @luyu.net that much fun ah. But the Chinese should pay attention to is the UTF-8 standard question.
Let's start with the realization of all aspects of the @ virtual domain name.
@ The implementation of the virtual domain name begins with the method of logging on to the FTP server directly in the browser as a user and password. For example: In the browser's address bar type password:username@ftp://my.ftp.com, at this time IE will automatically user "username" and password "password" landing FTP server; the equivalent of typing FTP in the browser's address bar first ://my.ftp.com, enter the login page, and then enter the username and password at the prompt. What is this for? Originally in the http1.1 protocol, it is required to implement the HTTP access authorization function, in the form of the above password:username@ftp or the server host sent by header. Then one of the password can be omitted, that is, access to the username@ server host, is tantamount to username access to this server host, just like I think we will understand why we can use @, and not other symbols. So said Guestbook@luyu.net, in fact, is to guestbook users to access the Luyu.net host, but why can access to the page of the guest book? In fact, this is just a simple page jump function, the specific in the following will be discussed.
The function of the jump is that when the user enters a page, this page will automatically link to a new page. For example: When you are playing http://luyu.net, you are not actually http://luyu.net/index.html or http://luyu.net/default.html but def.html. That's not my deal. The default connection document for the server has been modified, and in most cases you will not be able to modify it (because it is not your own server). In fact, you are playing http://luyu.net, the browser or first into the Default.html page, and then by the inside of the JavaScript to make a turn, do not believe that you can open my default.html document to see, but below we will also post it.
In fact, my default.html document has only the following lines:
Only a short line of three lines of code, in fact, his role is to achieve the steering, when the user input http://bbs@luyu.net, in fact, this code is to assign this value to the user variable, and forwarded to the gourl.asp file in order to deal with. In fact, the value of the user is the key to the http://after the @ after those characters, here is "BBS", and Http://guestbook@luyu.net is "guestbook." We get these characters and then make a corresponding turn to their real URLs.
such as: If the value of the "BBS", we will go to http://luyu.net/free this site. So if you know it's http://luyu.net/free, we can read it by text or database. Here we select an Access database because it is easy to manage, and hosts that support ASP are generally supporting access.
The following is the URL table structure in the library:
Field Name field default value//function note
ID int self-add keyword 1 do not use user to do the keyword is afraid that there are Chinese characters
User character null such as the value of a BBS or guestbook
URL character null-shifted URL
Click Int 0 Access Amount
There are few fields in the table, only 4, users can add some functional fields according to the need, such as whether there is pop-up window ads, traffic analysis, and so on. But what is necessary is the user field and the URL field, because we have to get the user's value, and then according to it to get its turn URL, and then in the gourl.asp to implement the turn on the line.
The following are all the programs in the gourl.asp to implement the steering (I'll write the comments in the program):
Dim Conn,dbs//Define Variable
Set conn=server.createobject ("ADODB. Connection ")/to establish a Connection object
Dbs=server.mappath ("Url.mdb")//define the database path to connect to
Conn.Open "Driver={microsoft Access Driver (*.mdb)};d bq=" &dbs//Open and implement a link to its database source
User=trim (Request.QueryString ("user"))//Get the URL entered in the browser in the Default.html file
If user<> "" then//when the user value is not empty
User=replace (user, "http://", "")//delete the "http://" string from the user value
At=instr (User, "@")//Assign the "@" position in the user value to the variable at
Else
Response.Write "Information error, please contact moon!"//when the user value is empty, tell the user wrong
End If
If At>0 Then
User=left (user,at-1)//When the position of "@" in the user value is greater than 0 o'clock, the part is assigned to user, such as "BBS" or "guestbook" equivalent
Else
Response.Redirect "def.htm"///If no value is obtained, such as when playing http://www.luyu.net, return def.htm file.
Response.End//Stop output
End If
If user<> "" Then
Set Rs=conn.execute ("Select URL from DNS where user= '" "&user&")//when the user value is not empty, connect the database and search
If not rs.eof then
Conn.execute ("Update URL set click=click+! Where user= ' "&user&" ""/////When the record is not empty, add 1 to the site's traffic
Response.Redirect rs ("url")//Then turn to its website
Else
Response.Write "Sorry, no this site!"/////////
End If
Set rs=nothing
Else
Response.Write "Sorry, no this domain name!" "////When the user's value is empty, warn the user not to have this domain name
End If
Set conn=nothing//Close database connection
If you want to do a pop-up window when accessing a virtual domain name to help you make an ad, you can change the above code to:
Well, such a domain Access system is simply done. If and PHP or JSP to achieve the words, the principle is the same, I believe that we read this article can be made out. Just change the gourl.asp file.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.