BOARDS

planetluc.com discussion board

all about the planetlu.com scripts

You are not logged in.

Announcement

I had to clean the boards due to massive spam. Actually i deleted everything /-one after 1st Oct 2008. It was the only way to get this spam out of the boards. So i'm sorry for all serious users who registered/posted meanwhile.

#1 04-01-2005 16:00:30

zUNDER
Guest

Lock IP Adress

Hello,

First Thanks for those great and simple Scripts.

Now i have a question about the FlatFileCounter:
Is it possible to "lock" an IP Adress? A Adresse (fix ip at my working place) which doesn't  mount the counter?

Voila, habe es für alle auf Englisch geschrieben, nun auch noch (verständlicher) auf Deutsch...
Ist es möglich eine IP Adresse zu Sperren, um das Zählen des Counters zu vermeiden. Fixe IP Adresse im Büro. Wäre nett, sodass es mich selber nicht immer als Besucher mitzählt...

Gruss, Lob und Dank
zUNDER / www.migu.ch

 

#2 10-04-2005 02:33:58

sion
Guest

Re: Lock IP Adress

<?
/////////  FlatFileCounter v1.0     //////////
//     copyright & written in Aug 2003      //
//     by Lukas Stalder                     //
//     contact: flounter@planetluc.com      //
//     Visit www.planetluc.com!             //
//               enjoy it!                  //
//////////////////////////////////////////////

/*

Installation

1. change the $expire variable's value to whatever you want
2. upload the 2 files (flount.php, flount.log)
3. chmod the flount.log file to 777
4. include the flount.php wherever you want to cont your visits
   by inserting   <? include('flount.php');?>   into your site
   
   
  that's it!



================== FOR SUPPORT ========================
For support requests please use the BOARDS on
www.planetluc.com/forum/ (post in the appropriate
forums please!)

In very urgent cases (and I mean that) you can try
to catch me over one of the messengers below:

icq:  133613557
msn:  shakkalakka@hotmail.com (for messaging
      purposes only!)
Or if you don't have any messengers use this
email address: support@planetluc.com
========================================================
*/



$expire= 10;                      // ip expires after $expire seconds
$logfile= "flount.log";         // file where visits and ip logs are stored

// *************************** don't change anything below this line *************************

$incpath=substr(__FILE__, 0, strrpos(__FILE__, "/")+1);
$logfile=$incpath.$logfile;
$ip= getenv('REMOTE_ADDR');
$visits=0;
$badhit= false;
$now= time();
$blockMyIP= '0.0.0.0';     //change this to the ip you want to block. If you do not want to use the feature simply set it to 0.0.0.0


$ips = array(array());
if (file_exists($logfile)){
    if ($ip==$blockMyIP){       //Added for local IP block
        if ($loggedips=file($logfile)){        //Added for local IP block
            $visits=trim($loggedips[0]);}    //Added for local IP block
        echo $visits; }                        //Added for local IP block
    else {                                    //Added for local IP block
        if ($loggedips=file($logfile)){
            $visits=trim($loggedips[0]);
            for ($i=1; $i< count($loggedips); $i++){
                $loggedips[$i]=trim($loggedips[$i]);
                $ips[$i] = explode('||', $loggedips[$i]);
                if (($ips[$i][0]==$ip) && ($now-$ips[$i][1]< $expire))
                    $badhit= true;
            }
            if ($badhit)
                echo $visits;
            else{
                $visits++;
                $fp= fopen($logfile, 'w');
                fputs($fp,"$visits\n");
                for ($i=1; $i< count($loggedips); $i++){
                    if ($now-$ips[$i][1] < $expire)
                        fputs($fp, $ips[$i][0]."||".$ips[$i][1]."\n");
                }
                fputs($fp, "$ip||$now\n");
                fclose($fp);
                echo $visits;           
            }
        }
    }                                        //Added for local IP block
}else
    echo "logfile is missing";



?>

 

#3 10-04-2005 02:35:28

sion
Guest

Re: Lock IP Adress

Sorry forgot to mention a few words.

If you replace the php file with what i have pasted in to the window above it should work without any problems. All you need to do is change the 0.0.0.0 to your ip address you want to block. Im using it on my site at the moment.

If you need any help visit the www.thescotlandindex.co.uk and you can find my contact details on there.

Thanks

Sion

 

#4 05-02-2010 13:09:55

ericabarnet
New member
Registered: 28-01-2010
Posts: 1

Re: Lock IP Adress

thanks. very helpful post.


[url=http://www.sonicloans.net/]Payday loans[/url] , [url=http://www.sonicgates.net/]Bad credit loans[/url] and [url=http://www.flyingloans.com/]Personal loans[/url]

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson

 
 
© 2003-2010 by planetluc.com · Bachtelstrasse 104 · CH-8400 Winterthur | Support | Login |