adrianman
05-19-2004, 02:21 AM
I'm new to PHP...
Anyway, I need help with a scriot on index.php. I have a script that has files stored in the /pages directory and let's say if dsppoou.php was in there, I could go to index.php?page=dsppoou.php.
I want help redirecting the plain index.php to ?page=index.
Here is the code if it helps:
<?
// Get PAGES
$directory = "pages/";
$pages = array();
if ( $dir = opendir( $directory ) ) {
while( ($file = readdir( $dir ) ) !== false ) {
$added = false;
foreach( $pages as $p ) {
if ( $file == $p ) {
$added = true;
}
}
if ( $added ) {
continue;
}
$pages[count($pages)] = $file;
}
}
for ( $x=0; $x<=count($pages); $x++ ) {
if ( $admin != "" ) {
break;
}
if ( $x == count($pages) ) {
AddTable("Error!","The specified page could not be found. Please check the GET ID.");
break;
}
if ( $page.".php" == $pages[$x] ) {
include("pages/".$pages[$x]);
break;
}
}
?>
Thanks for your time. :D
Anyway, I need help with a scriot on index.php. I have a script that has files stored in the /pages directory and let's say if dsppoou.php was in there, I could go to index.php?page=dsppoou.php.
I want help redirecting the plain index.php to ?page=index.
Here is the code if it helps:
<?
// Get PAGES
$directory = "pages/";
$pages = array();
if ( $dir = opendir( $directory ) ) {
while( ($file = readdir( $dir ) ) !== false ) {
$added = false;
foreach( $pages as $p ) {
if ( $file == $p ) {
$added = true;
}
}
if ( $added ) {
continue;
}
$pages[count($pages)] = $file;
}
}
for ( $x=0; $x<=count($pages); $x++ ) {
if ( $admin != "" ) {
break;
}
if ( $x == count($pages) ) {
AddTable("Error!","The specified page could not be found. Please check the GET ID.");
break;
}
if ( $page.".php" == $pages[$x] ) {
include("pages/".$pages[$x]);
break;
}
}
?>
Thanks for your time. :D