I have a site that I'm working on building. I have a login/registration system in place and a member profile system in place.
When a user logs in, they are automatically directed to their profile page. They have the option to click an edit profile link and edit their data. They can also click another link to go back to viewing their profile.
Currently this works great.
The issue I am having is that I have a link in the navigation bar called 'User List'. This link should fetch a list of all the current users in the database, which it does with uid=(appropriate user id #) at the end of the url, however, when you click on any of these links, the profile it returns is for that of the logged in user, and not that for the name that they clicked.
I am aware that the issue is caused by my function in the profile.php page which states:
<?php
include('core/init.inc.php');
$user_info = fetch_user_info($_SESSION['uid']);
?>
Since the profile page is being told to use the session uid, I understand that any redirect to the profile.php page will show the logged in users info.
So, if I change this function to $_GET['uid']' then my problems flip. I am able to correctly view the profiles for the users in the user list but then my logged in user can no longer view their profile or edit it since there is no call to the session uid.
So, I guess I'm wondering how I fix this. How do you separate profiles that are not for the logged in person vs their own individual profile? Please let me know what code you need to see and I'd be happy to post it.