Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Modules
Author Message
Zores
New Member
New Member



Joined: Feb 18, 2006
Posts: 5

PostPosted: Sat Feb 18, 2006 7:54 pm Reply with quote

Hello,

I have been using Ip Tracking 3.5 Module by Scott Rubin downloaded off this site on Phpnuke 7.8 unpatched and it worked fine.

Recently, I was made aware of the security flaws in the standard vanilla phpnuke and switched from Phpnuke 7.8 to Raven76. I like this distribution very much however I have come upon a slight problem that needs fixing.

The IP Tracking module under RavenNuke76, no longer shows who is online when I access the logging page. But it works fine for me on my old install of PhpNuke 7.8. How do I fix this? Did I make an oversight somewhere? Help would be much appreciated thanks.
 
View user's profile Send private message
Guardian2003
Site Admin



Joined: Aug 28, 2003
Posts: 6799
Location: Ha Noi, Viet Nam

PostPosted: Sun Feb 19, 2006 2:27 am Reply with quote

Doesn't this module need an 'include' statement in mainfile so it logs the tracked IP's ?
Did you re add that include statement?
 
View user's profile Send private message Send e-mail
Zores







PostPosted: Sun Feb 19, 2006 1:54 pm Reply with quote

Code:
<?php


/************************************************************************/
/* PHP-NUKE: Web Portal System                                          */
/* ===========================                                          */
/*                                                                      */
/* Copyright (c) 2002 by Francisco Burzi                                */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* Enhanced with NukeStats Module Version 1.0                           */
/* ==========================================                           */
/* Copyright ©2002 by Harry Mangindaan (sens@indosat.net) and           */
/*                    Sudirman (sudirman@akademika.net)                 */
/* http://www.nuketest.com                                              */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/

if (stristr($_SERVER['PHP_SELF'], "counter.php")) {
    Header("Location: index.php");
    die();
}
global $prefix, $db;

/* Get the Browser data */

if ((ereg("Nav", $_SERVER['HTTP_USER_AGENT'])) || (ereg("Gold", $_SERVER['HTTP_USER_AGENT'])) || (ereg("X11", $_SERVER['HTTP_USER_AGENT'])) || (ereg("Mozilla", $_SERVER['HTTP_USER_AGENT'])) || (ereg("Netscape", $_SERVER['HTTP_USER_AGENT'])) AND (!ereg("MSIE", $_SERVER['HTTP_USER_AGENT'])) AND (!ereg("Konqueror", $_SERVER['HTTP_USER_AGENT'])) AND (!ereg("Yahoo", $_SERVER['HTTP_USER_AGENT'])) AND (!ereg("Firefox", $_SERVER['HTTP_USER_AGENT']))) $browser = "Netscape";
elseif(ereg("Firefox", $_SERVER['HTTP_USER_AGENT'])) $browser = "FireFox";
elseif(ereg("MSIE", $_SERVER['HTTP_USER_AGENT'])) $browser = "MSIE";
elseif(ereg("Lynx", $_SERVER['HTTP_USER_AGENT'])) $browser = "Lynx";
elseif(ereg("Opera", $_SERVER['HTTP_USER_AGENT'])) $browser = "Opera";
elseif(ereg("WebTV", $_SERVER['HTTP_USER_AGENT'])) $browser = "WebTV";
elseif(ereg("Konqueror", $_SERVER['HTTP_USER_AGENT'])) $browser = "Konqueror";
elseif((eregi("bot", $_SERVER['HTTP_USER_AGENT'])) || (ereg("Google", $_SERVER['HTTP_USER_AGENT'])) || (ereg("Slurp", $_SERVER['HTTP_USER_AGENT'])) || (ereg("Scooter", $_SERVER['HTTP_USER_AGENT'])) || (eregi("Spider", $_SERVER['HTTP_USER_AGENT'])) || (eregi("Infoseek", $_SERVER['HTTP_USER_AGENT']))) $browser = "Bot";
else $browser = "Other";

/* Get the Operating System data */

if(ereg("Win", $_SERVER['HTTP_USER_AGENT'])) $os = "Windows";
elseif((ereg("Mac", $_SERVER['HTTP_USER_AGENT'])) || (ereg("PPC", $_SERVER['HTTP_USER_AGENT']))) $os = "Mac";
elseif(ereg("Linux", $_SERVER['HTTP_USER_AGENT'])) $os = "Linux";
elseif(ereg("FreeBSD", $_SERVER['HTTP_USER_AGENT'])) $os = "FreeBSD";
elseif(ereg("SunOS", $_SERVER['HTTP_USER_AGENT'])) $os = "SunOS";
elseif(ereg("IRIX", $_SERVER['HTTP_USER_AGENT'])) $os = "IRIX";
elseif(ereg("BeOS", $_SERVER['HTTP_USER_AGENT'])) $os = "BeOS";
elseif(ereg("OS/2", $_SERVER['HTTP_USER_AGENT'])) $os = "OS/2";
elseif(ereg("AIX", $_SERVER['HTTP_USER_AGENT'])) $os = "AIX";
else $os = "Other";

/* Save on the databases the obtained values */

$db->sql_query("UPDATE ".$prefix."_counter SET count=count+1 WHERE (type='total' AND var='hits') OR (var='$browser' AND type='browser') OR (var='$os' AND type='os')");
update_points(13);

