[php] Script geeft error

Gestart doorChristum9 reacties47 weergaven

10 berichten · pagina 1 van 1

Christum

Lid · Topicstarter

Berichten
921
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik heb op geen enkele host last hiervan gehad alleen wel op one2xs

Ik heb het script

[COLOR= #0000BB]<?php
    $page[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]p[/COLOR][COLOR= #007700]];[/COLOR]
      [URL="http://www.php.net/if"]if[/URL][COLOR= #007700](![/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$page[/COLOR][COLOR= #007700]))
      {[/COLOR]
        [URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"menu/p_home.php"[/COLOR][COLOR= #007700]);
      }[/COLOR]
      [URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/file_exists"]file_exists[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700].[/COLOR] [COLOR= #0000BB]$page[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]".php"[/COLOR][COLOR= #007700]))
      {[/COLOR]
        [URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]""[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$page[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]".php"[/COLOR][COLOR= #007700]);
      }[/COLOR]
      [URL="http://www.php.net/else"]else[/URL]
      [COLOR= #007700]{[/COLOR]
        [URL="http://www.php.net/print"]print[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"opvraag pagina wanneer error"[/COLOR][COLOR= #007700]);
      }[/COLOR]
    ?>


Hij geeft een error op lijn 2 en dat is deze:

Quote:
Notice: Undefined index: p
in /home/lasertools/domains/lasertools.s2.one2xs.com/public_html/index.php on line 2

Nou heb ik dit probleem eerder gehad met dit script:

[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]vacatures[/COLOR][COLOR= #007700]] ==[/COLOR] pixelartiest[COLOR= #007700]){[/COLOR] ?>
Hier de tekst
[COLOR= #0000BB]<?php[/COLOR] [COLOR= #007700]}[/COLOR] ?>


Hiervoor had iemand deze oplossing:

[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]vacatures[/COLOR][COLOR= #007700]]) &&[/COLOR] [COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]vacatures[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]"pixelartiest"[/COLOR][COLOR= #007700]){[/COLOR] ?>
Hier de tekst
[COLOR= #0000BB]<?php[/COLOR] [COLOR= #007700]}[/COLOR]?>


Nu heb ik dit al geprobeerd:

[COLOR= #0000BB]<?php
    $page[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]p[/COLOR][COLOR= #007700]] &&[/COLOR] [COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]p[/COLOR][COLOR= #007700]];[/COLOR]
      [URL="http://www.php.net/if"]if[/URL][COLOR= #007700](![/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$page[/COLOR][COLOR= #007700]))
      {[/COLOR]
        [URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"menu/p_home.php"[/COLOR][COLOR= #007700]);
      }[/COLOR]
      [URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/file_exists"]file_exists[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700].[/COLOR] [COLOR= #0000BB]$page[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]".php"[/COLOR][COLOR= #007700]))
      {[/COLOR]
        [URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]""[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$page[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]".php"[/COLOR][COLOR= #007700]);
      }[/COLOR]
      [URL="http://www.php.net/else"]else[/URL]
      [COLOR= #007700]{[/COLOR]
        [URL="http://www.php.net/print"]print[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"opvraag pagina wanneer error"[/COLOR][COLOR= #007700]);
      }[/COLOR]
    ?>


Maar dat werkt niet weet iemand hoe die error er af kan.

PS als ik naar mijnsite.nl?p=menu/p_home ga dan zie die error niet meer.
Alleen vind ik het niet handig als de bezoeker naar mijnsite.nl gaat. om hem zo door te linken dat die error weg is. ik heb liever geen error smile
Ik graag een oplossing smile
0
Berichten
6.144
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php
$page[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]p[/COLOR][COLOR= #007700]];[/COLOR]
      [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$page[/COLOR][COLOR= #007700]))
      {[/COLOR]
        [URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"menu/p_home.php"[/COLOR][COLOR= #007700]);
      }[/COLOR]
      [URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/file_exists"]file_exists[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$page[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]".php"[/COLOR][COLOR= #007700]))
      {[/COLOR]
        [URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]".$page."[/COLOR][COLOR= #007700].[/COLOR]php"[COLOR= #007700]);
      }[/COLOR]
      [URL="http://www.php.net/else"]else[/URL]
      [COLOR= #007700]{[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]opvraag pagina waneer error[/COLOR][COLOR= #007700];
      }[/COLOR]
    ?>


Kijk eens of dat werkt.
0
Christum

Lid · Topicstarter

Berichten
921
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
hij geeft een error op lijn 9, dat hij onmogelijk is confused
Edit heb error gevonden je was een " vergeten yummie maar de error blijft als uit me eerste post sadley
0
Berichten
3.461
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Waarom file_exists();? Dat is toch alleen voor bestanden?
0
Christum

Lid · Topicstarter

Berichten
921
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
@josnl, ik weet niet heb het script ooit ergens gevonden maaar een pagina is ook een bestand zover ik weet yummie
0
Berichten
6.144
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik was geen " vergeten; had er juist 1 te veel.

$page = $_GET[p];
if(empty($page))
{
include("menu/p_home.php");
}
elseif(file_exists($page.".php"))
{
include($page.".php");
}
else
{
echo opvraag pagina waneer error;
}
?>
0
Christum

Lid · Topicstarter

Berichten
921
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
@jponsen de error blijft er zijn het is telkens lijn 2.

En hij zegt
Notice: Undefined index: p
dus ik denk dat hij de ?p= systeem niet leuk vind en ben overal al aan het zoeken maar mijn php is niet zo sterk dusja daarom vraag ik jullie hulp en iemand die daar wel goed in is is nu juist net dit weekend afwezig yummie
0
Berichten
6.144
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]p[/COLOR][COLOR= #007700]])) {[/COLOR]
    [URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"menu/p_home.php"[/COLOR][COLOR= #007700]);
}[/COLOR] [URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/file_exists"]file_exists[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]p[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]".php"[/COLOR][COLOR= #007700])) {[/COLOR]
    [URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]p[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]".php"[/COLOR][COLOR= #007700]);
}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]opvraag pagina waneer error[/COLOR][COLOR= #007700];
}[/COLOR]
?>


Raar trouwens, probeer deze eens
0
Christum

Lid · Topicstarter

Berichten
921
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Jponsen schreef:
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]p[/COLOR][COLOR= #007700]])) {[/COLOR]
    [URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"menu/p_home.php"[/COLOR][COLOR= #007700]);
}[/COLOR] [URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/file_exists"]file_exists[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]p[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]".php"[/COLOR][COLOR= #007700])) {[/COLOR]
    [URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]p[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]".php"[/COLOR][COLOR= #007700]);
}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]opvraag pagina waneer error[/COLOR][COLOR= #007700];
}[/COLOR]
?>
Raar trouwens, probeer deze eens

Deze werkt zonder error thumbsup pompomBedankt.

Hier kan een slotje op smile
0
Berichten
6.144
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Graag gedaan wink
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren