Many netizens may find that now in some websites, especially in the personal website, find virtual domain names that use Youname@xxx.com. When I told my friend, they all said that this is not the address of an email? In fact, it is true, but if it is input to the address of the browser, it is not a child name. If you don't believe, you enter http://bbs@luyu.net and http: //guestbook@luyu.net in the browser. Is it found that they are two different addresses, the former is the BBS login page of this site, the latter is a message book, but this site is the homepage is http://luyu.net, cool. Some netizens also asked why not do virtual domain names in http://bbs.luyu.net and http://guestbook.luyu.net, this is the real secondary domain name. Because this is nothing different in terms of implementation, just "." The role in the domain name can be greatly different, you can access it with http://www.luyu.net, I don't have http: // www @ luyu @ Net, because "." To take into account a problem with the decoding. So do "." The virtual domain name must let the domain name service provider to open the pan-domain name, just type * .luyu.net in the browser's address bar, will go to the Luyu.NET server first to request the resolution decoding Service, this, realize unlimited multiple free "." The virtual domain name is not difficult. Most of the pana-name open is to collect 100 to 200 yuan, so we don't consider free @ domain names. Some netizens also asked why not use "! # $%" Other symbols and @, this is to read the article below you will understand.
You can make your own @ domain name by this article. When you are, you are an administrator, you can add any links, including Chinese, think about it directly http: // Wallpaper @ luyu.net Too cool. However, Chinese should pay attention to the UTF-8 specification issue.
Let's take a look at all aspects of the @ virtual domain name.
The @ virtual domain name begins to log in to the FTP server directly in the user and password in the browser. Such as: Type Password: username @ ftp: //my.ftp.com, IE will automatically log in to the FTP server with the user "username" and password "password"; equivalent to first in the browser In the address bar, type ftp://my.ftp.com, enter the login page, and then enter the username and password under the prompt. Why is this? It turns out in the HTTP1.1 protocol, it is specified that the HTTP access authorization function is implemented, and the form is like the above Password: username @ ftp or the server host sent by Header. Then, the password can be omitted, that is to say to access the username @ server host, it is equal to accessing this server host as UserName, so I think everyone will understand why we can use @, not other symbols Let it be. So guestbook@luyu.net, actually to access the luyu.net host with guestbook users, can you access the page of the message board? In fact, this is just a simple page jump function, which will be discussed below.
The function of implementing the jump means that this page will be automatically linked to a new page when the user enters a page. For example: When you play http://luyu.net, entering actually http://luyu.net/index.html or http://luyu.net/default.html is def.html. This is not my own passion to modify the server's default connection document, and you can't modify most cases (because it is not your own server). In fact, when you play http://luyu.net, the browser is first enters the Default.html page, and then the JavaScript inside is turning, if you don't believe, you can open my default.html document and see if you look. However, we will also put it out below. In fact, only the following lines in my default.html document:
THIS.LOCATION = "Gourl.asp? user =" this.location.href;
script>
Only a short three-line code, in fact, his role is to achieve the steering, when the netizen enters http: //bbs@luyu.net, this code is to assume this value to the User variable, and transfer to Goul.asp Document in the file for handling. In fact, the key to the value of User is the characters behind the http: // before, here is "BBS", and http: //guestbook@luyu.net is "Guestbook". After we get these characters, we will make the corresponding prominent URL.
Such as: If the value of the value is "BBS", we go to http://luyu.net/free this URL. So if you know is http://luyu.net/free, we can read it through a text or database. Here we choose the Access database because it is more convenient to manage, and the host that supports ASP is generally supporting Access.
Below is the URL table structure in the library:
Field Name Field Type Field Default // Feature Notes
ID INT self-increment keyword 1 Do not use user to do keywords is afraid of Chinese characters
User characters NULL, such as BBS or GuestBook values
URL for URL character type NULL
Click INT 0 Access
There are very few fields in the table, only 4, netizens can add some functional fields as needed, if there is a pop-up window advertisement, visual analysis, etc. However, the necessary is the user field and the URL field, because we have to get the value of the user, and then get it to the URL URL according to it, then implement the steering in Gourl.asp.
Below is a full program that implements the steering in Gourl.asp (I will write a comment in the program):
DIM CONN, DBS / / Defining Variables
Set conn = server.createObject ("AdoDb.Connection" // Establish a connection object
DBS = server.mappath ("url.mdb") // Defines the database path to which you want to connect
Conn.open "driver = {Microsoft Access Driver (* .mdb)}; dbq =" & dbs // opens and implements links to their database sources
User = trim (Request.QueryString ("User") // gets the URL entered in the browser in the browser in the DEFAULT.html file
If User <> "" "When the user is not empty
User = replace (user, "http: //", ") // Deletes" http: // "string from the USER value from the USER value at = INSTR (user," @ ") // @ @ @ @ @ @T "The location assigned to the variable AT
Else
Response.write "message, please contact Moon!" // Tell the netizen when the user value is empty
END IF
IF at> 0 THEN
User = Left (user, AT-1) // When the location of "@" in the user value is greater than 0, the part is re-assaped to the user, such as "BBS" or "GuestBook" equivalence.
Else
Response.Redirect "def.htm" // If you don't get it, if you http://www.luyu.net, you return to the DEF.htm file.
Response.end // Stop output
END IF
IF user <> "".
SET RS = conn.execute ("SELECT URL from DNS WHERE = '" & user & "") // When the user value is not empty, the database will be searched.
IF not r.
Conn.execute ("Update Url Set Click = Click ! Where user = '" & user & "") // When the record is not empty, add this site to 1
Response.Redirect RS ("URL") / / Turn to its website
Else
Response.write "Sorry, there is no website!" // When the record is empty, warning users do not have this website.
END IF
SET RS = Nothing
Else
Response.write "Sorry, there is no this domain!" // When the value of the user is empty, the warning netizen does not have this domain name.
END IF
SET CONN = Nothing / / Turn off the database connection
If you want to make a pop-up window when you visiting the virtual domain name, you can change the code above: