Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.
Moderator: General Moderators
hex
Forum Commoner
Posts: 92 Joined: Sat Apr 20, 2002 3:20 am
Location: UK
Post
by hex » Sun Jul 21, 2002 1:55 pm
Sorry to spoil the fun guys, but the last two posts had parse errors! The means protokol wins with the code:
Code: Select all
<?php
class Counter {
function Counter() { // what is a class without a constructor :-)
}
function checkUniqueVisitor($ip) {
$ip = getenv('REMOTE_ADDR');
$_fp = fopen("ips.txt", 'a+');
fclose("$_fp");
}
function displayCounter($counter, $prefix='', $suffix='') {
if (file_exists($counter)) {
$fp = fopen($counter, 'r');
$num = fread($fp, 100);
$fpsoma = ($num + 1);
fclose($fp);
$fa = fopen($counter, 'w');
fwrite($fa, $fpsoma, 100);
fclose($fa);
echo $prefix.$fpsoma.$suffix;
return TRUE;
} else {
echo ("File not found.");
return FALSE;
}
}
}
$oCounter = new Counter;
$oCounter->displayCounter("counter.txt"); // instantiated object calls the function
?>Care to take a serve protokol?
hob_goblin
Forum Regular
Posts: 978 Joined: Sun Apr 28, 2002 9:53 pm
Contact:
Post
by hob_goblin » Sun Jul 21, 2002 4:29 pm
i didnt post parse errors, i tried it on my server before posting
$num = "1";
if($num == "1"){
return FALSE; }
works
protokol
Forum Contributor
Posts: 353 Joined: Fri Jun 21, 2002 7:00 pm
Location: Cleveland, OH
Contact:
Post
by protokol » Sun Jul 21, 2002 4:52 pm
if(in_array($ip,$arr){
return FALSE; }
that's the parse error .. you didn't close off the if() statement
Ok, lemme think of a good one and then i'll serve
hob_goblin
Forum Regular
Posts: 978 Joined: Sun Apr 28, 2002 9:53 pm
Contact:
Post
by hob_goblin » Sun Jul 21, 2002 5:42 pm
oh,
man, i thought i was going good too... i always have problems with the multiple )'s