/* Start Detailed Statistics */

$dot = date("d-m-Y-H");
$now = explode ("-",$dot);
$nowHour = $now[3];
$nowYear = $now[2];
$nowMonth = $now[1];
$nowDate = $now[0];
$sql = "SELECT year FROM ".$prefix."_stats_year WHERE year='$nowYear'";
$resultyear = $db->sql_query($sql);
$jml = $db->sql_numrows($resultyear);
if ($jml <= 0) {
    $sql = "INSERT INTO ".$prefix."_stats_year VALUES ('$nowYear','0')";
    $db->sql_query($sql);
    for ($i=1;$i<=12;$i++) {
   $db->sql_query("INSERT INTO ".$prefix."_stats_month VALUES ('$nowYear','$i','0')");
   if ($i == 1) $TotalDay = 31;
   if ($i == 2) {
       if (date("L") == true) {
      $TotalDay = 29;
       } else {
      $TotalDay = 28;
       }
   }
   if ($i == 3) $TotalDay = 31;
   if ($i == 4) $TotalDay = 30;
   if ($i == 5) $TotalDay = 31;
   if ($i == 6) $TotalDay = 30;
   if ($i == 7) $TotalDay = 31;
   if ($i == 8) $TotalDay = 31;
   if ($i == 9) $TotalDay = 30;
   if ($i == 10) $TotalDay = 31;
   if ($i == 11) $TotalDay = 30;
   if ($i == 12) $TotalDay = 31;
   for ($k=1;$k<=$TotalDay;$k++) {
       $db->sql_query("INSERT INTO ".$prefix."_stats_date VALUES ('$nowYear','$i','$k','0')");
   }
    }
}

$sql = "SELECT hour FROM ".$prefix."_stats_hour WHERE (year='$nowYear') AND (month='$nowMonth') AND (date='$nowDate')";
$result = $db->sql_query($sql);
$numrows = $db->sql_numrows($result);

if ($numrows <= 0) {
    for ($z = 0;$z<=23;$z++) {
   $db->sql_query("INSERT INTO ".$prefix."_stats_hour VALUES ('$nowYear','$nowMonth','$nowDate','$z','0')");
    }
}

$db->sql_query("UPDATE ".$prefix."_stats_year SET hits=hits+1 WHERE year='$nowYear'");
$db->sql_query("UPDATE ".$prefix."_stats_month SET hits=hits+1 WHERE (year='$nowYear') AND (month='$nowMonth')");
$db->sql_query("UPDATE ".$prefix."_stats_date SET hits=hits+1 WHERE (year='$nowYear') AND (month='$nowMonth') AND (date='$nowDate')");
$db->sql_query("UPDATE ".$prefix."_stats_hour SET hits=hits+1 WHERE (year='$nowYear') AND (month='$nowMonth') AND (date='$nowDate') AND (hour='$nowHour')");
include_once("modules/IP_Tracking/iptracking.php");
?>


Yes, the module requires the include statement. I double check and here is how I added the line that is required. It picks up hits and pages viewed but, it doesn't show the who is "Online?" part. I'm not sure how to go about the approach to fixing it.

Image

Here is a picture to show what I mean. As you can see, it logs the IPs fine but does not show who is online.
 
Zores







PostPosted: Mon Feb 20, 2006 4:41 pm Reply with quote

Another update

I've thought about the problem perhaps being that something in th phpnuke files is registering everyone as administrators so that it is not picking up who is online. I could be totally wrong though as I am not a programmer I don't really know.
 
Guardian2003







PostPosted: Mon Feb 20, 2006 6:45 pm Reply with quote

Something isnt right - look at the bottom right hand of the image. The copyright tag is repeated twice and it shouldn't.
Can you post link to where you downloaded this from. I'm short of time now as its nearly 1am here but I can try and take a look tomorrow for you.
 
Zores







PostPosted: Mon Feb 20, 2006 6:56 pm Reply with quote

Hmmm, well thanks for that Guardian.

I got the script from this site at this URL.
[ Only registered users can see links on this board! Get registered or login! ]

I've tried deleteing everything and reinstalling it and I still get the same thing, it's odd.
 
Guardian2003







PostPosted: Mon Feb 20, 2006 7:55 pm Reply with quote

It is working fine for me.
Check your settings in ipconfig.php - it may be that it is simply a case of the text font that says 'Yes' when a user is online is the same colour as the background colour and thats why you dont see it.

Or it may be quicker to temporarly view it using a different theme.
 
Zores







PostPosted: Tue Feb 21, 2006 4:04 am Reply with quote

Image

tried another theme and highlighted the text to make sure, still nothing there

Code:
<?php


