Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Crazy question
brckad
post Oct 20 2008, 06:31 PM
Post #1


Veteran
***

Group: Members
Posts: 40
Joined: 23-July 08
Member No.: 6624



Crazy question, I know. Is there a way to log the IP addresses of owner's when they log on?
Go to the top of the page
 
+Quote Post
bonscott
post Oct 21 2008, 07:30 AM
Post #2


Veteran
***

Group: Members
Posts: 4718
Joined: 22-February 04
Member No.: 31

2009 MFL: 33218


Nope. Support might have that information so you can send them a ticket.


--------------------
Scott

All Rosters code: http://sidelineleagues.com/forums/index.php?showtopic=18864
Custom CSS upload: http://sidelineleagues.com/forums/index.php?showtopic=15112

Do *NOT* look at the boxscores on nfl.com They are known to be unreliable and rarely updated. You should be looking at the GameBook for the game for the most "official" stats that are available to the public.

Also as noted live scoring on MFL is not official and often defensive stats are delayed. Once the final stats are out early Tuesday after the Monday night game then see what happens.
Go to the top of the page
 
+Quote Post
habman
post Oct 21 2008, 07:40 AM
Post #3


Veteran
***

Group: Members
Posts: 1948
Joined: 29-August 05
From: Leamington ON, Canada
Member No.: 3058

2009 MFL: 31589 , 24836


bonscot is correct in saying that there is no automatic of way of doing it but it can be done with an iframe and some php scripting.

If you have a host site that supports php I can probably come up with a script that does this for you.


--------------------
My MFL scripts . . . . . . . . http://www.habman.com/mfl/
Go to the top of the page
 
+Quote Post
brckad
post Oct 21 2008, 12:08 PM
Post #4


Veteran
***

Group: Members
Posts: 40
Joined: 23-July 08
Member No.: 6624



QUOTE (habman @ Oct 21 2008, 08:40 AM) *
bonscot is correct in saying that there is no automatic of way of doing it but it can be done with an iframe and some php scripting.

If you have a host site that supports php I can probably come up with a script that does this for you.


I have such a host. If you can come up with something like this, I would be very appreciative. Thanks again.
Go to the top of the page
 
+Quote Post
brckad
post Oct 30 2008, 03:40 PM
Post #5


Veteran
***

Group: Members
Posts: 40
Joined: 23-July 08
Member No.: 6624



bump
Go to the top of the page
 
+Quote Post
habman
post Oct 31 2008, 03:11 PM
Post #6


Veteran
***

Group: Members
Posts: 1948
Joined: 29-August 05
From: Leamington ON, Canada
Member No.: 3058

2009 MFL: 31589 , 24836


QUOTE (brckad @ Oct 30 2008, 05:40 PM) *
bump



Sorry slipped my mind.


Create a php file with the following code and name it iptracker.php

Upload the php file to your host site.

CODE
<?php

//CHANGE THE VARIABLES BELOW TO CUSTOMIZE THIS SCRIPT

$filedirectory  = "iptracker";     // You must CHMOD this directory to 777 in order to create the necessary IP file.
$filename       = "iplist";        // Name the file to whatever you like
$usercount      = 100;             // Number of recent users to track
$guestTracking  = 1;               // Track IP of guests to your site; 1=yes, 0=no
$menuPassword   = "test123";       // IP Tracker Main Menu password
$timezoneoffset = 4;               // Time from GMT ie EDT is 4; EST is 5
$idleTime       = 600;             // # of minutes that user has been idle before adding IP/User to the list again


//NO NEED TO CHANGE ANYTHING BELOW THIS LINE

$franchiseid   = $_GET["fid"];
$franchisename = $_GET["fname"];
$servertime    = $_GET["servertime"];
$password      = $_GET["password"];
$resetFile     = $_GET["resetFile"];
$verifyReset   = $_GET["verifyReset"];
$sortItem      = $_GET["sortItem"];
$sortDirection = $_GET["sortDirection"];

$currentIP     = getenv("REMOTE_ADDR");
$filedirname   = $filedirectory."/".$filename.".txt";
$fileResetDir  = $filedirectory."/".$resetFile.".txt";


?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>User IP's</title>
<style type="text/css">
   body {
     color: black;
     margin-top: 0px;
     font-size: 14px;
    }
   a:link, a:active, a:visited, a:hover {
     color: blue;
     text-decoration: none;
    }
   th {
    background-color: #C0C0C0;
   }
   table {
    border-collapse: collapse;
   }
   td,th {
    border: 1px solid black;
    padding-left: 4px;
    padding-right: 4px;
    white-space: nowrap
   }
   .eventablerow {
    background-color: #F2F2F2;
   }
   .oddtablerow {
    background-color: #E1E1E1;
   }
