Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> url stuff
welbis
post Jan 13 2005, 03:50 PM
Post #1





Guests






if your website has sections in this form..

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

and you want it to show the same page at

www.domain.com/"pagename" 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.

CODE




/////////////////////////////////////////////////

/////////////////////////////////////////////////

/////////////////////////////////////////////////

$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 user



if($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
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Stuff for Msn Messenger ?(19)
  2. Weird stuff(0)
  3. Your Brain Is Cool(10)
  4. Free stuff Giveaway, like 1gb ram, ati radeon 9800 pro,or PC(12)
  5. Which is the beter stuff?(2)
  6. Legal Stuff(11)
  7. electronic stuff(5)
  8. got some stuff...(1)
  9. Cpanel not updating stuff(5)
  10. Stupid Stuff(28)
  11. Looking for painting related stuff(1)
  12. funny stuff(3)
  13. rock and stuff(0)
  14. Need stuff!(4)
  15. So much new stuff :D(39)
  1. I Need Help With Domain Stuff(3)
  2. Do Any Of You Actually Use Paint To Do Stuff?(13)
  3. Life And Stuff Anything Lol :)(0)
  4. I Formed Myself A Metal Band! ..but I Need Help.(5)


 



- Lo-Fi Version Time is now: 5th September 2008 - 05:40 AM