#############################################################################################
# IP Tracking Configuration                                                                 #
#                                                                                           #
# Copyright (c) 2003 by Scott Rubin - phpnuke id: scottr                                    #
#                                                                                           #
# $trackip:            Activate IP Tracking?                                (1=Yes 0=No)    #
# $ipmax:              How Many IP Tracking Records Do You Want As A Maximum?               #
# $ipdel:              Delete How Many IP Tracking Records When Maximum Reached?            #
# $numip:              Display How Many IP Tracking Records Per Page?                       #
# $hide_ipseg[1]:      Hide First Segment of the IP Address?                (1=Yes 0=No)    #
# $hide_ipseg[2]:      Hide Second Segment of the IP Address?               (1=Yes 0=No)    #
# $hide_ipseg[3]:      Hide Third Segment of the IP Address?                (1=Yes 0=No)    #
# $hide_ipseg[4]:      Hide Fourth Segment of the IP Address?               (1=Yes 0=No)    #
# $hide_host:          Hide Hostname?                                       (1=Yes 0=No)    #
# $ipmaskchar:         IP Address Masking Character                                         #
# $exclude_ips:        Comma separated list of quoted IP Addresses to exclude               #
# $exclude_hosts:      Comma separated list of quoted Hostnames to exclude                  #
# $members_see_iphost: Ignore Hiding IP segments and Hostnames for Members? (1=Yes 0=No)    #
# $members_see_users:  Let Members see User Names?                          (1=Yes 0=No)    #
# $show_hits:          0=show everyone, 1=only show member hits, 2=only show anonymous hits #
# $offset_hours:       Number of hours offset from Server Time                              #
# $gridcolor:          Color of IP Tracking table grid (default to $bgcolor2)               #
# $members_see_online: Let Members see who is Online?                       (1=Yes 0=No)    #
# $admin_see_online:   Let Admin see who is Online?                         (1=Yes 0=No)    #
# $updown_arrows:      Show Up/Down arrows for ascending/descending sorting (1=Yes 0=No)    #
#                                                                                           #
# Wildcard Characters (*) allowed for $exclude_ips or $exclude_hosts                        #
#                                                                                           #
# NOTE: If you hide IP Address segments but don't hide host,                                #
#       anyone can easily get the IP Address from the host name.                            #
#############################################################################################

#############################################################################################
#
# C O N F I G U R A T I O N   S E C T I O N
#
# NOTE: Admin will always see IP Address / Host information
#
global $bgcolor2, $gridcolor, $updown_arrows;

$trackip = 1;
$ipmax = 1000000;
$ipdel = 1000;
$numip = 100;
$hide_ipseg[1] = 0;
$hide_ipseg[2] = 0;
$hide_ipseg[3] = 0;
$hide_ipseg[4] = 0;
$hide_host = 0;
$ipmaskchar = "x";
$members_see_iphost = 1;
$members_see_users = 1;
$show_hits = 0;
$offset_hours = 0;
$gridcolor = "$bgcolor2";
$members_see_online = 0;
$admin_see_online = 1;
$updown_arrows = 1;

$exclude_ips = array(); # quoted IP comma separated list, wildcards ok
# example: $exclude_ips = array('127.0.0.1', '68.69.+');

$exclude_hosts = array(); # quoted Hostname comma separated list, wildcards ok
# example: $exclude_hosts = array('swbcs007.sbc.com', '.+avantgo.com');

# need regular expression help ???
# try http://www.php.net/manual/en/ref.regex.php for starters
# please don't ask me about regular expressions, here's some popular ones
# n?      Zero or only one single occurrence of character 'n'
# n*      Zero or more occurrences of character 'n'
# n+      At least one or more occurrences of character 'n'
# ^abc       String starting with the characters 'abc'
# xyz$       String ending with the characters 'xyz'
# NOTE: sometimes you really mean + when you write *
# NOTE: for IP beginning 68.12 then use '^68.12'
# NOTE: for IP containing 68.69 then use '68.69'
# NOTE: for IP beginning 68.69. then use '^68.69.+'
#
#############################################################################################

?>


Hmm, I'll try reinstalling again. It should work if you're using the same ravennuke.
 
Guardian2003







PostPosted: Tue Feb 21, 2006 5:26 am Reply with quote

Yes it should.
All I did was copy the file across to the modules directory, loaded the sql file into phpmyadmin and ran it then added the include for includes/counter.php (the other one is already there.
You can see it working here [ Only registered users can see links on this board! Get registered or login! ]
 
mokee
New Member
New Member



Joined: May 03, 2004
Posts: 14

PostPosted: Sun Apr 16, 2006 3:14 pm Reply with quote

Strange.

I am getting the exact same errors.

The copyright tag is repeated twice, and there isn't any who is online showing up.

I have the IP Address and the Host Name, but no who is online showing up.

Weird. I have re-installed it twice, but it is about as simple a script as they come, installation wise and I don't know what else to try.

I will try it on a different site.

Moke
 
View user's profile Send private message
Guardian2003







PostPosted: Sun Apr 16, 2006 3:22 pm Reply with quote

Hmm actually the site it is currently installed in is V1.x of RavenNuke not V2.x
I'll do a fresh install on the latest release and see what happens.
 
t_henson
Regular
Regular



Joined: Feb 02, 2007
Posts: 65
Location: Cincinnati, Ohio

PostPosted: Thu Mar 15, 2007 12:35 pm Reply with quote

i know this is an old thread, but is there any update on this? i use this too and it shows absolutely no info at all for me. it use to a few months ago, and then just stopped working. just now trying to fix it though lol.
 
View user's profile Send private message
jakec
Site Admin



Joined: Feb 06, 2006
Posts: 3048
Location: United Kingdom

PostPosted: Thu Mar 15, 2007 2:37 pm Reply with quote

If you are using Sentinel, you could just uninstall the ip tracking mod and use the ip tracking features in Sentinel.

Sorry, probably not the answer you were looking for.
 
View user's profile Send private message
2Bob
Hangin' Around



Joined: Jan 24, 2006
Posts: 25

PostPosted: Tue Apr 10, 2007 8:37 pm Reply with quote

hmm, I have EXACTLY the same problem since upgrading to rn2.10

Exactly... No "yes" for users online and the same "double" copyright tag Sad

I know sentinal also tracks IPs , BUT i like this view.

Any PHP / nuke guru's have any ideas?
 
View user's profile Send private message
Doulos
Life Cycles Becoming CPU Cycles



Joined: Jun 06, 2005
Posts: 732

PostPosted: Tue Apr 10, 2007 9:09 pm Reply with quote

I am getting the double copyright, however, iptracking is working fine for me. (using rn210 upgraded from rn20202)
 
View user's profile Send private message
2Bob







PostPosted: Tue Apr 10, 2007 9:19 pm Reply with quote

Ezekiel
Thanks for the comment Smile

I guess what I'm hopeing for is someone that understands php well enough to look at the file and maybe explain how where it draws that "YES" for online from, and then maybe we can deduce why it isn't on my site and apparently on others also.
 
Doulos







PostPosted: Tue Apr 10, 2007 9:47 pm Reply with quote

?? I'm an idiot. I guess I should read the posts better. Iptracking mod works fine but does NOT show if the user is online.

Sorry.
 
2Bob







PostPosted: Thu Apr 12, 2007 1:44 am Reply with quote

Ezekiel

Yes it would seem to be working, that is: it does track the IP and display the detail, but with with two bugs:

1) It no longer shows a "YES" in the ONLINE cell.
2) The copyright displays twice.

