Click here to Skip to main content
16,018,805 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have profile pages in the style of profile.php?id=6 (or whatever the ID is) and i also have a myprofile.php page and they have different layouts. Say my id is 12, i want to be redirected to myprofile.php when i go to profile.php?id=12
How would i go about doing that?
Thanks
Posted
Comments
Sergey Alexandrovich Kryukov 24-Nov-13 15:11pm    
What is that supposed to mean, "being in an own profile"? I'm not joking; it might be a key to the solution.
—SA
Maciej Los 24-Nov-13 16:46pm    
Do you store id in any variable?

1 solution

I'm not sure if your concept is correct or constructive. I would suggest that you don't have a concept of "being on own profile", in other words, you don't have to have Web pages specific to a user.

For example of such approach, look at CodeProject. For example, click on
https://www.codeproject.com/script/Membership/Modify.aspx[^]
or
http://www.codeproject.com/script/Membership/ListContacts.aspx[^].

Every users access their own data through the same URL. At the same time, nothing prevents you from having some separate pages created per account. If you want to prevent other users (non-authenticated or users with different authentication record) to access such pages, you need to generate the page content on the server side (in your case, in PHP) and skip sensitive content or redirect the user to a different page. In both cases, you can always check up $_SERVER['PHP_AUTH_USER']. All your functions used to create any per-user content should be give a user id and address to user record (say, found in a user profile database).

Please see: http://php.net/manual/en/features.http-auth.php[^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900