[PHP] Wat is hier fout aan ?

Pagina: 1
Acties:

  • cryptapix
  • Registratie: Januari 2001
  • Laatst online: 21:55
Warning: GLOBAL variable declaration meaningless in main() scope in psettings.php on line 31

Fatal error: Call to unsupported or undefined function getpolldata() in poll.php on line 41

naja die warnings boeien opzich niet zoveel want ze zijn niet fatal..
maar die laatste is wel erg :)

op line 41 van poll.php bevin zich dit
PHP:
1
2
3
<?
GetPollData();
?>

en onderaan de php file bevnid zich dit
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
<?
function GetPollData() {
global $totalvotes,$lockit,$questions, $votes, $percent, $ips, $totalips;
$fp3 = fopen("polldata.txt","r");
$values = fgets($fp3,4050);
$values = str_replace ("\n", "", $values);
list ($totalvotes, $lockit) = split(":",$values);

$totalvotes = trim($totalvotes);
$lockit = trim($lockit);
if ($lockit == 0 || $lockit == 2) {
for ($i = 1; $i <= $questions; $i++) {

$values = fgets($fp3,4050);
$values = str_replace ("\n", "", $values);

$votes[$i] = split(":" , $values);
}
$totalips = fgets($fp3,4050);
$totalips = trim($totalips);
if ($totalips != 0) {
$values = fgets($fp3, 35*$totalips);
$ips = split(":",$values);
}

}


fclose ($fp3);
}
?>

  • D2k
  • Registratie: Januari 2001
  • Laatst online: 31-08 10:19

D2k

zet er ff [ php] en [ /php] omheen ajb

global $totalvotes,$lockit,$questions, $votes, $percent, $ips, $totalips;

zet daar eens // voor
volgens mij heb je deze regel niet nodig :)

Doet iets met Cloud (MS/IBM)


  • cryptapix
  • Registratie: Januari 2001
  • Laatst online: 21:55
mjah sorry..
er staat nu php omheen ;)

  • Mithrandir
  • Registratie: Januari 2001
  • Laatst online: 16-09 21:52
Op zondag 04 november 2001 15:50 schreef D2k het volgende:
zet er ff [ php] en [ /php] omheen ajb
zei ik al tegen m

Verbouwing


  • Mithrandir
  • Registratie: Januari 2001
  • Laatst online: 16-09 21:52
Op zondag 04 november 2001 15:48 schreef cryptapix het volgende:
Warning: GLOBAL variable declaration meaningless in main() scope in psettings.php on line 31

Fatal error: Call to unsupported or undefined function getpolldata() in poll.php on line 41

naja die warnings boeien opzich niet zoveel want ze zijn niet fatal..
maar die laatste is wel erg :)

op line 41 van poll.php bevin zich dit
PHP:
1
2
3
<?
GetPollData();
?>

en onderaan de php file bevnid zich dit
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
<?
function GetPollData() {
global $totalvotes,$lockit,$questions, $votes, $percent, $ips, $totalips;
$fp3 = fopen("polldata.txt","r");
$values = fgets($fp3,4050);
$values = str_replace ("\n", "", $values);
list ($totalvotes, $lockit) = split(":",$values);

$totalvotes = trim($totalvotes);
$lockit = trim($lockit);
if ($lockit == 0 || $lockit == 2) {
for ($i = 1; $i <= $questions; $i++) {

$values = fgets($fp3,4050);
$values = str_replace ("\n", "", $values);

$votes[$i] = split(":" , $values);
}
$totalips = fgets($fp3,4050);
$totalips = trim($totalips);
if ($totalips != 0) {
$values = fgets($fp3, 35*$totalips);
$ips = split(":",$values);
}

}


fclose ($fp3);
}
?>
je moet functies altijd BOVENIN de php code zetten

[edit]

en op HoOfDlEtTeRs denken :)

Verbouwing


  • cryptapix
  • Registratie: Januari 2001
  • Laatst online: 21:55
lol..
ikzeg net tegen iemand.. moeten die functies niet bovenin..
nee zegt ie da maakt volgens mij niet uit :)

ok ff proberen tnx

  • cryptapix
  • Registratie: Januari 2001
  • Laatst online: 21:55
ok
dat doet ei nu
dus.. de poll staat er
aleen er staat dit boven

vWarning: GLOBAL variable declaration meaningless in main() scope in psettings.php on line 31

mjah en zo wel over meerdere regels..

  • cryptapix
  • Registratie: Januari 2001
  • Laatst online: 21:55
iedreen bedankt voor de hulp..
en voor de reopvoedings cursus die ik erbij kado heb gekregen :9

  • D2k
  • Registratie: Januari 2001
  • Laatst online: 31-08 10:19

D2k

Op zondag 04 november 2001 15:56 schreef cryptapix het volgende:
iedreen bedankt voor de hulp..
en voor de reopvoedings cursus die ik erbij kado heb gekregen :9
np :)
werkt het nu?

Doet iets met Cloud (MS/IBM)


  • cryptapix
  • Registratie: Januari 2001
  • Laatst online: 21:55
