Ashed
April 21st, 2004, 12:33
<?php
if (!isset($_GET['p'])) {
header("Location: index.php?p=news");
exit;
}
else {
if (isset($_GET['s'])) {
if (!file_exists("templates/".$_GET['p']."/".$_GET['s'].".ash")) {
header("Location: index.php?p=404_error");
exit;
}
else {
include("templates/header.ash");
include("templates/".$_GET['p']."/".$_GET['s'].".ash");
include("templates/footer.ash");
}
}
else {
if (!file_exists("templates/".$_GET['p']."/index.ash")) {
header("Location: index.php?p=404_error");
exit;
}
else {
include("templates/header.ash");
include("templates/".$_GET['p']."/index.ash");
include("templates/footer.ash");
}
}
}
?>
I don't know PHP that well but does this look alright? p are the main pages while s are p's subpages. Is there a way to make it shorter? :frown2:
if (!isset($_GET['p'])) {
header("Location: index.php?p=news");
exit;
}
else {
if (isset($_GET['s'])) {
if (!file_exists("templates/".$_GET['p']."/".$_GET['s'].".ash")) {
header("Location: index.php?p=404_error");
exit;
}
else {
include("templates/header.ash");
include("templates/".$_GET['p']."/".$_GET['s'].".ash");
include("templates/footer.ash");
}
}
else {
if (!file_exists("templates/".$_GET['p']."/index.ash")) {
header("Location: index.php?p=404_error");
exit;
}
else {
include("templates/header.ash");
include("templates/".$_GET['p']."/index.ash");
include("templates/footer.ash");
}
}
}
?>
I don't know PHP that well but does this look alright? p are the main pages while s are p's subpages. Is there a way to make it shorter? :frown2: