PHP=X Code

Soldato
Joined
9 Dec 2006
Posts
9,289
Location
@ManCave
looking for the script that allows, you to set links like ?phpx=home

i'm not sure what to search for, i need it be the secure version, & with Default page.

i tried searching for "php content script" "Php Nav Script"

thanks.
 
not using headers or footers :) its just one page that links to multiple sites/ info pages
just looking for the script :(
 
Last edited:
Any good? Call with page.php?x=file_to_include (without extension)

PHP:
<?php
echo includeContent($_GET['x']);

function includeContent($x) {
    // Default page if $x doesn't exist or
    // isn't specified
    $default = 'index';
    
    // File extension of the file to include
    // i.e. given $x=info we want to include
    // info.php
    $extension = '.php';
    
    // Only allow alphanumeric characters
    $x = preg_replace('/[^a-z0-9]/i', '', $x);
    
    // If $x isn't set then or $x doesn't exist
    // use the default page
    if ( !isset($x) || !file_exists($x.$extension) )
        $x = $default;
        
    // Just incase $default doesn't exist
    if (file_exists($x.$extension))
        include($x.$extension);
}
?>

Thanks a lot!. will use that soon.

Inq, i find this the easiest way, i been out of the coding area for a very long time & just wanted to get my site done the easiest way possible,

the site in question that will be using the code is www.smogsy.co.uk the content code will be used for the 3 coming soon links.
 
Back
Top Bottom