Myspace Tracker

This code consists of three files, a folder, an image and a piece of code. You must have PHP fread(); and fwrite(); enabled on your server for this tracker to work properly. To check and see if these are enabled, create a file such as info.php and place the following code into it.

<? phpinfo(); ?>

Open the file and scroll down to the disabled_functions area, if fread and fwrite are included here this tracker will not work. Before you get started, create a folder such as tracker and inside of that folder create another named log. Right click here and save link as moo.gif in your tracker folder. Create a new file named track.php, save it into your tracker folder and place the following code into it.

<?
$image = "moo.gif" ;
$id = $_GET['id'] ;
$logfile= "log/$id.htm";
$IP = $_SERVER['REMOTE_ADDR'];
$logdetails= date("F j, Y, g:i a") . ': ' . '<a href=http://dnsstuff.com/tools/city.ch?ip='.$_SERVER['REMOTE_ADDR'].'>'.$_SERVER['REMOTE_ADDR'].'</a>';
$imagedir = "" ;


if (isset($image) {
$imagepath = $imagedir.$image ;
$imageinfo = getimagesize( $imagepath );
header( "Content-type: image/jpg" );
@readfile( $imagepath );
if(isset ($_COOKIE['identifier'])){
$visitorid = $_COOKIE['identifier'];
$visitornumber = " Visitor ID: $visitorid";
}
else{
$r1 = rand (0, 9);
$r2 = rand (0, 9);
$r3 = rand (0, 9);
$r4 = rand (0, 9);
$r5 = rand (0, 9);
$r6 = rand (0, 9);
$r7 = rand (0, 9);
$r8 = rand (0, 9);
$r9 = rand (0, 9);
$rnumber = $r1.$r2.$r3.$r4.$r5.$r6.$r7.$r8.$r9;
setcookie("identifier", $rnumber, time()+155520000);
$visitornumber = " Visitor ID: $rnumber";
}
$fp = fopen($logfile, "a");
fwrite($fp, $logdetails.$visitornumber );
fwrite($fp, "<br>");
fclose($fp);
}
else {
header( "HTTP/1.0 404 Not Found" );
exit ;
}
?>

Next create another file named login.htm, in your tracker folder, with the following code in it.

<html>
<head>
<title>Tracker Login</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form action="admin.php" method="get"><table width="575" border="0" align="center" cellpadding="5" cellspacing="5">
<!--DWLayoutTable-->
<tr>
<td height="31" colspan="6" valign="top"><div align="center"><strong><font face="Verdana, Arial, Helvetica, sans-serif">Login
Below </font></strong></div></td>
</tr>
<tr>
<td width="33" height="25"></td>
<td width="118"></td>
<td width="80"></td>
<td width="85"></td>
<td width="114"></td>
<td width="50"></td>
</tr>
<tr>
<td height="32">&nbsp;</td>
<td colspan="2" valign="top"><font face="Verdana, Arial, Helvetica, sans-serif">Enter
your ID number</font></td>
<td colspan="2" valign="top"> <input size="35" name="id" type="text"> </td>
<td></td>
</tr>
<tr>
<td height="17"></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="34"></td>
<td></td>
<td colspan="2" align="center" valign="middle"><input type="submit" name="Submit" value="Submit" action="get"></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="58"></td>
<td></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
</form>
</body>
</html>

Create a file admin.php in your tracker folder and place this code into it.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Visitor Detail</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>

<table align="center" width="855" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td align="center" width="855" height="245">
<?
$id = $_GET['id'] ;
$myFile = "log/$id.htm";
$fh = fopen($myFile, 'r');
$theData = fread($fh, filesize($myFile));
fclose($fh);
echo $theData;
?>
</td>
</tr>
</table>
</body>
</html>

Lastly place this code anywhere on your myspace profile, but substitute, www.sample.com, with your website name and XX for an ID number of your liking such as 23.

<img src="http://www.sample.com/tracker/track.php?id=XX">

To login and see a list of visitors, simply visit http://www.sample.com/tracker/login.htm (replacing www.sample.com with your website) and enter the id you choose into the provided field. You should begin to see a list of visitors.