It would be great to work out why these two bugs happen, I had it working 100% in rn2.02 , only since upgradeing to 2.10 has it faulted.
 
Mithoron
Hangin' Around



Joined: May 05, 2003
Posts: 34

PostPosted: Mon Apr 30, 2007 4:44 pm Reply with quote

Getting the same issue here...so people aren't alone, LOL...
 
View user's profile Send private message
Doulos







PostPosted: Thu Sep 17, 2009 5:47 pm Reply with quote

I am by no means versed in php, but this worked for me. To get rid of the double copyright open modules/IP_Tracking/index.php. The following code shows up twice. Just delete BOTH instances of this code and the copyright will only show up once.
Code:
   # this is automatic for 6.0+

   if($Version_Num < 6.0) {
      echo "<div align=\"right\"><a href=\"javascript:IPTrack_openwindow()\">IP Tracking &copy;</a></div>";
      echo "<script type=\"text/javascript\">\n";
      echo "<!--\n";
      echo "function IPTrack_openwindow(){\n";
      echo "   window.open (\"modules/IP_Tracking/copyright.php\",\"Copyright\",\"toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,copyhistory=no,width=400,height=200\");\n";
      echo "}\n";
      echo "//-->\n";
      echo "</SCRIPT>\n\n";
   }


OR replace the whole file with..
Code:
<?php


echo "<!-- IP Tracking Module v3.5 for PHP-Nuke -->\n";
echo "<!-- Copyright (c) 2003 by Scott Rubin -->\n";
echo "<!-- phpnuke id: scottr -->\n\n";

if (!eregi("modules.php", $_SERVER['PHP_SELF'])) {
    die ("You can't access this file directly...");
}

require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
get_lang($module_name);
$pagetitle = "- "._IPTRACKING."";
if(is_user($user)) {
    if($cookie[9]=="") $cookie[9]=$Default_Theme;
    if(!$file=@opendir("themes/$cookie[9]")) {
   $ThemeSel = $Default_Theme;
    } else {
   $ThemeSel = $cookie[9];
    }
} else {
    $ThemeSel = $Default_Theme;
}

$now = date("d-m-Y");
$dot = explode ("-",$now);
$nowdate = $dot[0];
$nowmonth = $dot[1];
$nowyear = $dot[2];

