Forums

PHP

This topic is locked

user edit profile

Posted 12 Aug 2009 11:58:38
1
has voted
12 Aug 2009 11:58:38 isabel heylen posted:
Hi,

I'm making a site with Dreamweaver and PHP/MySQL.
The site is listing all vets from a certain area. The registrated clients/vets have a more profound access to this list (they can see the details of each vet, such as phone nmbr etc.) and should be able to edit their personal details (that are displayed in the above mentioned list).

Okay, so far so good:
- I have the default list displaying all items correctly,
- when a registrated user logs in, he/she is sent to the page listing all the vets, with links to the detailpage of each listing.
- also, once logged in, in the menu appears a link to "edit profile".

Now, if this last link (edit profile) is clicked, I want to display ONLY the details for the person that logged in (based on their username and password that they used to log in) and add a 'edit' button.

The problem/question I have is: "How to display only this one record, based on the login info (username & password)?"

At this point, when I try, I always get the profile info from the first user_id... (not the personal details from the person that logged in)..

Any suggestions?
Many thanks in advance!

rgds, isabel

Replies

Replied 12 Aug 2009 13:40:50
12 Aug 2009 13:40:50 Patrick Julicher replied:
Hi Isabel,

On the "Edit Profile"-page, create a recordset that filters the record of the user logged in. If you are using the standard DW login-behavior the recorset can be filtered by showing only the records ehere the Username-field corresponds with the session MM_UserName.

Use this recordset to show the details for the user logged in.

Hope this helps!

Kind regards, Patrick
Replied 12 Aug 2009 14:14:00
12 Aug 2009 14:14:00 isabel heylen replied:
QuoteOn the "Edit Profile"-page, create a recordset that filters the record of the user logged in. If you are using the standard DW login-behavior the recorset can be filtered by showing only the records ehere the Username-field corresponds with the session MM_UserName.

Use this recordset to show the details for the user logged in.


Hi Patrick,

Thanks for the fast feedback!

So, to resume: when a user is logged in and on the index.php-page clicks the 'edit profile' link, I redirect them to the edit.php-page as follows:
<a href="edit.php?username=<?php echo $row_rsUsers['username']; ?>">Edit profile</a>
.. correct?

I am using the standard DW login-behavior, but don't know how to "add" this filter (username against MM_username) in the advanced mode..

I'm also a bit confused on hów to take this info to the next page, I mean:
- first the user logged in and was taken to the index.php-page (so from login.php to index.php),
- now he's going to another page to edit his profile (so, from index.php to edit.php), and the login behavior is not on the current page (it was before arriving on the index.php-page),, how does the login info (username) can be taken from index.php to edit.php?..

many thx again (and sorry if I'm a bit slow in understanding)

best regards,
Isabel
Replied 12 Aug 2009 14:56:19
12 Aug 2009 14:56:19 Patrick Julicher replied:
Hi Isabel,

No worries on the speed understanding.

You don't have to pass the username in a URL parameter to the edit.php page. When a user logs in using the login behavior a Session is created. In PHP/MySQL, Dreamweaver creates a session variable called $_SESSION['MM_Username']. When you create the recordset on the edit.php page set the filter option. In the first field select the username column from the database. In the second field select =. In the third field select Session Variable. In the fourth field typ MM_Username. This will filter the data for the user that is logged in.

Kind regards, Patrick
Replied 01 Sep 2009 14:36:31
01 Sep 2009 14:36:31 isabel heylen replied:
Hi Patrick,

Sorry for the late reply (holidays came in between )..
I'll try this now & let you know if it worked out. Thanks again for your feedback!

Regards,
Isabel

Reply to this topic