Hoe kan ik dit het beste doen?

Gestart doorSebastiaanh28 reacties60 weergaven

29 berichten · pagina 1 van 2

Sebastiaanh

Lid · Topicstarter

Berichten
9.953
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hallo,

Ik heb een scriptje gemaakt, alleen als ik ?p=home doe, geeft hij de 404 pagina weer, en als ik ?p=home.php doe, laat hij wel de pagina zien. Ik wil juist dat hij het wel doet bij ?p=home.

[COLOR= #0000BB]<?php
    $p[/COLOR] [COLOR= #007700]=[/COLOR] scandir[COLOR= #007700]([/COLOR][COLOR= #DD0000]pagina[/COLOR][COLOR= #007700]);[/COLOR]
    [URL="http://www.php.net/unset"]unset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$p[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700]],[/COLOR] [COLOR= #0000BB]$p[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]1[/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]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]p[/COLOR][COLOR= #007700]]) &&[/COLOR] [URL="http://www.php.net/in_array"]in_array[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"{$_GET[p]}.php"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$p[/COLOR][COLOR= #007700])){[/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]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]p[/COLOR][COLOR= #007700]].[/COLOR]php[COLOR= #007700])){[/COLOR]
        [URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]error/404.php[/COLOR][COLOR= #007700]);
    }[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
        [URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"pagina/{$_GET[p]}.php"[/COLOR][COLOR= #007700]);
    }
    }[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
        [URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"pagina/home.php"[/COLOR][COLOR= #007700]);
    }[/COLOR]
?>


Mvg,
Sebastiaanh
0
Berichten
1.631
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Rik schreef:
Heya,

Ik hoor weer superveel mensen va "Hoe kan ik php of html weg laten", en die mensen die hebben kennelijk niet echt gegoogled, maar om het toch voor eens en voor altijd op one2xs te hebben:

Stappenplan
Maak een bestand op de server aan dat .htaccess heet. Niet htaccess.txt niet htaccess.html maar gewoon .htaccess
Vervolgens zet je er de volgende code in:
Options FollowSymLinks MultiViews


En je bent klaar

~ Rik
0
Sebastiaanh

Lid · Topicstarter

Berichten
9.953
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Werkt niet.
0
Berichten
1.631
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Heb hier nog ergens ook zn script even zoeken.

toevoeging op 17 februari 2012, 15:42:55:

$pagina = $_GET["p"];
           $map = pages;

           if ($pagina == ""){
           include("$map/home.php");

           }else{

           if (file_exists("$map/$pagina.php")){
           include("$map/$pagina.php");

           }else{
           include("$map/404.php");

           }
           }
           ?>


Deze doet het wel ?
0
Berichten
3.112
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Oeps, foutje. Moment!
0
Marv

Lid

Berichten
3.092
Reputatie
1
Punten
0,21
Lid sinds
Laatst gezien
Ok..
0
Sebastiaanh

Lid · Topicstarter

Berichten
9.953
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dat werkt al helemaal niet, Efferinie.
0
Marv

Lid

Berichten
3.092
Reputatie
1
Punten
0,21
Lid sinds
Laatst gezien
Sebastiaanh schreef:
Dat werkt al helemaal niet, Efferinie.
Die nieuwe die ik heb gepost dan? redface
0
Sebastiaanh

Lid · Topicstarter

Berichten
9.953
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Die ga ik niet gebruiken, ik wil gewoon deze gebruiken. yummie
0
Berichten
3.112
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dan moet je je probleem even wat beter uitleggen, want ik snap het niet sadley
0
Sebastiaanh

Lid · Topicstarter

Berichten
9.953
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Het is toch duidelijk genoeg?
0
Marv

Lid

Berichten
3.092
Reputatie
1
Punten
0,21
Lid sinds
Laatst gezien
Sebastiaanh schreef:
Die ga ik niet gebruiken, ik wil gewoon deze gebruiken. yummie
Eigenwijs kun je zijn zeg wink
0
Sebastiaanh

Lid · Topicstarter

Berichten
9.953
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hoezo, ik wil dat script gewoon niet. emo
0
Berichten
1.631
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Wouterp schreef:
Heb hier nog ergens ook zn script even zoeken.
toevoeging op 17 februari 2012, 15:42:55:

$pagina = $_GET["p"];
           $map = pages;

           if ($pagina == ""){
           include("$map/home.php");

           }else{

           if (file_exists("$map/$pagina.php")){
           include("$map/$pagina.php");

           }else{
           include("$map/404.php");

           }
           }
           ?>


Deze doet het wel ?
0
Berichten
3.112
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Sebastiaanh schreef:
Het is toch duidelijk genoeg?
Ja zeker, daarom vraag ik of je het extra uit wil leggen omdat ik het niet snapaah
In ieder geval:

[COLOR= #0000BB]<?php
    $p[/COLOR] [COLOR= #007700]=[/COLOR] scandir[COLOR= #007700]([/COLOR][COLOR= #DD0000]pagina[/COLOR][COLOR= #007700]);[/COLOR]
    [URL="http://www.php.net/unset"]unset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$p[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700]],[/COLOR] [COLOR= #0000BB]$p[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]1[/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= #DD0000]""[/COLOR][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/in_array"]in_array[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]p[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]".php"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$p[/COLOR][COLOR= #007700])){[/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]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]p[/COLOR][COLOR= #007700]]}.[/COLOR]php[COLOR= #007700])){[/COLOR]
        [URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]error/404.php[/COLOR][COLOR= #007700]);
    }[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
        [URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"pagina/"[/COLOR][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/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"pagina/home.php"[/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