function IPTrack_IPTrack() {
    global $hlpfile, $nowyear, $nowmonth, $nowdate, $nowhour, $sitename, $startdate;
   global $prefix, $db, $now, $numip, $pagenum, $show_hits, $Version_Num, $showmodule;
    $sql = "SELECT count FROM ".$prefix."_counter ORDER BY type DESC";
    $result = $db->sql_query($sql);
    list($total) = $db->sql_fetchrow($result);
    include ("header.php");
    title("$sitename "._IPTRACKING."");
    OpenTable();
    OpenTable();
    echo "<center><font class=\"option\"><b>$sitename "._IPTRACKING."</b></font><br>";
   echo "<br>"._WERECEIVED." <b>$total</b> "._PAGESVIEWS." $startdate<br>"._TODAYIS.": $now[1]/$now[0]/$now[2]<br><br>";
    echo "</center>";
    CloseTable();
    echo "<br><br>";
    IPTrack_showIPStats();
    echo "<br><br>";
    CloseTable();
   if($show_hits==1) {
       $filter="WHERE username IS NOT NULL";
   } elseif($show_hits==2) {
       $filter="WHERE username IS NULL";
   } else {
       $filter="WHERE 1=1";
   }
   if (ereg("All.*Modules", $showmodule) || !$showmodule ) {
       $modfilter="";
   } else {
       $modfilter=" AND page LIKE '%name=$showmodule%'";
   }
    $sql = "SELECT username, ip_address, hostname, MAX(date_time), COUNT(*) "
           ."FROM ".$prefix."_iptracking $filter $modfilter GROUP BY 1,2,3";
    $res = $db->sql_query($sql);
    $numips = $db->sql_numrows($res);

    $sql = "SELECT * FROM ".$prefix."_iptracking WHERE 1=1 $modfilter";
    $res = $db->sql_query($sql);
    $numhits = $db->sql_numrows($res);

    $numpages = ceil($numips / $numip);
    if ($numpages > 1) {
      echo "<br>";
      OpenTable();
      echo "<center>";
      echo "$numips "._IPADDRESSES." ($numhits "._HITS.", $numpages "._PAGES.", $numip "._PERPAGE.")<br>" ;
      # START Left Arrow
      if ($pagenum > 1) {
         $prevpage = $pagenum - 1 ;
         if(file_exists("images/download/left.gif")) {
            $leftarrow = "images/download/left.gif" ;  # 5.x
         } else {
            $leftarrow = "images/left.gif" ;           # 6.x+
         }
         if (ereg("All.*Modules", $showmodule) || !$showmodule ) {
            echo "<a href=\"modules.php?name=IP_Tracking&amp;pagenum=$prevpage\">";
         } else {
            echo "<a href=\"modules.php?name=IP_Tracking&amp;showmodule=$showmodule&amp;pagenum=$prevpage\">";
         }
         echo "<img src=\"$leftarrow\" align=\"absmiddle\" border=\"0\" hspace=\"10\"></a>";
      }
      # END Left Arrow
      # START Page Numbers
      echo "[ " ;
      for ($i=1; $i < $numpages+1; $i++) {
         if ($i == $pagenum) {
            echo "$i";
         } else {
            if (ereg("All.*Modules", $showmodule) || !$showmodule ) {
               echo "<a href=\"modules.php?name=IP_Tracking&amp;pagenum=$i\">$i</a>";
            } else {
               echo "<a href=\"modules.php?name=IP_Tracking&amp;showmodule=$showmodule&amp;pagenum=$i\">$i</a>";
            }
         }
         if ($i < $numpages) { echo " | "; } else { echo " ]"; }
      }
      # END Page Numbers
      # START Right Arrow
      if ($pagenum < $numpages) {
         $nextpage = $pagenum + 1 ;
         if(file_exists("images/download/right.gif")) {
            $rightarrow = "images/download/right.gif" ;  # 5.x
         } else {
            $rightarrow = "images/right.gif" ;           # 6.x+
         }
         if (ereg("All.*Modules", $showmodule) || !$showmodule ) {
            echo "<a href=\"modules.php?name=IP_Tracking&amp;pagenum=$nextpage\">";
         } else {
            echo "<a href=\"modules.php?name=IP_Tracking&amp;showmodule=$showmodule&amp;pagenum=$nextpage\">";
         }
         echo "<img src=\"$rightarrow\" align=\"absmiddle\" border=\"0\" hspace=\"10\"></a>";
      }
      # END Right Arrow
      echo "</center>";
      CloseTable();
   }

   include ("footer.php");
}