</style>
</head>

<body>


<?


//CHECK FOR RESETTING OF IP FILE
if (file_exists($fileResetDir)&&$password==$menuPassword) {
if($verifyReset==true) {
  unlink($fileResetDir);
  print"<br />File has been reset!<br /><br />\n";
  print"<a href='iptracker.php?password=$password' target='_top'>Return to Main Menu</a>\n";
  print"</body>\n";
  print"</html>\n";
  exit();
} else {
  print "<br />You are about to reset the IP Tracker file.<br /><br />Are you sure you want to continue? <a href='iptracker.php?password=$password&resetFile=$resetFile&verifyReset=true' target='_top'>Yes</a>/<a href='iptracker.php?password=$password' target='_top'>No</a>\n";
  print"</body>\n";
  print"</html>\n";
  exit();
}
}



if($franchiseid=="") { $franchiseid = "guest"; $franchisename = "guest"; }

$data = array();
$datacount = 0;

//GET FILE CONTENTS IF IT EXISTS
if (file_exists($filedirname)) {
  $filePointer = fopen($filedirname, "r");
  while (!feof($filePointer)) {
   $data[$datacount]['ip']    = trim(fgets($filePointer,4096));
   $data[$datacount]['fid']   = trim(fgets($filePointer,4096));
   $data[$datacount]['fname'] = trim(fgets($filePointer,4096));
   $data[$datacount]['time']  = trim(fgets($filePointer,4096));
   $datacount = $datacount + 1;
  }
  fclose($filePointer);
}


$temp = array_pop($data); //removes the last value of the array
$datacount = count($data);

//IF PASSWORD IS LEGIT THEN SHOW THE RECENT VISITORS AND EXIT
if($password==$menuPassword) { //SHOW THE RECENT VISITORS

  if($sortItem!="") {
   // Obtain a list of columns
   foreach ($data as $key => $row) {
    $_ip[$key]    = $row['ip'];
    $_fid[$key]   = $row['fid'];
    $_fname[$key] = $row['fname'];
    $_time[$key]  = $row['time'];
   }
  
   // Sort the data with volume descending, edition ascending
   // Add $data as the last parameter, to sort by the common key
   if($sortDirection=="Asc") $sortDirection = SORT_ASC; else $sortDirection = SORT_DESC;
  
   if($sortItem=="ip")    array_multisort($_ip,    $sortDirection, $data);
   if($sortItem=="fid")   array_multisort($_fid,   $sortDirection, $data);
   if($sortItem=="fname") array_multisort($_fname, $sortDirection, $data);
   if($sortItem=="time")  array_multisort($_time,  $sortDirection, $data);
  }

  print"<br />\n";
  print"<a href='iptracker.php?password=$password&resetFile=".$filename."' target='_top'>Reset List</a> | <a href='java script:location.reload(true)'>Reload this page</a><br />\n";
  print"<br />\n";
  print"<table>\n";
  print"<tr><th><a href='iptracker.php?password=$password&sortItem=ip&sortDirection=Asc' target='_top'>&uarr;</a> IP <a href='iptracker.php?password=$password&sortItem=ip&sortDirection=Desc' target='_top'>&darr;</a></th><th><a href='iptracker.php?password=$password&sortItem=fid&sortDirection=Asc' target='_top'>&uarr;</a> FID <a href='iptracker.php?password=$password&sortItem=fid&sortDirection=Desc' target='_top'>&darr;</a></th><th><a href='iptracker.php?password=$password&sortItem=fname&sortDirection=Asc' target='_top'>&uarr;</a> Name <a href='iptracker.php?password=$password&sortItem=fname&sortDirection=Desc' target='_top'>&darr;</a></th><th><a href='iptracker.php?password=$password&sortItem=time&sortDirection=Asc' target='_top'>&uarr;</a> Time <a href='iptracker.php?password=$password&sortItem=time&sortDirection=Desc' target='_top'>&darr;</a></th></tr>\n";
  for($i=0;$i<$datacount;$i++){
   $timeDisplay = gmdate('l F j Y h:i:s A',$data[$i]['time']-$timezoneoffset*60*60);
   if($i%2) { $rowcolor = "oddtablerow"; } else { $rowcolor = "eventablerow"; }
   print"<tr class='".$rowcolor."'><td><a href='http://ws.arin.net/whois/?queryinput=".$data[$i]['ip']."' target='_blank'>".$data[$i]['ip']."</a></td><td>".$data[$i]['fid']."</td><td>".$data[$i]['fname']."</td><td>".$timeDisplay."</td></tr>\n";
  }
  print"</table>\n";
  print"</body>\n";
  print"</html>\n";

  exit();
}

