een error geven?

Gestart doorOne2xs8 reacties56 weergaven

9 berichten · pagina 1 van 1

One2xs

Bot · Topicstarter

Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
ik ben bezig met me site en heb nu dit:

[COLOR= #0000BB]<?php
$pagina[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]pagina[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$error[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]error[/COLOR][COLOR= #007700]];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"$error"[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/include"]include[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]"tools/page/$pagina.php"[/COLOR][COLOR= #007700]);[/COLOR]
?>


de bedoeling is dus dat als je tools.php?pagina=hoi doet dat er hoi.php word geincluded dat werkt
maar ik wil dus dat als hoi.php niet bestaat hij 404.php opent
dat lukt me niet

EDIT: en als er geen ?pagina= is word tools/page/index.php geincluded graag
0
Krm

Lid

Berichten
6.235
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
ik heb ff de code eruit gehaald mischien dat andere mensen hem ook nodig hebben daarom

[COLOR= #0000BB]<?php[/COLOR]
 
[COLOR= #FF8000]// get the name of the file the user wants to read.[/COLOR]
[COLOR= #0000BB]$file[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]page[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000].php[/COLOR][COLOR= #007700];[/COLOR] 
 
[COLOR= #FF8000]// check if the file exists.[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/file_exists"]file_exists[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$file[/COLOR][COLOR= #007700])) {[/COLOR]
 
    [COLOR= #FF8000]// it exists![/COLOR]
    [URL="http://www.php.net/include"]include[/URL] [COLOR= #0000BB]$file[/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]This page doesnt exist. Please try again.<br>[/COLOR][COLOR= #007700];
 
}[/COLOR]
 
?>
0
Berichten
35.796
Reputatie
1
Punten
0,00
Lid sinds
Laatst gezien
Moet je voor de grap eens ?page=index doen emo
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
Dan blijft ie oneindig includen biggrin
0
One2xs

Bot · Topicstarter

Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
maakt mij niks uit yummie
0
Berichten
35.796
Reputatie
1
Punten
0,00
Lid sinds
Laatst gezien
Je bent alleen wel door je dataverkeer heen als iemand er goed misbruik van maakt. Of je laat de server overbelast raken, ook leuk.
0
One2xs

Bot · Topicstarter

Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
hoe zet ik er dan beveiliing op?
want ik wil eigenlijk dus meerdere paginas op 1 pagina
dus hoefd niet persee ?page te zijn
0
Berichten
536
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
als je mijn link had gelezen had je dit gevonden:

[COLOR= #0000BB]<?php[/COLOR]
 
[COLOR= #FF8000]// check if the page is links?[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]page[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]links[/COLOR][COLOR= #007700]) {[/COLOR] 
 
    [URL="http://www.php.net/include"]include[/URL] [COLOR= #DD0000]links.php[/COLOR][COLOR= #007700];[/COLOR]
 
[COLOR= #FF8000]// check if the page is aboutMe?[/COLOR]
[COLOR= #007700]}[/COLOR] [URL="http://www.php.net/elseif"]elseif[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]page[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]aboutMe[/COLOR][COLOR= #007700]) {[/COLOR]
 
    [URL="http://www.php.net/include"]include[/URL] [COLOR= #DD0000]aboutme.php[/COLOR][COLOR= #007700];[/COLOR]
 
[COLOR= #FF8000]// could not find any of the pages?[/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]This page doesnt exist. Please try again.<br>[/COLOR][COLOR= #007700];
 
}[/COLOR]
 
?>
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