function IPTrack_showIPStats(){
    global $admin, $prefix, $bgcolor1, $bgcolor2, $db, $ThemeSel;
   global $trackip, $numip, $pagenum, $hide_ipseg, $hide_host, $members_see_iphost, $ipmaskchar, $user, $orderby, $orderdir;
   global $show_hits, $members_see_users, $Version_Num, $gridcolor, $members_see_online, $admin_see_online, $updown_arrows, $showmodule;
    $l_size = getimagesize("themes/$ThemeSel/images/leftbar.gif");
    $m_size = getimagesize("themes/$ThemeSel/images/mainbar.gif");
    $r_size = getimagesize("themes/$ThemeSel/images/rightbar.gif");
    if ($numip == "") { $numip = 100 ; } # Default 100 per page
    if ($pagenum == "") { $pagenum = 1 ; }
    if ($trackip == 1) {
      $actip = _ACTIVATED;
    } else {
      $actip = _NOTACTIVATED;
    }
    echo "<center><b>"._IPTRACKINGINFO." - $actip"."</center></b><br>";

   # START Modules
    $content = "<center>";
    $content .= "<table cellspacing=\"10\"><tr><td><form action=\"index.php\" method=\"get\">";
   $content .= "<select name=\"module\" onChange=\"top.location.href=this.options[this.selectedIndex].value\">";
   $handle=opendir('modules');
   while ($file = readdir($handle)) {
      if ( (!ereg("^[.]",$file)) && !ereg("html$", $file) ) {
         $moduleslist .= "$file ";
      }
   }
   closedir($handle);
   $moduleslist .= "&nbsp;All&nbsp;Modules";
   $moduleslist = explode(" ", $moduleslist);
   sort($moduleslist);
   for ($i=0; $i < sizeof($moduleslist); $i++) {
      if($moduleslist[$i]!="") {
         $content .= "<option value=\"modules.php?name=IP_Tracking&amp;showmodule=$moduleslist[$i]\" ";
         if($showmodule==$moduleslist[$i]) $content .= " selected";
         $content .= ">".$moduleslist[$i]."</option>\n";
      }
   }
   $content .= "</select></td><td><font class=\"option\">";

   # Pulldown Menu pop-up help screen
   $content .= "<div align=\"right\"><a href=\"javascript:IPTrack_openHelp1Win()\">?</a></div>";
   $content .= "<script type=\"text/javascript\">\n";
   $content .= "<!--\n";
   $content .= "function IPTrack_openHelp1Win(){\n";
   $content .= "window.open (\"modules/IP_Tracking/help1.php\",\"Information\",\"toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,copyhistory=no,width=500,height=200\");\n";
   $content .= "}\n";
   $content .= "//-->\n";
   $content .= "</SCRIPT>\n\n";

   $content .= "</font></td></tr></table></form></center>";

   echo $content;
   # END Modules

    echo "<table align=\"center\" bgcolor=\"$gridcolor\" cellspacing=\"1\" cellpadding=\"3\" border=\"0\"><tr>";
   # Online?
   if ((is_admin($admin) and $admin_see_online) or (is_user($user) and $members_see_online)) {
      echo "<td bgcolor=\"$bgcolor2\" nowrap>"._ONLINE."?</td>";
   }
   # End Online?
   #START allow sorting by any column
   if ($updown_arrows) {
      $asc="<img src=\"images/up.gif\" border=\"0\">";
      $desc="<img src=\"images/down.gif\" border=\"0\">";
      $sep="";
   } else {
      $asc="A";
      $desc="D";
      $sep="/";
   }
   if(is_admin($admin) or (is_user($user) and $members_see_users)) {
      echo "<td bgcolor=\"$bgcolor2\" nowrap>"._USER;
      echo " <a href=\"modules.php?name=IP_Tracking&amp;orderby=1&amp;orderdir=asc\">$asc</a>$sep";
      echo  "<a href=\"modules.php?name=IP_Tracking&amp;orderby=1&amp;orderdir=desc\">$desc</a></td>";
   }
    echo "<td bgcolor=\"$bgcolor2\" nowrap>"._IPADDRESS;
   echo " <a href=\"modules.php?name=IP_Tracking&amp;orderby=2&amp;orderdir=asc\">$asc</a>$sep";
   echo  "<a href=\"modules.php?name=IP_Tracking&amp;orderby=2&amp;orderdir=desc\">$desc</a></td>";
   if(is_admin($admin) or !$hide_host or (is_user($user) and $members_see_iphost)) {
      echo "<td bgcolor=\"$bgcolor2\" nowrap>"._HOSTNAME;
      echo " <a href=\"modules.php?name=IP_Tracking&amp;orderby=3&amp;orderdir=asc\">$asc</a>$sep";
      echo  "<a href=\"modules.php?name=IP_Tracking&amp;orderby=3&amp;orderdir=desc\">$desc</a></td>";
   }
    echo "<td bgcolor=\"$bgcolor2\" nowrap>"._LASTVIEWED;
   echo " <a href=\"modules.php?name=IP_Tracking&amp;orderby=4&amp;orderdir=asc\">$asc</a>$sep";
   echo  "<a href=\"modules.php?name=IP_Tracking&amp;orderby=4&amp;orderdir=desc\">$desc</a></td>";
    echo "<td bgcolor=\"$bgcolor2\" nowrap>"._HITS;
   echo " <a href=\"modules.php?name=IP_Tracking&amp;orderby=5&amp;orderdir=asc\">$asc</a>$sep";
   echo  "<a href=\"modules.php?name=IP_Tracking&amp;orderby=5&amp;orderdir=desc\">$desc</a></td></tr>";
   # default values if none set
   if(!$orderby) $orderby="4";
   if(!$orderdir) $orderdir="DESC";
   #END allow sorting by any column
   $offset = ($pagenum-1) * $numip ;
   if($show_hits==1) {
       $filter="WHERE username IS NOT NULL";
   } elseif($show_hits==2) {
       $filter="WHERE username IS NULL";
   } else {
       $filter="WHERE 1=1";
   }
   if (ereg("All.*Modules", $showmodule) || !$showmodule ) {
       $modfilter="";
   } else {
       $modfilter=" AND page LIKE '%name=$showmodule%'";
   }
   # if multiple Users share same IP Address, then you'll see multiple identical IP Addresses when not displaying User, that's ok.
   #
   # now that we can select a module, the number of hits will represent hits to the selected module
   # even though drilling down to display the page views will show all the hits by that IP Address.
    $sql = "SELECT username, ip_address, hostname, MAX(date_time), COUNT(*), MIN(ipid) FROM ".$prefix."_iptracking "
         ."$filter $modfilter GROUP BY 1,2,3 ORDER BY $orderby $orderdir LIMIT $offset, $numip";
    $result = $db->sql_query($sql);
    while (list($username,$ipaddr,$hostnm,$lastview,$hits,$ipid) = $db->sql_fetchrow($result)){
      if(!is_admin($admin) and !(is_user($user) and $members_see_iphost)) $ipaddr = IPTrack_mask_ip($ipaddr);
      echo "<tr bgcolor=\"$bgcolor1\">";
      # Online?
      # Note: admins won't appear Online since they are not entered in the nuke_session table.
      if ((is_admin($admin) and $admin_see_online) or (is_user($user) and $members_see_online)) {

         if($Version_Num >= 6.5) { # nuke_session.username became nuke_session.uname in Nuke 6.5
            # check if this registered user is online
            $sql = "SELECT * FROM ".$prefix."_session WHERE uname='$username' AND host_addr='$ipaddr'";
            $res = $db->sql_query($sql);

            # check if this anonymous user is online
            $sql2 = "SELECT * FROM ".$prefix."_session WHERE host_addr='$ipaddr' AND host_addr=uname";
            $res2 = $db->sql_query($sql2);
         } else {
            # check if this registered user is online
            $sql = "SELECT * FROM ".$prefix."_session WHERE username='$username' AND host_addr='$ipaddr'";
            $res = $db->sql_query($sql);

            # check if this anonymous user is online
            $sql2 = "SELECT * FROM ".$prefix."_session WHERE host_addr='$ipaddr' AND host_addr=username";
            $res2 = $db->sql_query($sql2);
         }

         if ($db->sql_numrows($res) > 0 or ($db->sql_numrows($res2) > 0 and $username=='')) {
           echo "<td align=\"center\">"._YES."</td>";
         } else {
           echo "<td>&nbsp;</td>";
         }
      }
      # END Online?
      if(is_admin($admin) or (is_user($user) and $members_see_users)) {
         if($username != ""){
            if($Version_Num >= 6.5) {
               $sql2 = "SELECT user_id FROM ".$prefix."_users WHERE username='$username'";
               $result2 = $db->sql_query($sql2);
               list($u) = $db->sql_fetchrow($result2);
               if($u != "") {
                  echo "<td><a href=\"forums.html?amp;file=profile&amp;mode=viewprofile&amp;u=$u\">$username</a></td>";
               } else {
                  echo "<td>$username</td>"; # additional admins aren't in nuke_users so don't make a link
               }
            } else {
               echo "<td><a href=\"modules.php?name=Your_Account&amp;op=userinfo&amp;uname=$username\">$username</a></td>";
            }
         } else {
            echo "<td>&nbsp;</td>";
         }
      }
      echo "<td><a href=\"modules.php?name=IP_Tracking&amp;op=PagesViewed&amp;ipid=$ipid\">$ipaddr</a></td>";
      if(is_admin($admin) or !$hide_host or (is_user($user) and $members_see_iphost)) echo "<td>$hostnm</td>";
      echo "<td>$lastview</td><td align=\"center\">$hits</td></tr>";
    }
    $db->sql_freeresult($result);
    echo "</table>";
}