//IF WE HAVE REACHED THIS POINT THEN WE WANT TO ADD THE VISITOR TO THE LIST IF ALL CONDITIONS ARE MET

//CHECK IF THIS USER HAS LOGGED ON WITHIN THE LAST "IDLETIME" SECONDSS FROM THE SAME IP. IF SO THEN NO NEED TO UPDATE FILE.
$updateThisVisitor = true;
for($i=0;$i<$datacount;$i++) {
  $timedifference = $servertime - $data[$i]['time'];
  if($data[$i]['ip']==$currentIP&&$data[$i]['fid']==$franchiseid&&$timedifference<$idleTime) $updateThisVisitor = false;
}

if( ($servertime==""||$servertime==0) || !$updateThisVisitor || ($franchiseid=="guest"&&$guestTracking==0) )
$goodToGo = false;
else
$goodToGo = true;


if($goodToGo) { // UPDATE FILE
  $filePointer = fopen($filedirname, "w");
  print"writing new ".$currentIP." ".$franchiseid." ".$franchisename." ".$servertime."<br />";
  fwrite($filePointer, "$currentIP\n");
  fwrite($filePointer, "$franchiseid\n");
  fwrite($filePointer, "$franchisename\n");
  fwrite($filePointer, "$servertime\n");
  if($datacount > $usercount) $datacount = $usercount;
  for($i=0;$i<$datacount;$i++) {
   fwrite($filePointer, $data[$i]['ip']."\n");
   fwrite($filePointer, $data[$i]['fid']."\n");
   fwrite($filePointer, $data[$i]['fname']."\n");
   fwrite($filePointer, $data[$i]['time']."\n");
  }
  fclose($filePointer);
  print"<br />IP Tracker file has been updated.\n";
  print"</body>\n";
  print"</html>\n";
} else { // ASK FOR PASSWORD
  print"<br />\n";
  print"<form action='iptracker.php' method='get'>\n";
  if($password!=""&&$password!=$menuPassword) print"Password is incorrect. Try again.<br /><br />";
  print"Enter Password: <input type='textbox' name='password' />\n";
  print"<input type='submit' value='Submit' />\n";
  print"</form>\n";
  print"</body>\n";
  print"</html>\n";
}


?>



Now in a home page module being used as the footer add this code.

CODE
<script language="Javascript" type="text/javascript">
<!--
if(franchise_id==undefined){
  var ipTrackerId = "guest";
  var ipTrackerName = "guest";
} else {
  var ipTrackerId = franchise_id;
  var ipTrackerName = franchiseDatabase['fid_'+franchise_id].name;
}

document.write("<iframe src='http://www.yourhost.com/iptracker.php?fid="+ipTrackerId+"&amp;fname="+ipTrackerName+"&amp;servertime="+currentServerTime+"' height='0' width='0' frameborder='0'></iframe>");

// -->
</script>

Replace www.yourhost.com with your hosting site.



A few notes.

In the php script there are variables near the top that you can set as needed. The variables should be self-explanatory but if you are unsure then just ask.

One of the variables defines a subdirectory to placed in the directory where the script is located and you need to CHMOD the directory to 777 so that it can be written to by the script.

You should change the password so that only you can access the file if you want it to be private.

To view your sites visitors all you need to do is access the script ie www.yourhost.com/iptracker.php and it will ask for the password





Let me know of any issues.


--------------------
My MFL scripts . . . . . . . . http://www.habman.com/mfl/
Go to the top of the page
 
+Quote Post
brckad
post Oct 31 2008, 04:35 PM
Post #7


Veteran
***

Group: Members
Posts: 40
Joined: 23-July 08
Member No.: 6624





You are absolutely money! Thanks so much. Got it working now!
Go to the top of the page
 
+Quote Post
habman
post Oct 31 2008, 11:57 PM
Post #8


Veteran
***

Group: Members
Posts: 1948
Joined: 29-August 05
From: Leamington ON, Canada
Member No.: 3058

2009 MFL: 31589 , 24836


Thanks brckad.


BTW I have updated the php script to make it sortable by column header when you are viewing the visitors and the IP's clickable to an ARIN database.


--------------------
My MFL scripts . . . . . . . . http://www.habman.com/mfl/
Go to the top of the page
 
+Quote Post
brckad
post Nov 1 2008, 12:19 PM
Post #9


Veteran
***

Group: Members
Posts: 40
Joined: 23-July 08
Member No.: 6624



QUOTE (habman @ Nov 1 2008, 12:57 AM) *
Thanks brckad.


BTW I have updated the php script to make it sortable by column header when you are viewing the visitors and the IP's clickable to an ARIN database.


NICE additions. Works perfectly.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version Time is now: 3rd September 2010 - 11:39 PM