Een error die ik er niet uit krijg
Hoe krijg ik het voor elkaar dat deze error weg is?
Error:
Fatal error: Cannot redeclare inputcheck() (previously declared in index.php:9) in index.php on line 46
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
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
<?php
function inputcheck($input, $type="")
{
$type = StrToLower( $type );
if( empty( $type ) OR $type == "alpha" )
{
if( StrLen( $input ) < 3 )
{
echo "<meta http-equiv='refresh' content='0; url=index.php?p=p/".$_GET['p']."' />";
exit();
}
else
{
if (!get_magic_quotes_gpc()) {
return AddSlashes( $input );
}
else
{
return AddSlashes( $input );
}
}
}
else
if( $type == "num" OR $type = "digit" )
{
if( !Ctype_Digit( $input ) )
{
echo "<meta http-equiv='refresh' content='0; url=index.php?p=p/".$_GET['p']."' />";
exit();
}
else
{
return $input;
}
?>
function inputcheck($input, $type="")
{
$type = StrToLower( $type );
if( empty( $type ) OR $type == "alpha" )
{
if( StrLen( $input ) < 3 )
{
echo "<meta http-equiv='refresh' content='0; url=index.php?p=p/".$_GET['p']."' />";
exit();
}
else
{
if (!get_magic_quotes_gpc()) {
return AddSlashes( $input );
}
else
{
return AddSlashes( $input );
}
}
}
else
if( $type == "num" OR $type = "digit" )
{
if( !Ctype_Digit( $input ) )
{
echo "<meta http-equiv='refresh' content='0; url=index.php?p=p/".$_GET['p']."' />";
exit();
}
else
{
return $input;
}
?>
Alvast bedankt.
Edit: Dit hoort er ook nog bij.
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
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
<?php
if(!isset($_GET['p']))
{
header("Location: index.php?p=p/home");
}
if($_GET['p'] == index) {
echo "Pagina 2 keer include zie nog steeds error bij dit.";
}
$sExpressie = "(http:|ftp:|shttp:|www.|.php|.pl|.cgi|.asp|index.php)";
if(isset($_GET['p']))
{
if(eregi($sExpressie,$_GET['p']))
{ echo '<div id="content2top"><div id="contenttext1"><center><b><font color="#A40000" >Oops.. Er ging iets fout!</font></b></center></div></div>
<div id="content2midel">
<div id="contenttext">
<center>Ongeldige pagina opgegeven.</center><br>
</div></div>
<div id="content2footer"></div>'; }
else
{
if(file_exists($_GET['p'].'.php'))
{ include $_GET['p'].'.php'; }
else
{ echo '<div id="content2top"><div id="contenttext1"><center><b><font color="#A40000" >Oops.. Er ging iets fout!</font></b></center></div></div>
<div id="content2midel">
<div id="contenttext">
<center>De Opgegeven pagina bestaat niet.</center><br>
</div></div>
<div id="content2footer"></div>'; }
}
}
?>
if(!isset($_GET['p']))
{
header("Location: index.php?p=p/home");
}
if($_GET['p'] == index) {
echo "Pagina 2 keer include zie nog steeds error bij dit.";
}
$sExpressie = "(http:|ftp:|shttp:|www.|.php|.pl|.cgi|.asp|index.php)";
if(isset($_GET['p']))
{
if(eregi($sExpressie,$_GET['p']))
{ echo '<div id="content2top"><div id="contenttext1"><center><b><font color="#A40000" >Oops.. Er ging iets fout!</font></b></center></div></div>
<div id="content2midel">
<div id="contenttext">
<center>Ongeldige pagina opgegeven.</center><br>
</div></div>
<div id="content2footer"></div>'; }
else
{
if(file_exists($_GET['p'].'.php'))
{ include $_GET['p'].'.php'; }
else
{ echo '<div id="content2top"><div id="contenttext1"><center><b><font color="#A40000" >Oops.. Er ging iets fout!</font></b></center></div></div>
<div id="content2midel">
<div id="contenttext">
<center>De Opgegeven pagina bestaat niet.</center><br>
</div></div>
<div id="content2footer"></div>'; }
}
}
?>
Gewijzigd op 06/11/2010 15:02:06 door Vincent Post
Gewijzigd op 05/11/2010 14:51:29 door - Ariën -
Je bent gewoon zo dom om 2x dezelfde functie te declareren!! Dus je dient er 1 de bietenbak in te mikken.
-------------------
Post je code tussen de daarvoor speciaal aangelegde block-haken
http://www.phphulp.nl/veel-gestelde-vragen/#bbcode
Is je code ook veel beter te lezen
index.php?p=index als ik dit doe wil ik die error niet zien.
Edit: ik vraag niet WAAROM maar vraag hoe krijg ik het weg?
Gewijzigd op 05/11/2010 14:58:46 door Vincent Post
mischien met require_once
@noppes: Een beetje normaal mag hoor ;-)