Home Backend Development PHP Tutorial Play with virtual domain names ◎+ ._PHP tutorial

Play with virtual domain names ◎+ ._PHP tutorial

Jul 21, 2016 pm 04:07 PM
Internet access Discover domain name Have fun virtual

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.​

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/315226.htmlTechArticlePlay 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 service for "username@server". Because of the charm of "@"...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Microsoft Wi-Fi Direct Virtual Adapter: What does it do? Microsoft Wi-Fi Direct Virtual Adapter: What does it do? Jun 29, 2023 pm 12:33 PM

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

How to solve the problem that the computer browser cannot open the web page but can access the Internet How to solve the problem that the computer browser cannot open the web page but can access the Internet Jun 28, 2023 am 11:26 AM

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.

The first choice for CS players: recommended computer configuration The first choice for CS players: recommended computer configuration Jan 02, 2024 pm 04:26 PM

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 How to log in to the online authentication system 1.1.1.1 How to log in to the online authentication system Apr 20, 2023 am 10:44 AM

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.

Tutorial on how to solve the problem of being unable to access the Internet after upgrading win10 system Tutorial on how to solve the problem of being unable to access the Internet after upgrading win10 system Mar 27, 2024 pm 02:26 PM

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:

Why can't I access the Internet even though my wifi is connected? Why can't I access the Internet even though my wifi is connected? Dec 07, 2023 pm 05:00 PM

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.

What is the relationship between the domain name of the host and the IP address of the host? What is the relationship between the domain name of the host and the IP address of the host? Jan 14, 2021 pm 06:02 PM

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.

The source code of 25 AI agents is now public, inspired by Stanford's 'Virtual Town' and 'Westworld' The source code of 25 AI agents is now public, inspired by Stanford's 'Virtual Town' and 'Westworld' Aug 11, 2023 pm 06:49 PM

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

See all articles