• Das Erstellen neuer Accounts wurde ausgesetzt. Bei berechtigtem Interesse bitte Kontaktaufnahme über die üblichen Wege. Beste Grüße der Admin

Zugriffszähler mit Refresh-Sperre oder auslesen der IP-Adresse

Andreasjv

New member
Hallo ihr Lieben,

es gibt auf meinen Webseiten einen Besucherzähler,
der aber durch Besucher oft scherzeshalber mit
dem Refreshbutton heraufgezählt wird. In meiner
Statistik für die Webseiten stehen dann weniger
Besucher. Gibt es eine Möglichkeit ...
a) eventuell eine Refresh-Sperre" einzubauen
b) die IP-Adresse des Besuchers auszulesen,
damit der Besuchszähler nur hochgesetzt wird,
wenn eine neue IP-Adresse auftaucht.

Danke euch für eure Mühe.

Viele Grüße,

Andreas
 
Moin!

Dazu müßtest Du mal das Zählerscript posten.

Ahoi - Pit
 
Hallo Pit,

danke Dir für Deine Antwort. Im CGI-bin-Verzeichnis auf dem Webserver habe ich
folgendes Script "gefunden" (Ich kenne mich mit Scripts, etc. nicht aus. :D )
Soviel ich weiß, ist es dieses Script, das den Counter auf den Webseiten
darstellt. Die jeweils höchste Zahl wird in eine TXT-Datei geschrieben.


Das Script:

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++

# Define Variables

### FILE AND DIRECTORY LOCATIONS, REFERERS ###

$count_file = "count.txt";
$digit_dir = "digits";
#$access_log
#$error_log

$flyprog = "/usr/local/fly/fly -q";
$fly_temp = "fly_temp.gif";

#$bad_referer_img

#@referers = ("www.worldwidemart.com","worldwidemart.com","206.31.72.203");

### IMAGE SETTINGS ###

$width = "18";
$height = "21";

$tp = "X";
$il = "1";

$frame_width = "0";
$frame_color = "0,0,0";

$dot = "X";
$logo = "X";

### OPTIONS ###

$uselog = "0"; # 1 = YES; 0 = NO

# Done
##############################################################################

# Get the Date For Logging Purposes
if ($uselog == 1) {
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
if ($sec < 10) { $sec = "0$sec"; }
if ($min < 10) { $min = "0$min"; }
if ($hour < 10) { $hour = "0$hour"; }
if ($mday < 10) { $mday = "0$mday"; }
if ($mon < 10) { $monc = "0$mon"; }
$year %= 100;
$date = sprintf("%02d:%02d:%02d %02d/%02d/%02d",$hour,$min,$sec,$mon,$mday,$year);
}

# Make Sure People Aren't Messing With the Counter From Other Web Pages
#&check_referer;

# Get the Counter Number And Write New One to File
&get_num;

# If they Just want a transparent dot or a logo, give them that.
&check_dot;

# Determine Length of Counter Number
$num = $length = length($count);

# Set Individual Counter Numbers Into Associative Array
while ($num > 0) {
$CHAR{$num} = chop($count);
$num--;
}

# Determine the Height and Width of the Image
$img_width = (($width * $length) + ($frame_width * 2));
$img_height = (($frame_width * 2) + $height);

# Open the In-File for Commands
open(FLY,">$fly_temp") || die "Can't Open In File For FLY Commands: $!\n";

# Create New Counter Image
print FLY "new\n";
print FLY "size $img_width,$img_height\n";

# If User Wants Frame, Print Commands to the In-File
&make_frame;

# Copy Individual Counter Images Commands to In-File
$j = 1;
while ($j <= $length) {
print FLY "copy $insert_width,$insert_height,-1,-1,-1,-1,$digit_dir/$CHAR{$j}\.gif\n";
$insert_width = ($insert_width + $width);
$j++;
}

# If they want a color transparent, make it transparent
if ($tp ne "X" && $tp =~ /.*,.*,.*/) {
print FLY "transparent $tp\n";
}

# If they want the image interlaced, make it interlaced
if ($il == 1) {
print FLY "interlace\n";
}

# Close FLY
close(FLY);

$output = `$flyprog -i $fly_temp`;
print "Content-type: image/gif\n\n";
print "$output";

# Remove Temp File
unlink($fly_temp);

# Log the Counter Access
if ($uselog == 1) {
&log_access;
}

sub check_referer {
if (@referers && $ENV{'HTTP_REFERER'}) {
foreach $referer (@referers) {
if ($ENV{'HTTP_REFERER'} =~ /$referer/) {
$ref = 1;
last;
}
}
}
else {
$ref = 1;
}

if ($ref != 1) {
print "Location: $bad_referer_img\n\n";

if ($uselog == 1) {
open(LOG,">>$error_log") || die "Can't Open User Error Log: $!\n";
print LOG "$error: $ENV{'REMOTE_HOST'} [$date] $ENV{'HTTP_REFERER'} - $ENV{'HTTP_USER_AGENT'}\n";
close(LOG);
}

exit;
}
}

sub get_num {
open(COUNT,"$count_file") || die "Can't Open Count Data File: $!\n";
$count = <COUNT>;
close(COUNT);
if ($count =~ /\n$/) {
chop($count);
}

$count++;

open(COUNT,">$count_file") || die "Can't Open Count Data File For Writing: $!\n";
print COUNT "$count";
close(COUNT);
}

sub check_dot {

if ($dot == 1) {
# Open the In-File for Commands
open(FLY,">$fly_temp") || die "Can't Open In File For FLY Commands: $!\n";

# Create New Counter Image
print FLY "new\n";
print FLY "size 1,1\n";
print FLY "fill x,y,0,0,0\n";
print FLY "transparent 0,0,0\n";
close(FLY);

$output = `$flyprog -i $fly_temp`;
print "Content-type: image/gif\n\n";
print "$output";

exit;
}
elsif ($logo ne "X" && $logo =~ /.*tp:\/\//) {
print "Location: $logo\n\n";

# Log The Access
if ($uselog == 1) {
&log_access;
}

exit;
}
}

sub make_frame {
$insert_width = $insert_height = $frame_width;

$insert_frame = 0;

while ($insert_frame < $frame_width) {
$current_width = ($img_width - $insert_frame);
$current_height = ($img_height - $insert_frame);

print FLY "line 0,$insert_frame,$img_width,$insert_frame,$frame_color\n";
print FLY "line $insert_frame,0,$insert_frame,$img_height,$frame_color\n";
print FLY "line $current_width,0,$current_width,$img_height,$frame_color\n";
print FLY "line $current_height,0,$current_height,$img_width,$frame_color\n";

$insert_frame++;
}
}

sub log_access {
open(LOG,">>$access_log") || die "Can't Open User Access Log: $!\n";
print LOG "[$date] $ENV{'HTTP_REFERER'} - $ENV{'REMOTE_HOST'} - $ENV{'HTTP_USER_AGENT'}\n";
close(LOG);
}


++++++++++++++ Ende des Scripts +++++++++++++++++++++++



Danke Dir für Deine Mühe!

Viele Grüße,

Andreas :grin:
 
Hi!

Würde ja gerne helfen, ist aber leider nicht meine Sprache :(. Hoffe, das jemand anders daran stricken kann...

Gruß - Pit
 
Zurück
Oben