vraagje over foutje
wou ik dus met zo,n scriptje de status weergeven. maargoed ik krijg deze fout:
Parse error: syntax error, unexpected ';' in /data/members/free/tripod/nl/j/a/a/jaatogh/htdocs/counter.php on line 23
en dit is de code van counter.php
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?php
class acounter {
var $config = array();
function acounter () {
//Number
$this->config['img'] = "number/";
//Numbers
$this->config['animated_img'] = "numbers/";
$this->config['pad'] = 6;
$this->config['width'] = 16;
$this->config['height'] = 22;
//Mogen de hits van jezelf geblokkeerd worden? true of false
$this->config['block_ip'] = false;
//http://members.lycos.nl/jaatogh/
$this->config['logfile'] = "ip.txt";
Heeey?
$this->config['block_time'] = 110;
}
//na hier niets veranderen
function is_new_visitor() {
$is_new = true;
$rows = @file($this->config['logfile']);
$this_time = time();
$ip = getenv("REMOTE_ADDR");
$reload_dat = fopen($this->config['logfile'],"wb");
flock($reload_dat, 2);
for ($i=0; $i<sizeof($rows); $i++) {
list($time_stamp,$ip_addr) = split("\|",$rows[$i]);
if ($this_time < ($time_stamp+$this->config['block_time'])) {
if (chop($ip_addr) == $ip) {
$is_new = false;
} else {
fwrite($reload_dat,"$time_stamp|$ip_addr");
}
}
}
fwrite($reload_dat,"$this_time|$ip\n");
flock($reload_dat, 3);
fclose($reload_dat);
return $is_new;
}
function read_counter_file($page) {
$update = false;
if (!file_exists("./data/$page.txt")) {
$count_dat = fopen("./data/$page.txt","w+");
$this->counter = 1;
fwrite($count_dat,$this->counter);
fclose($count_dat);
} else {
$fp = fopen("./data/$page.txt", "r+");
flock($fp, 2);
$this->counter = fgets($fp, 4096);
flock($fp, 3);
fclose($fp);
if ($this->config['block_ip']) {
if ($this->is_new_visitor()) {
$this->counter++;
$update = true;
}
} else {
$this->counter++;
$update = true;
}
if ($update) {
$fp = fopen("./data/$page.txt", "r+");
flock($fp, 2);
rewind($fp);
fwrite($fp, $this->counter);
flock($fp, 3);
fclose($fp);
}
}
return $this->counter;
}
function create_output($page='') {
if (empty($page)) {
$page = "counter";
}
$this->read_counter_file($page);
$this->counter = sprintf("%0"."".$this->config['pad'].""."d",$this->counter);
$ani_digits = sprintf("%0"."".$this->config['pad'].""."d",$this->counter+1);
$html_output = "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr align=\"center\">\n";
for ($i=0; $i<strlen($this->counter); $i++) {
if (substr("$this->counter",$i,1) == substr("$ani_digits",$i,1)) {
$digit_pos = substr("$this->counter",$i,1);
$html_output .= "<td><img src=\"".$this->config['img']."$digit_pos.gif\"";
} else {
$digit_pos = substr("$ani_digits",$i,1);
$html_output .= "<td><img src=\"".$this->config['animated_img']."$digit_pos.gif\"";
}
$html_output .= " width=\"".$this->config['width']."\" height=\"".$this->config['height']."\"></td>\n";
}
$html_output .= "</tr></table>\n";
return $html_output;
}
}
?>
class acounter {
var $config = array();
function acounter () {
//Number
$this->config['img'] = "number/";
//Numbers
$this->config['animated_img'] = "numbers/";
$this->config['pad'] = 6;
$this->config['width'] = 16;
$this->config['height'] = 22;
//Mogen de hits van jezelf geblokkeerd worden? true of false
$this->config['block_ip'] = false;
//http://members.lycos.nl/jaatogh/
$this->config['logfile'] = "ip.txt";
Heeey?
$this->config['block_time'] = 110;
}
//na hier niets veranderen
function is_new_visitor() {
$is_new = true;
$rows = @file($this->config['logfile']);
$this_time = time();
$ip = getenv("REMOTE_ADDR");
$reload_dat = fopen($this->config['logfile'],"wb");
flock($reload_dat, 2);
for ($i=0; $i<sizeof($rows); $i++) {
list($time_stamp,$ip_addr) = split("\|",$rows[$i]);
if ($this_time < ($time_stamp+$this->config['block_time'])) {
if (chop($ip_addr) == $ip) {
$is_new = false;
} else {
fwrite($reload_dat,"$time_stamp|$ip_addr");
}
}
}
fwrite($reload_dat,"$this_time|$ip\n");
flock($reload_dat, 3);
fclose($reload_dat);
return $is_new;
}
function read_counter_file($page) {
$update = false;
if (!file_exists("./data/$page.txt")) {
$count_dat = fopen("./data/$page.txt","w+");
$this->counter = 1;
fwrite($count_dat,$this->counter);
fclose($count_dat);
} else {
$fp = fopen("./data/$page.txt", "r+");
flock($fp, 2);
$this->counter = fgets($fp, 4096);
flock($fp, 3);
fclose($fp);
if ($this->config['block_ip']) {
if ($this->is_new_visitor()) {
$this->counter++;
$update = true;
}
} else {
$this->counter++;
$update = true;
}
if ($update) {
$fp = fopen("./data/$page.txt", "r+");
flock($fp, 2);
rewind($fp);
fwrite($fp, $this->counter);
flock($fp, 3);
fclose($fp);
}
}
return $this->counter;
}
function create_output($page='') {
if (empty($page)) {
$page = "counter";
}
$this->read_counter_file($page);
$this->counter = sprintf("%0"."".$this->config['pad'].""."d",$this->counter);
$ani_digits = sprintf("%0"."".$this->config['pad'].""."d",$this->counter+1);
$html_output = "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr align=\"center\">\n";
for ($i=0; $i<strlen($this->counter); $i++) {
if (substr("$this->counter",$i,1) == substr("$ani_digits",$i,1)) {
$digit_pos = substr("$this->counter",$i,1);
$html_output .= "<td><img src=\"".$this->config['img']."$digit_pos.gif\"";
} else {
$digit_pos = substr("$ani_digits",$i,1);
$html_output .= "<td><img src=\"".$this->config['animated_img']."$digit_pos.gif\"";
}
$html_output .= " width=\"".$this->config['width']."\" height=\"".$this->config['height']."\"></td>\n";
}
$html_output .= "</tr></table>\n";
return $html_output;
}
}
?>
iemand die mij kan helpen??
bedankt!
np