nee
nog niet helemaal
naja de poll doet ut.. teminste de interface
aleen ik krijg er een dikke warning boven
allemaal warning regels met gezever over Global
toen vertelde iemand me dat ik die global weg meost halen en nu heb ik een parse error :)

  • Mithrandir
  • Registratie: Januari 2001
  • Laatst online: 16-09 21:52
Op zondag 04 november 2001 16:03 schreef cryptapix het volgende:
nee
nog niet helemaal
naja de poll doet ut.. teminste de interface
aleen ik krijg er een dikke warning boven
allemaal warning regels met gezever over Global
toen vertelde iemand me dat ik die global weg meost halen en nu heb ik een parse error :)
O-)

Verbouwing


  • ACM
  • Registratie: Januari 2000
  • Niet online

ACM

Software Architect

Werkt hier

Je hebt een global call op regel31, ik neem aan dat wij je regel31 niet kunnen zien in wat je hier hebt staan?

Maar die regel is iig zinloos, zoals de warning al aangeeft...

  • D2k
  • Registratie: Januari 2001
  • Laatst online: 31-08 10:19

D2k

Op zondag 04 november 2001 16:35 schreef ACM het volgende:
Je hebt een global call op regel31, ik neem aan dat wij je regel31 niet kunnen zien in wat je hier hebt staan?

Maar die regel is iig zinloos, zoals de warning al aangeeft...
Op zondag 04 november 2001 15:50 schreef D2k het volgende:
zet er ff [ php] en [ /php] omheen ajb

global $totalvotes,$lockit,$questions, $votes, $percent, $ips, $totalips;

zet daar eens // voor
volgens mij heb je deze regel niet nodig :)
gewoon zoals ik hier ook al zei
ff voor alle global's

Doet iets met Cloud (MS/IBM)


  • cryptapix
  • Registratie: Januari 2001
  • Laatst online: 21:55
ok tnx!!
the warnings zijn weg..

aleen nu een ander probleempje :p
hij denkt bij eidreen dat ie al heeft gevote..
PHP:
1
2
3
4
5
6
7
8
9
10
<?
$ipcheck = getenv("HTTP_X_FORWARDED_FOR");

for ($i=1;$i <= $totalips;$i++) {
$ips[$i] = str_replace("\n","",$ips[$i]);
if ($ips[$i] == $ipcheck) {
$badip = 1;

}
?>

en een stuk eronder staat
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
<?
# ------------------------------------- ALREADY VOTED SCREEN ----------------------
} elseif ($badip &amp;&amp; $lockit != 2) {
echo "<table align='center' width='$pollwidth' cellspacing='0' cellpadding='2' bordercolor='$bordercolor' border='$border'>";
echo "<tr>\n<td colspan='2' width='100%' bgcolor='$titlebgcolor'><font face='$titleface'  color='$titlecolor' size='3'><b><center>$polltitle: Results</center></b></td>\n</tr>";

for ($i = 1; $i <= $questions; $i++) {
for ($a = 1; $a <= $qa[$i]; $a++) {
if ($votes[$i][$a] != 0 &amp;&amp; $totalvotes != 0) {
$percent[$i][$a] = $votes[$i][$a] * 100;
$percent[$i][$a] = $percent[$i][$a] / $totalvotes;
}
}
}


$cellwidth = $pollwidth / 2;
for ($i = 1; $i <= $questions; $i++) {

echo "<tr>\n<td width='$qcell' bgcolor='$bgcolor'><font face='$textface'  face='$textface'  color='$textcolor' size='$textsize'><b>$q[$i]</b></td>";
echo "\n<td width='$answercell' bgcolor='$bgcolor'>\n<table width='$answercell' border='0'>";

for ($a = 1; $a <= $qa[$i]; $a++) {
$temp = precision($percent[$i][$a],2);

$imgtemp = precision($percent[$i][$a],0);
$imgtemp2 = $acell / 100;

$imgtemp = $imgtemp2 *  $imgtemp;
$imgtemp *= 0.7;


echo "<tr><td width='$acell'><font face='$textface'  face='$textface'  size='1' color='$textcolor'>";
echo $answers[$i][$a] . ":";
echo "</td><td width='$pcell' nowrap><div align='left'><font face='$textface'  size='1' color='$textcolor'>";
if ($imagecolor != "") {
echo "[img]'images/$imagecolor.jpg'[/img]  <b>";
}
echo $temp;
echo "%</b>\n";
echo "</div></td>\n</tr>\n";

}
echo "</table></td></tr>";

}



echo "<tr>\n<td colspan='2' width='100%' bgcolor='$bgcolor'><font face='$textface'  size='$textsize' color='$textcolor'><center><b>You have already voted</b><br><br><font face='$textface'  size='1'>Total votes: $totalvotes</center></td>\n</tr>";
echo "</table>";

} elseif (!$action &amp;&amp; $lockit != 2) {
?>

iemand nog een idee wat daaraan de fout kan zijn ?
Pagina: 1