I have a tracking code that I made that tracks who goes to the page, it worked perfect for 2 weeks or so. And today, it stopped working. I didnt change anything. Well here is the link that people will click for it to track
Code: Select all
http://www.mysite.com/index.php?THEIRSCREENNAMEadd2stat ( this page adds the screen name, page, date, and IP to database.
Code: Select all
<?
$username= "muot_track";
$password= "track";
$database= "muot_tracker";
$connection = mysql_connect('localhost',$username,$password);
mysql_select_db($database);
$get=array();
foreach(explode('|',$_SERVER['QUERY_STRING']) as $get) {
$get = explode('-',$get);
$my_get[$get[0]]=$get[1];
}
$sn2 = str_replace("%20", "", $get[0]);
$sn = str_replace("sn=", "", $sn2);
if ($_SERVER['REMOTE_ADDR'] != '68.195.158.8') {
if ($sn != '') {
$date = date("m.d.y");
$time = date('g:i a',time()+3600);
$ip = @$REMOTE_ADDR;
$sql = "INSERT INTO `Tracker` ( `Number` , `Screen Name` , `Page` , `Date` , `Time` , `IP` )
VALUES (
'', '$sn', '$page', '$date', '$time', '$ip'
);
";
$result = mysql_query($sql) or die(mysql_error());
}
}
?>Here is the page I use to view the stats.
visit_log.php
Code: Select all
<?php
$page = "stats.";
require('/home/muot/public_html/pages/login/head.php');
?>
<html>
<font face=Arial size=1>
<?
$username= "muot_track";
$password= "track";
$database= "muot_tracker";
$connection = mysql_connect('localhost',$username,$password);
mysql_select_db($database);
?>
<table border=1>
<tr>
<td align=center><font color=red><b>Screen Name</b></font></td>
<td align=center><font color=red><b>Date</b></font></td>
<td align=center><font color=red><b>Time</b></font></td>
<td align=center><font color=red><b>IP</b></font></td>
<td algign=center><font color=red><b>Delete</b></font></td>
<?php
$sql = "SELECT *
FROM `Tracker`
GROUP BY `Screen Name`
ORDER BY Date DESC";
$query = mysql_query($sql);
while($row = mysql_fetch_array($query)) {
echo "<tr>";
echo "<td align=left><a href=/pages/includes/viewsn.php?sn=".$row['Screen Name']." target=_blank><font color=black>".$row['Screen Name']."</font></a></td>";
echo "<td align=center>".$row['Date']."</td>";
echo "<td align=center>".$row['Time']."</td>";
echo "<td align=center>".$row['IP']."</td>";
echo "<td align=center> <a href=/pages/includes/deleterow.php?row=".$row['Screen Name'].">delete</a></td>";
echo "</tr>";
}
?>
</table>Code: Select all
<?php
error_reporting(E_ALL);
$page = "stats.";
require('/home/muot/public_html/pages/login/head.php');
?>
<html>
<font face=Arial size=1>
<?
$username= "muot_track";
$password= "track";
$database= "muot_tracker";
$connection = mysql_connect('localhost',$username,$password);
mysql_select_db($database);
?>
<table border=1>
<tr>
<td align=center><font color=red><b>Screen Name</b></font></td>
<td align=center><font color=red><b>Page</b></font></td>
<td align=center><font color=red><b>Date</b></font></td>
<td align=center><font color=red><b>Time</b></font></td>
<td align=center><font color=red><b>IP</b></font></td>
<?php
$sql = "SELECT *
FROM `Tracker`
where `Screen Name` = '$sn'
ORDER BY Date DESC";
$query = mysql_query($sql);
while($row = mysql_fetch_array($query)) {
echo "<tr>";
echo "<td align=left>".$row['Screen Name']."</td>";
echo "<td align=center>".$row['Page']."</td>";
echo "<td align=center>".$row['Date']."</td>";
echo "<td align=center>".$row['Time']."</td>";
echo "<td align=center>".$row['IP']."</td>";
echo "</tr>";
}
?>
</table>Code: Select all
<?
require('/home/muot/public_html/pages/login/head.php');
$username= "muot_track";
$password= "track";
$database= "muot_tracker";
$connection = mysql_connect('localhost',$username,$password);
mysql_select_db($database);
$sql = "DELETE FROM `Tracker` WHERE `Screen Name` = '$row';";
$query = mysql_query($sql);
?>
<META HTTP-EQUIV="Refresh" CONTENT="0; URL=/visit_log.php">It worked perfect all up until today, I went to check out the stats and when I clicked the screen name to view the pages.
A blank table came up, with these errors
And when I try to delete the rows, it doesnt delete.
Notice: Undefined variable: sn in /home/muot/public_html/pages/includes/menu.php on line 8
Notice: Undefined variable: sn in /home/muot/public_html/pages/includes/menu.php on line 9
Notice: Undefined variable: sn in /home/muot/public_html/pages/includes/menu.php on line 10
Notice: Undefined variable: sn in /home/muot/public_html/pages/includes/menu.php on line 11
Notice: Undefined variable: sn in /home/muot/public_html/pages/includes/menu.php on line 12
Notice: Undefined variable: sn in /home/muot/public_html/pages/includes/viewsn.php on line 26
Also, the script stopped tracking IP addresses too.
I checked my Database and all the data besides the IP address are being recorded. I truncated the table because I thought it was too big or somthing, but the problem didnt change.
If anybody sees something wrong with this please help me.
Ive been stumped for hours. It just stopped working out of nowhere!
Thank You!