function IPTrack_PagesViewed() {
    global $hlpfile,$nowyear,$nowmonth,$nowdate,$nowhour, $sitename, $startdate, $prefix, $db, $now, $ipid, $numip, $pagenum, $Version_Num;
    $sql = "SELECT count FROM ".$prefix."_counter ORDER BY type DESC";
    $result = $db->sql_query($sql);
    list($total) = $db->sql_fetchrow($result);
    include ("header.php");
    title("$sitename "._IPTRACKING."");
    OpenTable();
    OpenTable();
    echo "<center><font class=\"option\"><b>$sitename "._IPTRACKING."</b></font><br>";
   echo "<br>"._WERECEIVED." <b>$total</b> "._PAGESVIEWS." $startdate<br>"._TODAYIS.": $now[1]/$now[0]/$now[2]<br><br>";
    echo "</center>";
    CloseTable();
    echo "<br><br>";
    IPTrack_showPageStats();
    echo "<br><br><center>"._GOBACK."</center><br><br>";
    CloseTable();

   $ipid=intval($ipid);
   $sql = "SELECT ip_address FROM ".$prefix."_iptracking WHERE ipid='$ipid'";
   $result = $db->sql_query($sql);
    list($ip_address) = $db->sql_fetchrow($result);

    $sql = "SELECT * FROM ".$prefix."_iptracking WHERE ip_address='$ip_address'";
    $res = $db->sql_query($sql);
    $numurls = $db->sql_numrows($res);

    $numpages = ceil($numurls / $numip);
    if ($numpages > 1) {
      echo "<br>";
      OpenTable();
      echo "<center>";
      echo "$numurls "._URLS." ($numpages "._PAGES.", $numip "._PERPAGE.")<br>" ;
      # START Left Arrow
      if ($pagenum > 1) {
         $prevpage = $pagenum - 1 ;
         if(file_exists("images/download/left.gif")) {
            $leftarrow = "images/download/left.gif" ;  # 5.x
         } else {
            $leftarrow = "images/left.gif" ;           # 6.x+
         }
         echo "<a href=\"modules.php?name=IP_Tracking&amp;op=PagesViewed&amp;ipid=$ipid&amp;pagenum=$prevpage\">";
         echo "<img src=\"$leftarrow\" align=\"absmiddle\" border=\"0\" hspace=\"10\"></a>";
      }
      # END Left Arrow
      # START Page Numbers
      echo "[ " ;
      for ($i=1; $i < $numpages+1; $i++) {
         if ($i == $pagenum) {
            echo "$i";
         } else {
            echo "<a href=\"modules.php?name=IP_Tracking&amp;op=PagesViewed&amp;ipid=$ipid&amp;pagenum=$i\">$i</a>";
         }
         if ($i < $numpages) { echo " | "; } else { echo " ]"; }
      }
      # END Page Numbers
      # START Right Arrow
      if ($pagenum < $numpages) {
         $nextpage = $pagenum + 1 ;
         if(file_exists("images/download/right.gif")) {
            $rightarrow = "images/download/right.gif" ;  # 5.x
         } else {
            $rightarrow = "images/right.gif" ;           # 6.x+
         }
         echo "<a href=\"modules.php?name=IP_Tracking&amp;op=PagesViewed&amp;ipid=$ipid&amp;pagenum=$nextpage\">";
         echo "<img src=\"$rightarrow\" align=\"absmiddle\" border=\"0\" hspace=\"10\"></a>";
      }
      # END Right Arrow
      echo "</center>";
      CloseTable();
   }

   include ("footer.php");
}

