Play with virtual domain names◎+_PHP tutorial
I don’t know if you have discovered a new phenomenon on the Internet recently, that is, some websites have begun to provide “username@server” virtual domain name services. Due to the charm of "@", everyone is applying one after another. You may be thinking: "How great it would be if I could also provide this kind of service:) It must be very 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; and 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); // Remove the part after the "@"
Then, the remaining URL only contains the "username" part.
In order to apply to the database, the characters need to be processed:
$url = addslashes($url);
2. Search for the real URL:

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



Websites for learning C language: 1. C Language Chinese Website; 2. Rookie Tutorial; 3. C Language Forum; 4. C Language Empire; 5. Script House; 6. Tianji.com; 7. Red and Black Alliance; 8, 51 Self-study network; 9. Likou; 10. C Programming. Detailed introduction: 1. C language Chinese website, which is a website dedicated to providing C language learning materials for beginners. It is rich in content, including basic grammar, pointers, arrays, functions, structures and other modules; 2. Rookie tutorials, This is a comprehensive programming learning website and more.

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:

Some friends find that their computers cannot access the Internet because of abnormal network card drivers. They want to know how to fix it. In fact, current systems have built-in driver repair functions, so we only need to manually update the driver. If it doesn’t work, then we can fix it. Driver software can be used. How to fix the problem that the network card driver is abnormal and cannot connect to the Internet: PS: If this problem occurs suddenly, you can try restarting the computer first. If it still doesn't work after restarting, continue with the following operations. Method 1: 1. First, right-click on the taskbar and select "Start Menu" 2. Open "Device Manager" in the right-click menu. 3. Click "Network Adapter", then select "Update Driver" and click "Automatically search for driver". After the update is completed, you can surf the Internet normally. 5. Some users are also affected by the problem.

Application method: 1. Apply for a free domain name through the Ministry of Industry and Information Technology website, and you can obtain the free domain name after waiting for approval; 2. Apply for a domain name for free through DNSPod. Users can register an account on DNSPod and apply for a free second-level domain name; 3. Choose a reliable domain name Free domain name service providers, choose a reliable provider through comparison and understanding; 4. Register an account, click the registration button, fill in the relevant personal information as required and create an account; 5. Search and select the domain name.

When some friends are browsing the web, they find that their computer browser is obviously connected to the Internet but cannot open the web page. What is going on? Let's take a look at the solution to this problem. Win11 browser cannot open web pages but can access the Internet: 1. First click on the "three dots" of the browser. 2. Then click "View advanced settings". 3. Then select "Open proxy settings". 4. Finally, just turn on "Automatically detect settings". Extension: How to set compatibility mode

PHP domain name redirection is one of the commonly used technologies in website development. Through domain name redirection, users can automatically jump to another URL when visiting one URL, thereby achieving website traffic guidance, brand promotion and other purposes. The following will use a specific example to demonstrate the implementation method of PHP domain name redirection and show the effect. Create a simple PHP file named redirect.php with the following code:

1. Choose an available domain name: The corporate email domain name should be related to the corporate brand or business. 2. Check whether the domain name has been registered: After selecting the corporate email domain name, you need to check whether the domain name has been registered by other companies. 3. Choose an email service provider: Enterprises can search for different email service providers through search engines and choose a provider based on their needs. 4. Create an account: The process of registering for an email service may be slightly different, but you usually need to fill in the basic information of the company and administrator and create an administrator account.

What should I do if Sogou High-speed Browser cannot access the Internet? When we use Sogou Browser, we cannot access the Internet. What should we do? Let’s introduce it below! We usually use Sogou Browser to browse the web, which is very convenient. However, recently some friends found that they could not access the Internet while using it. How should this situation be solved? What is the specific operation method? The editor has compiled it below How to solve the problem of Sogou high-speed browser being unable to access the Internet? If you don’t know how to solve it, follow me and take a look below! Solution to Sogou High-speed Browser unable to access the Internet 1. First, open "Sogou High-speed Browser" and click the "Menu Bar" above 2. Then click to expand "More Tools" 3. Next, click "Browser Repair" below 4. Finally Click on Quick Fix
