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

CGI Hilfe

Klark

New member
Also ich mir da ein Counter gebastelt (ganz poblig). Ich hab folgendes Problem das keine IP Sperre (also das wenn einer innerhalb von 1 Minute 28 mal meine Seite aufruft nur einmal gezählt wird) drin ist un ich zu DOOF bin das zu Programmieren
Der Counter sieht so aus:

#!/usr/local/bin/perl -w



use strict;
my $counterdatei = "counter.dat";

use Fcntl qw:)DEFAULT :flock);
sysopen(FH, "$counterdatei", O_RDWR | O_CREAT) ;
# autoflush FH
my $ofh = select(FH);
$| = 1;
select ($ofh);
flock(FH, LOCK_EX) ;
my $num = <FH> ;
seek(FH, 0, 0) ;
$num++;
print FH "$num\n" ;
truncate(FH, tell(FH)) ;
close(FH) ;

my $zaehlerstand = $num;

print "Content-type: text/plain\n\n";
print "zaehlerstand=$zaehlerstand&fertig=1";

exit;


Kann mir einer helfen??

[Edited by klark on 19-01-2001 at 17:18]
 
So ich hab gelesen das hier kein cgi-drive-in seid also hab ich mich dran versucht. Das script sieht jetzt so aus und funtzt leider net. Kann mir einer helfen.

#!/usr/local/bin/perl -w


use strict;

open(LOGFILE, "< lastip.log");
my($lastip) = <LOGFILE>;
close(LOGFILE);
unless($lastip eq $ENV{REMOTE_ADRESS} {
# erhöhe Counter
open(LOGFILE, "> lastip.log");
print LOGFILE $ENV{REMOTE_ADRESS};
close(LOGFILE);
}


my $counterdatei = "counter.dat";

use Fcntl qw( :DEFAULT :flock);
sysopen(FH, "$counterdatei", O_RDWR | O_CREAT) || die "can't open numfile: $!";
# autoflush FH
my $ofh = select(FH);
$| = 1;
select ($ofh);
flock(FH, LOCK_EX) || die "can't write-lock numfile: $!";
my $num = <FH> || 0;
seek(FH, 0, 0) || die "can't rewind numfile : $!";
$num++;
print FH "$num\n" || die "can't write numfile: $!";
truncate(FH, tell(FH)) || die "can't truncate numfile: $!";
close(FH) || die "can't close numfile: $!";

my $zaehlerstand = $num;

print "Content-type: text/plain\n\n";
print "zaehlerstand=$zaehlerstand&fertig=1";

exit;


Bitte helfdt mir einer *gr vergess jedesmal smilies zu deaktivieren*
 
hmm, was geht denn nicht? hast ne URL zum nachvollziehen?

ciao,
mo
 
bevor du das ganze aus nem flash-film testest, schau, dass es zunächst mit ner normalen html-seite läuft.
ausserdem: ins cgi-bin gehören definitiv keine flash-filme, html-seiten oder ähnliches.
und: hast du die rechte der datei counter.dat mit chmod 666 geändert?

ciao,
mo
 
hab die Fehler meldung

Jo die sieht so aus von Virtualavenue:

syntax error at counter.cgi line 34, near "print"
Execution of counter.cgi aborted due to compilation errors.
syntax error at counter.cgi line 34, near "print"
Execution of counter.cgi aborted due to compilation errors.
syntax error at counter.cgi line 34, near "print"
Execution of counter.cgi aborted due to compilation errors.
syntax error at counter.cgi line 34, near "print"
Execution of counter.cgi aborted due to compilation errors.
syntax error at counter.cgi line 34, near "print"
Execution of counter.cgi aborted due to compilation errors.
syntax error at counter.cgi line 34, near "print"
Execution of counter.cgi aborted due to compilation errors.
syntax error at counter.cgi line 34, near "print"
Execution of counter.cgi aborted due to compilation errors.
syntax error at counter.cgi line 34, near "print"
Execution of counter.cgi aborted due to compilation errors.
syntax error at counter.cgi line 34, near "print"
Execution of counter.cgi aborted due to compilation errors.
syntax error at counter.cgi line 12, near "print"
Execution of counter.cgi aborted due to compilation errors.
syntax error at counter.cgi line 9, near "print"
Execution of counter.cgi aborted due to compilation errors.

Ich hab das mit dem HTML gemacht wie du gesagt hast und die Fehler Meldung bekommen
 
Zurück
Oben