Wat is er fout aan?
ik heb een poll gescript. Ik dacht dat alles klopte maar ik kreeg een error. Ik snap niet wat ik fout heb zien jullie het wel?
dit krijg ik na 1 keer stemmen
error:
Parse error: parse error, unexpected ';', expecting '(' in /home/no1animes.nl/harm/testshit/log/poll_log.php on line 2
script:
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
109
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
109
<?
$VRAAG = "Doet ie het?";
$ANTWOORDEN = array ('Goed','Slecht');
$HOEVEELANTWOORDEN = count($ANTWOORDEN);
$LOGBESTAND = "log/poll_log.php";
$ipadres = $REMOTE_ADDR;
include("$LOGBESTAND");
$aantal = count ($ips);
$watnu = "stemmen";
for ($tel = 0; $tel < $aantal; $tel++){
if ($ipadres == $ips[$tel]){
$watnu = "";
}
}
if($watnu == "stemmen"){
// stem shit
if (!$vote) {
echo "<FORM METHOD=\"POST\">\n";
echo "$VRAAG<br><br>\n";
for ($a = 0; $a < $HOEVEELANTWOORDEN; $a++){
echo "<INPUT TYPE=\"radio\" NAME=\"answer\" VALUE=\"$a\"> $ANTWOORDEN[$a]<br>\n";
}
echo "<br><INPUT TYPE=\"Submit\" NAME=\"vote\" VALUE=\"Stem\">\n";
echo "</FORM>";
} else {
$ipadres = $REMOTE_ADDR;
include("$LOGBESTAND");
$aantal = count ($ips);
$watnunouweer = "nognietgestemd";
for ($tel = 0; $tel < $aantal ; $tel++){
if ($ipadres == $ips[$tel]){
$watnunouweer = "";
}
}
if ($watnunouweer == "nognietgestemd"){
for ($b = 0; $b < $HOEVEELANTWOORDEN; $b++){
if ($b == $answer){
$bijnalogantwoorden[$b] = $logantwoorden[$b]+1;
} else {
$bijnalogantwoorden[$b] = $logantwoorden[$b];
}
}
$newips = array_push($ips, "$ipadres");
$fp = fopen("$LOGBESTAND","w");
fputs($fp, "<?\n\$logantwoorden = $bijnalogantwoorden;\n\$ips = $newips;\n?>");
fclose($fp);
include("$LOGBESTAND");
echo "<TABLE cellSpacing=0 cellPadding=0 border=1>\n";
echo "<tr>\n<th>Keuzes</th>\n<th>Percentage</th>\n<th>Aantal stemmen</th>\n</tr>\n";
for ($abc = 0; $abc < $HOEVEELANTWOORDEN; $abc++){
$totaal = $totaal+$logantwoorden[$abc];
}
for ($c = 0; $c < $HOEVEELANTWOORDEN; $c++){
$procent = $logantwoorden[$c] * 100 / $totaal;
$procent_print = number_format($procent, 1);
$procent_img = floor($procent);
echo "<tr>\n<td> $ANTWOORDEN[$c] </td>\n<td><img height=16 src=\"$IMG_DIR_URL/vote_left.gif\"><img height=16 width=\"$procent_img\" src=\"$IMG_DIR_URL/vote_middle.gif\"><img height=16 src=\"$IMG_DIR_URL/vote_right.gif\"> $procent_print % </td>\n<td> $logantwoorden[$c] </td>\n</tr>\n";
}
echo "<tr>\n<td> Totaal: </td>\n<td> </td>\n<td> $totaal </td>\n</tr>\n";
echo "</TABLE><br>";
} else {
include("$LOGBESTAND");
echo "<TABLE cellSpacing=0 cellPadding=0 border=1>\n";
echo "<tr>\n<th>Keuzes</th>\n<th>Percentage</th>\n<th>Aantal stemmen</th>\n</tr>\n";
for ($abc = 0; $abc < $HOEVEELANTWOORDEN; $abc++){
$totaal = $totaal+$logantwoorden[$abc];
}
for ($c = 0; $c < $HOEVEELANTWOORDEN; $c++){
$procent = $logantwoorden[$c] * 100 / $totaal;
$procent_print = number_format($procent, 1);
$procent_img = floor($procent);
echo "<tr>\n<td> $ANTWOORDEN[$c] </td>\n<td><img height=16 src=\"$IMG_DIR_URL/vote_left.gif\"><img height=16 width=\"$procent_img\" src=\"$IMG_DIR_URL/vote_middle.gif\"><img height=16 src=\"$IMG_DIR_URL/vote_right.gif\"> $procent_print % </td>\n<td> $logantwoorden[$c] </td>\n</tr>\n";
}
echo "<tr>\n<td> Totaal: </td>\n<td> </td>\n<td> $totaal </td>\n</tr>\n";
echo "</TABLE><br>";
}
}
} else {
// resultaten
include("$LOGBESTAND");
echo "<TABLE cellSpacing=0 cellPadding=0 border=1>\n";
echo "<tr>\n<th>Keuzes</th>\n<th>Percentage</th>\n<th>Aantal stemmen</th>\n</tr>\n";
for ($abc = 0; $abc < $HOEVEELANTWOORDEN; $abc++){
$totaal = $totaal+$logantwoorden[$abc];
}
for ($c = 0; $c < $HOEVEELANTWOORDEN; $c++){
$procent = $logantwoorden[$c] * 100 / $totaal;
$procent_print = number_format($procent, 1);
$procent_img = floor($procent);
echo "<tr>\n<td> $ANTWOORDEN[$c] </td>\n<td><img height=16 src=\"$IMG_DIR_URL/vote_left.gif\"><img height=16 width=\"$procent_img\" src=\"$IMG_DIR_URL/vote_middle.gif\"><img height=16 src=\"$IMG_DIR_URL/vote_right.gif\"> $procent_print % </td>\n<td> $logantwoorden[$c] </td>\n</tr>\n";
}
echo "<tr>\n<td> Totaal: </td>\n<td> </td>\n<td> $totaal </td>\n</tr>\n";
echo "</TABLE><br>";
}
?>
$VRAAG = "Doet ie het?";
$ANTWOORDEN = array ('Goed','Slecht');
$HOEVEELANTWOORDEN = count($ANTWOORDEN);
$LOGBESTAND = "log/poll_log.php";
$ipadres = $REMOTE_ADDR;
include("$LOGBESTAND");
$aantal = count ($ips);
$watnu = "stemmen";
for ($tel = 0; $tel < $aantal; $tel++){
if ($ipadres == $ips[$tel]){
$watnu = "";
}
}
if($watnu == "stemmen"){
// stem shit
if (!$vote) {
echo "<FORM METHOD=\"POST\">\n";
echo "$VRAAG<br><br>\n";
for ($a = 0; $a < $HOEVEELANTWOORDEN; $a++){
echo "<INPUT TYPE=\"radio\" NAME=\"answer\" VALUE=\"$a\"> $ANTWOORDEN[$a]<br>\n";
}
echo "<br><INPUT TYPE=\"Submit\" NAME=\"vote\" VALUE=\"Stem\">\n";
echo "</FORM>";
} else {
$ipadres = $REMOTE_ADDR;
include("$LOGBESTAND");
$aantal = count ($ips);
$watnunouweer = "nognietgestemd";
for ($tel = 0; $tel < $aantal ; $tel++){
if ($ipadres == $ips[$tel]){
$watnunouweer = "";
}
}
if ($watnunouweer == "nognietgestemd"){
for ($b = 0; $b < $HOEVEELANTWOORDEN; $b++){
if ($b == $answer){
$bijnalogantwoorden[$b] = $logantwoorden[$b]+1;
} else {
$bijnalogantwoorden[$b] = $logantwoorden[$b];
}
}
$newips = array_push($ips, "$ipadres");
$fp = fopen("$LOGBESTAND","w");
fputs($fp, "<?\n\$logantwoorden = $bijnalogantwoorden;\n\$ips = $newips;\n?>");
fclose($fp);
include("$LOGBESTAND");
echo "<TABLE cellSpacing=0 cellPadding=0 border=1>\n";
echo "<tr>\n<th>Keuzes</th>\n<th>Percentage</th>\n<th>Aantal stemmen</th>\n</tr>\n";
for ($abc = 0; $abc < $HOEVEELANTWOORDEN; $abc++){
$totaal = $totaal+$logantwoorden[$abc];
}
for ($c = 0; $c < $HOEVEELANTWOORDEN; $c++){
$procent = $logantwoorden[$c] * 100 / $totaal;
$procent_print = number_format($procent, 1);
$procent_img = floor($procent);
echo "<tr>\n<td> $ANTWOORDEN[$c] </td>\n<td><img height=16 src=\"$IMG_DIR_URL/vote_left.gif\"><img height=16 width=\"$procent_img\" src=\"$IMG_DIR_URL/vote_middle.gif\"><img height=16 src=\"$IMG_DIR_URL/vote_right.gif\"> $procent_print % </td>\n<td> $logantwoorden[$c] </td>\n</tr>\n";
}
echo "<tr>\n<td> Totaal: </td>\n<td> </td>\n<td> $totaal </td>\n</tr>\n";
echo "</TABLE><br>";
} else {
include("$LOGBESTAND");
echo "<TABLE cellSpacing=0 cellPadding=0 border=1>\n";
echo "<tr>\n<th>Keuzes</th>\n<th>Percentage</th>\n<th>Aantal stemmen</th>\n</tr>\n";
for ($abc = 0; $abc < $HOEVEELANTWOORDEN; $abc++){
$totaal = $totaal+$logantwoorden[$abc];
}
for ($c = 0; $c < $HOEVEELANTWOORDEN; $c++){
$procent = $logantwoorden[$c] * 100 / $totaal;
$procent_print = number_format($procent, 1);
$procent_img = floor($procent);
echo "<tr>\n<td> $ANTWOORDEN[$c] </td>\n<td><img height=16 src=\"$IMG_DIR_URL/vote_left.gif\"><img height=16 width=\"$procent_img\" src=\"$IMG_DIR_URL/vote_middle.gif\"><img height=16 src=\"$IMG_DIR_URL/vote_right.gif\"> $procent_print % </td>\n<td> $logantwoorden[$c] </td>\n</tr>\n";
}
echo "<tr>\n<td> Totaal: </td>\n<td> </td>\n<td> $totaal </td>\n</tr>\n";
echo "</TABLE><br>";
}
}
} else {
// resultaten
include("$LOGBESTAND");
echo "<TABLE cellSpacing=0 cellPadding=0 border=1>\n";
echo "<tr>\n<th>Keuzes</th>\n<th>Percentage</th>\n<th>Aantal stemmen</th>\n</tr>\n";
for ($abc = 0; $abc < $HOEVEELANTWOORDEN; $abc++){
$totaal = $totaal+$logantwoorden[$abc];
}
for ($c = 0; $c < $HOEVEELANTWOORDEN; $c++){
$procent = $logantwoorden[$c] * 100 / $totaal;
$procent_print = number_format($procent, 1);
$procent_img = floor($procent);
echo "<tr>\n<td> $ANTWOORDEN[$c] </td>\n<td><img height=16 src=\"$IMG_DIR_URL/vote_left.gif\"><img height=16 width=\"$procent_img\" src=\"$IMG_DIR_URL/vote_middle.gif\"><img height=16 src=\"$IMG_DIR_URL/vote_right.gif\"> $procent_print % </td>\n<td> $logantwoorden[$c] </td>\n</tr>\n";
}
echo "<tr>\n<td> Totaal: </td>\n<td> </td>\n<td> $totaal </td>\n</tr>\n";
echo "</TABLE><br>";
}
?>
alvast bedankt
mzzls Harm
Jij include log/poll_log.php in dit script en de error geeft aan dat DAAR de fout in zit.