我正在研究一个跟踪像素,它应该将请求者的 ip 和一些其他信息记录到一个 html 文件中,但是 html 文件永远不会被创建,如果我创建它,它就会保持为空。
<?php
// Create an image, 1x1 pixel in size
$im=imagecreate(1,1);
// Set the background colour
$white=imagecolorallocate($im,255,255,255);
// Allocate the background colour
imagesetpixel($im,1,1,$white);
// Set the image type
header("content-type:image/jpg");
// Create a JPEG file from the image
imagejpeg($im);
// Free memory associated with the image
imagedestroy($im);
// Server variables
$ip = $_SERVER['REMOTE_ADDR'];
$referer = $_SERVER['HTTP_REFERER'];
$useragent = $_SERVER['HTTP_USER_AGENT'];
$browser = get_browser(null, true);
$fecha = date("Y-m-d;h:i:s");
if (isset($_GET['type'])) {
$type = $_GET['type'];
}
$f = fopen("list.html", "a");
fwrite ($f,
'IP: [<b><font color="#660000">'.$ip.'</font></b>]
Referer: [<b><font color="#9900FF">'.$referer.'</font></b>]
User Agent: [<b><font color="#996600">'.$useragent.'</font></b>]
Browser: [<b><font color="#996600">'.$browser.'</font></b>]
Date: [<b><font color="#FF6633">'.$fecha.'</font></b>]<br> ');
if (isset($type) {
fwrite ($f, 'Type: [<b><font color="#660000">'.$type.'</font></b>]'
fclose($f);
?>