function IPTrack_showPageStats(){
    global $admin, $prefix, $bgcolor1, $bgcolor2, $db, $ThemeSel;
   global $numip, $pagenum, $ipid, $hide_host, $members_see_iphost, $user, $orderby, $orderdir, $gridcolor, $updown_arrows;
    $l_size = getimagesize("themes/$ThemeSel/images/leftbar.gif");
    $m_size = getimagesize("themes/$ThemeSel/images/mainbar.gif");
    $r_size = getimagesize("themes/$ThemeSel/images/rightbar.gif");
    if ($numip == "") { $numip = 100 ; } # Default 100 per page
    if ($pagenum == "") { $pagenum = 1 ; }
   $offset = ($pagenum-1) * $numip ;
   $ipid=intval($ipid);
   $sql = "SELECT ip_address FROM ".$prefix."_iptracking WHERE ipid='$ipid'";
   $result = $db->sql_query($sql);
    list($ip_address) = $db->sql_fetchrow($result);
   # default values if none set
   if(!$orderby) $orderby="2";
   if(!$orderdir) $orderdir="DESC";
    $sql = "SELECT page, date_time FROM ".$prefix."_iptracking "
           ."WHERE ip_address = '$ip_address' "
           ."ORDER BY $orderby $orderdir LIMIT $offset, $numip ";
    $result = $db->sql_query($sql);
   echo "<center><b>"._PAGEVIEWINFO."<br>";
   # Admin always see info
   #if(is_admin($admin)) {
   if(!is_admin($admin) and !(is_user($user) and $members_see_iphost)) {
      echo IPTrack_mask_ip($ip_address);
   } else {
      echo "$ip_address";
   }
   #if (is_admin($admin) or !$hide_host) echo " - " . gethostbyaddr($ip_address);
   if(is_admin($admin) or !$hide_host or (is_user($user) and $members_see_iphost)) echo " - " . gethostbyaddr($ip_address);
   echo "</center></b><br>";
    echo "<table align=\"center\" bgcolor=\"$gridcolor\" cellspacing=\"1\" cellpadding=\"3\" border=\"0\"><tr>";
   #START allow sorting by any column
   if ($updown_arrows) {
      $asc="<img src=\"images/up.gif\" border=\"0\">";
      $desc="<img src=\"images/down.gif\" border=\"0\">";
      $sep="";
   } else {
      $asc="A";
      $desc="D";
      $sep="/";
   }
    echo "<td bgcolor=\"$bgcolor2\" nowrap>"._PAGEVIEWED;
   echo " <a href=\"modules.php?name=IP_Tracking&amp;op=PagesViewed&amp;ipid=$ipid&amp;orderby=1&amp;orderdir=asc\">$asc</a>$sep";
   echo  "<a href=\"modules.php?name=IP_Tracking&amp;op=PagesViewed&amp;ipid=$ipid&amp;orderby=1&amp;orderdir=desc\">$desc</a></td>";
    echo "<td bgcolor=\"$bgcolor2\" nowrap>"._HITDATE;
   echo " <a href=\"modules.php?name=IP_Tracking&amp;op=PagesViewed&amp;ipid=$ipid&amp;orderby=2&amp;orderdir=asc\">$asc</a>$sep";
   echo  "<a href=\"modules.php?name=IP_Tracking&amp;op=PagesViewed&amp;ipid=$ipid&amp;orderby=2&amp;orderdir=desc\">$desc</a></td></tr>";
   #END allow sorting by any column
    while (list($page,$date_time) = $db->sql_fetchrow($result)){
      echo "<tr bgcolor=\"$bgcolor1\"><td><a href=\"$page\">$page</a></td><td>$date_time</td></tr>";
    }
    $db->sql_freeresult($result);
    echo "</table>";
}

function IPTrack_mask_ip($ipaddr) {
# IP Address Masking
    global $hide_ipseg, $ipmaskchar;
   if(in_array(TRUE, $hide_ipseg)){
      $ipseg = explode(".", $ipaddr);
      for($lcv=1; $lcv<=count($ipseg); $lcv++){
         $seg=$lcv-1;
         # ereg_replace() didn't like $ipseg[$lcv-1] so had to make $seg
         if($hide_ipseg[$lcv]) $ipseg[$seg] = ereg_replace("[0-9]", "$ipmaskchar", "$ipseg[$seg]");
      }
      $ipaddr = implode(".",$ipseg);
   }
   return $ipaddr;
}

switch($op) {

    default:
    IPTrack_IPTrack();
    break;

    case "PagesViewed":
    IPTrack_PagesViewed();
    break;

}

?>
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Modules

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©