Hello!
I am trying to understand how i could make a profile page for each of my members.
They all got an unique folder and i need to make something for the index.

I was thinking...can i get the last word in www.example.com/u/user22 and compare "user22" to the $_session;, and if the current session is not the same as the compared URL word the profile page will not show.

To be honest the part i dont understand is how i can split out the URL and get the last word..

HI you can you the server variable REQUEST_URI to find the url

$url = $_SERVER['REQUEST_URI'];

Then to split the string by '/' use

$str = $_SERVER['REQUEST_URI'];  // gets the url

$keywords = preg_split("/[\/]+/", $str);  // puts each split into an array

$i = count($keywords) -1; // get size of the array -1 corrects for starting at 0

$lastWord = $keywords[$i]; //gets the last value in the array

echo "$lastWord";

If you need to get rid of the file extension just repeat the split method Hope this helps

N

Do you need to create individual/static index pages for every member if you had 10,000 members you would need to have 10,000 member profile pages which doesn't make sense?

Would you not be better storing all the data relating to the member in a mysql database and then retrieving that data into 1 dynamic memberProfile.php?

$sql = "SELECT name, age, address FROM members WHERE memberid = '{$_SESSION['username']}'";
$result = mysql_query($sql);
if($result)
{
	$record = mysql_fetch_array($result);
printf("This is the profile of:%s There age is %s and live at %s",record['name'],record['age'],record['address']);
}
else
{
 	die ("Query Failed");
	end();
}

Just a thought :)

N

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.