Play with virtual domain names ◎+ ._PHP tutorial
Play with virtual domain names ◎+ .
I don’t know if you have discovered a new phenomenon on the Internet recently, that is, some websites have begun to provide virtual domain name services for “username@server”. Due to the charm of "@", people are applying one after another. You may think: "It would be great if I could also provide this kind of service:) It must be popular!" This article will reveal the "mystery" of "@" to everyone. Veil, so everyone can come "@"! (Do u @ today?)
Don’t worry, this is not an email address, it is a virtual domain name. If you don’t believe it, you can visit “bbs@zphp.com” in your browser. Some friends should have used the FTP function of IE. Just type "password:username@server" in the address bar of the browser and IE will automatically log in to the FTP server. In the Http1.1 protocol, the Http access authorization function is stipulated. The form is also "password:username@server", in which "password:" can be omitted. Accessing "bbs@zphp.com" actually accesses the server "zphp.com" as bbs.
Then we just need to send the specific URI to the PHP program and search for the real URL redirection in the database.
First we need to create a page that transmits URI (as the default document of the server, usually named index.htm); this function can be implemented in the Window object of JS. The following is the source code of index.htm:
<script> <br>this.location = 'gotourl.php?url=' + this.location.href; <br></script>
The above code will redirect the browser to gotourl .php, and assign the variable $url to the current URI through QueryString.
After successfully passing the URI to the PHP program, you can enter the database to find the real URL. The following is the structure of the table corresponding to the SQL database:
CREATE TABLE domain(
Id int(3) UNSIGNED DEFAULT '0 ' NOT NULL, # Domain name ID
Domain char(20) NOT NULL, # Domain name
Gotourl char(255) NOT NULL, # Real URL
);
Once the Table is created, you can Start writing gotourl.php. The program is divided into three parts:
1. Analyze URL:
$url = preg_replace(“/^http:\/\//I”, “”, $ url); // Remove the "http://" in front of the URL, it is not case sensitive
$url = preg_replace("/@.+$/", "", $url); // Replace the "@ "Remove
from the following part, then the remaining URL will only contain the "username" part.
In order to apply it to the database, it is necessary to process the memorable characters:
$url = addslashes($url);
2. Search for the real URL:
In order to achieve the versatility of the program, use Created a database operation class (modified from PHPLib) to operate the SQL database:
$db = new dbSql(); // Connect to the database
$queryString = sprinf(“SELECT gotourl FROM domain WHERE domain='%s ';", $url); // Generate query string
$gotourl = $db->result($queryString); // Query to obtain results
3. Redirect:
in PHP There are many ways to redirect the browser, here we use the relatively simple HttpHeader to achieve it:
header(“location: $gotourl”);
Attachment
actually like The virtual domain name service of NetEase's "username.yeah.net" is very similar to the implementation method of "@", but "." requires DNS pan-resolution worth 200 yuan at the cost, while "@" only requires:
1. Permissions of PHP/SQL database;
2. Domain name resolved by real DNS.
If you need to add advertisements to the virtual domain name service, such as NetEase's Popup window, you can change the redirection part to:
<script> <br>window.open("url","nease ","width=windth,height=height"); <br></script>
In order to be worthy of the "conscience of heaven and earth", the author did not add the complete program after the merger (cheating the manuscript fee?), If you are lazy and need the complete code (including additions, etc.), you can get it at http://zphp.com or http://bbs@zphp.com. I hope everyone has a good visit volume.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

You may be wondering what the Microsoft Wi-Fi Direct Virtual Adapter does on your PC. Better rest assured that this network adapter is Microsoft and completely secure. But if the adapter is messing up your activity and you're wondering if it's worth keeping, this guide will give you everything you need to know. What does the Microsoft Wi-Fi Direct virtual adapter do? As the name suggests, Microsoft Wi-Fi Direct Virtual Adapter helps make your PC a wireless hotspot. This way, other computers can connect to your PC to access the Internet. It does this by virtualizing wireless network adapters. This way, your single physical wireless adapter is converted into two virtual

Solution to the problem that the computer browser cannot open the web page but can access the Internet: 1. Network setting problem, power off the router and wait a few minutes, then plug it back in; 2. Browser setting problem, clear the browser cache and browsing history , make sure the browser does not set up a proxy server or virtual private network; 3. DNS setting problem, change the DNS settings to a public DNS server address; 4. Anti-virus software or firewall problem, disable the anti-virus software or firewall, and try to open the web page again; 5. There is a problem with the web page itself. Please wait for a while or contact the website administrator to find out the situation.

1. Processor When choosing a computer configuration, the processor is one of the most important components. For playing games like CS, the performance of the processor directly affects the smoothness and response speed of the game. It is recommended to choose Intel Core i5 or i7 series processors because they have powerful multi-core processing capabilities and high frequencies, and can easily cope with the high requirements of CS. 2. Graphics card Graphics card is one of the important factors in game performance. For shooting games such as CS, the performance of the graphics card directly affects the clarity and smoothness of the game screen. It is recommended to choose NVIDIA GeForce GTX series or AMD Radeon RX series graphics cards. They have excellent graphics processing capabilities and high frame rate output, and can provide a better gaming experience. 3. Memory power

1.1.1.1 Login method for the Internet authentication system: 1. Search for the campus network wireless signal and connect; 2. Open the browser and select "Self-Service" on the pop-up authentication interface; 3. Enter the user name and initial password to log in; 4. Complete Personal information and set a strong password.

1. Use the win+x shortcut key to open the menu and select [Command Prompt (Administrator) (A)], as shown below: 2. After entering the command prompt interface, enter the [ipconfig/flushdns] command and press Enter , as shown in the figure below: 3. Then enter the [netshwinsockresetcatalog] command and press Enter, as shown in the figure below: 4. Finally enter the [netshintipreset] command and press Enter, restart the computer and you can access the Internet, as shown in the figure below:

Reasons why WiFi is connected but cannot access the Internet: 1. WiFi signal is weak; 2. IP address conflict; 3. DNS server problem; 4. Router failure; 5. Network provider problem; 6. Problem with the WiFi network itself; 7. Router problem ; 8. Equipment network setting problems; 9. Signal interference or obstacles; 10. Equipment problems. Detailed introduction: 1. The WiFi signal is weak. The strength of the WiFi signal directly affects the stability and speed of the network. If the connected WiFi signal is weak, it may cause the network connection to be unstable or unable to access the Internet, etc.

The relationship between the host's domain name and the host's IP address is: one IP address corresponds to multiple domain names. The IP address uses a digital form to identify the host in the computer network, and the domain name uses a character form to identify the host in the computer network. In the Internet, one domain name can correspond to one IP address, but one IP address can be corresponding to multiple domain names.

Audiences familiar with "Westworld" know that this show is set in a huge high-tech adult theme park in the future world. The robots have similar behavioral capabilities to humans, and can remember what they see and hear, and repeat the core storyline. Every day, these robots will be reset and returned to their initial state. After the release of the Stanford paper "Generative Agents: Interactive Simulacra of Human Behavior", this scenario is no longer limited to movies and TV series. AI has successfully reproduced this scene in Smallville's "Virtual Town" 》Overview map paper address: https://arxiv.org/pdf/2304.03442v1.pdf
