Jump to content
xisto Community
Sign in to follow this  
iGuest

url stuff

Recommended Posts

if your website has sections in this form..

http://www.domain.com/?page="pagename"

and you want it to show the same page at

http://forums.xisto.com/no_longer_exists/" aswell...

then this might help... i suggest you just take bits of it out and use them yourself, cos this is very specific to my site.

It should be in the 404.php file.

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////$url = $_SERVER["REQUEST_URI"];$url2 = substr($url, 1,1);if($url2 !== "?" && isset($url)) {$url = substr(strrchr($url, "."), 1, 4);//if the string appended to the domain doesnt end in php..check if its a userif($url !== "php") {//////////////////////////////////////////////////////////////////////////////////////////////////$url = $_SERVER["REQUEST_URI"];$url = substr($url, 1);$users = mysql_query("SELECT * FROM users WHERE username='$url' AND activated='1'");$num = mysql_num_rows($users);if ($num) {while($user=mysql_fetch_array($users)) {/////////////if the string is a user, then set the variables to that it parses the users page$page = "users";$sectionarea = $page.' - '.$url;$a = "$url";$val = 1;/////////}} else {//get all the text after '?'$url2 = strstr($url, '?');if($url2) {$url = strrchr(strrev($url), "?");$url = substr($url, 1);$url = strrev($url);$sectionarea = (ucfirst($url));} else {$sectionarea = (ucfirst($url));}}//////////////////////////////////////////////////////////////////////////////////////////////////}}if($url2 == "?" || empty($url)) {$sectionarea = $_GET['page'];if(!$sectionarea) {$sectionarea = Home;} else {$sectionarea = ucfirst($sectionarea);}}///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

After this...

include the content, and navigate through it to show certain content when the variable $sectionarea is equal to certain things.

I.e. if it is Home... then display the home page, if it is News, then display the news blah blah

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.