


Introduction to PHP pseudo-static technology principles and implementation of breakthrough principles_PHP tutorial
Let’s talk about the implementation method first:
inj.php:
set_time_limit(10);
$id=$_GET["id"];
$id=str_replace(" ","%20",$id);
$ id=str_replace("=","%3D",$id);
$url="http://www.xxx.com/index.php/library/more/id/$id.html";
$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,"$url");
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);//The information obtained by curl_init() when enabled Return in the form of a file stream instead of direct output
curl_setopt($ch,CURLOPT_HEADER,0);//When enabled, the header file information will be output as a data stream
$output=curl_exec($ch);
curl_close($ch);
print_r($output);
?>
Build a server with wamp and put the above inj.php into wamp/www/ , and then run http://127.0.0.1/inj.php?id=1
========================== ====
PHP pseudo-static implementation method 1 (using the function of Apache server)
1. Check whether Apache supports mod_rewrite
2. Let Apache support .htaccess
3 , Create .htaccess file
4. Rules:
RewriteEngine on
RewriteRule ([a-zA-Z]{1,})-([0-9]{1,}).html$index .php?action=$1&id=$2
([a-zA-Z]{1,})-([0-9]{1,}) is what the URL looks like
$1 is ([a The
$2 matched by -zA-Z]{1,}) is the
matched by [0-9]{1,}. For example: www.xx.com/page-18.html
The real URL is as follows:
action = page
id = 18
==============================
PHP pseudo-static implementation method two (encoding implementation)
$Php2Html_FileUrl = $_SERVER["REQUEST_URI"]
echo $Php2Html_FileUrl
Example: // localhost/php100/test.php ?id|1@action|2
$Php2Html_UrlString = str_replace("?"," ",str_replace("/","",strrchr(strrchr($Php2Html_FileUrl,"/"),"?")) ))
/*
The inner strrchr comes out: /test.php?id |1@action|2
The strrchr of the outer layer comes out: id|1@action|2
The str_replace of the inner layer comes out: remove the / sign. This example does not have it.
The str_replace of the outer layer comes out: remove? Remove the number, there is no one in this example
*/
$Php2Html_UrlQueryStrList = explode("@",$Php2Html_UrlString);
/*Convert str into an array divided by @: id|1 and action| 2*/
foreach($Php2Html_UrlQueryStrList as $Php2Html_UrlQueryStr)
{
$Php2Html_TmpArray = explode("|",$Php2Html_UrlQueryStr);
/* id => 1 and action => 2 */
$_GET[$Php2Html_TmpArray[0]] = $Php2Html_TmpArray[1];
}
================ ============
PHP pseudo-static implementation method three (encoding implementation)
Example: localhost/php100/test.php/1/2
$filename = basename($_SERVER["SCRIPT_NAME"]);
echo $_SERVER[ "SCRIPT_NAME"];
echo $filename;
if(strtolower($filename) == 'test.php'){
if(!empty($_GET[id])){
$id=intval($_GET[id]);
echo $id;
$action = intval($_GET[action]);
echo $action;
}else{
$nav=$_SERVER["REQUEST_URI"];
$script=$_SERVER["SRCIPT_NAME"];
//This sentence should be to get rid of the previous paragraph of the URL. . That leaves something like "1/2". .
$nav=ereg_replace("$script","",urldecode($nav));
echo $nav;
$vars = explode("/",$nav);
print_r ($vars);
$id=intval($vars[1]);
$action=intval($vars[2]);
}
echo $id.'&'. $action;
}
============================
PHP pseudo-static implementation method four (coding implementation)
function mod_rewrite(){
global $_GET;
$nav = $_SERVER["REQUEST_URI"];
$script_name = $_SERVER["SCRIPT_NAME"]
$nav=substr(ereg_replace("$script_name"), "",urldecode($nav)),1);
$nav=preg_replace("/^.ht(m){1}(l){0,1}$/","",$nav) ;//Remove the trailing htm or html
$vars=explode("/",$nav);
print_r($vars);
for($i=0;$i
$_GET[$vars[$i]] = $vars[$i+1];
}
return $_GET;
}
==============================
PHP pseudo-static implementation method five ( Coding implementation)
Example: /1,100,8630.html
if (preg_match(“//(d+),(d+),(d+).html/si”,$path_info,$arr_path)){
$gid =intval($arr_path[1]); //Get the value 1
$sid =intval($arr_path[2]); //Get the value 100
$softid =intval($arr_path[3]); //Get the value 8630
}
else
echo "Path:Error!";
To summarize:
(1) Pseudo-static technology is easier to break through, and you need to construct the transfer injection page yourself.
(2) The principle of pseudo-static technology is very simple, which is to replace the original URL in the form of index.php?id=1 with other forms.

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



PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

To work with date and time in cakephp4, we are going to make use of the available FrozenTime class.

To work on file upload we are going to use the form helper. Here, is an example for file upload.

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier. CakePHP is based on a MVC-like architecture that is both powerful and easy to grasp. Models, Views, and Controllers gu

Validator can be created by adding the following two lines in the controller.

Logging in CakePHP is a very easy task. You just have to use one function. You can log errors, exceptions, user activities, action taken by users, for any background process like cronjob. Logging data in CakePHP is easy. The log() function is provide

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

CakePHP is an open source MVC framework. It makes developing, deploying and maintaining applications much easier. CakePHP has a number of libraries to reduce the overload of most common tasks.
