Skip to main content
Inspiring
July 6, 2010
Answered

Creating member login and update of their own profile

  • July 6, 2010
  • 1 reply
  • 2798 views

This is what I am trying to create: a "members only" area of a Web site where the members can log in, view their contact information from our membership database, and  update it if need be. Of course they can't be able to see anyone else's  information.They are logging in using their email address and an assigned (dummy) password, which they will have to change when their profile pops up.

This is what I have: a login page that redirects to an update_user.php page upon successful login. The redirect is working, but the page is not automatically populated with the member's information. I put a hidden field on the login page that has a value of user_id (the primary key in my database), pulled from a recordset of getUser--hoping that this would get passed to the update_user.php page. This is the way my Delete User page works. But it isn't working in this case - the update user page still opens up blank. If anyone could help with this vexing problem I would greatly appreciate it.

Gail

This topic has been closed for replies.
Correct answer patriciofuert

>but the page is not automatically populated with the member'sinformation

If you are using PHP/MySQL then all you need to do is:

  1. Create a page you want the members profile to be displayed on.
  2. Create a recordset using the "simple" mode.
  3. Then use the filter dropdown menu to select the column name "user_email" (Note: The column you are using to store the users email in)
  4. Make it "="
  5. "Session Variable" and in the text field next to this type this: MM_Username

So it should look in the recordset menu sort of like this:

 
Name:
Connections:
Table:
Columns:

            

     

Filter:
Sort:

  1. Then click "OK"
  2. Now make the page restricted. Go to the panel Server Behaviors--> User Authentication--> Restrict Access to Page
  3. And then go to the panel Server Behaviors--> User Authentication--> Log Out User
  4. Next go to the "Bindings Panel" click on the "+"symbol and then highlight the field you want to display. Click the insert button at the bottom of the "Bindings Panel". You can only insert one field at a time.

And there you go. A "Profile Page" is created.

For the "Update Page" follow the same steps as above but eliminate the "Bindings Panel" step. Instead use the "Update Record Wizard" to make the profile update page.
  (Remember to create the recordset the same as I described above. This is mandatory to for restricted pages to be user profile related)

Explanation of the above process is that when you create a login page with the DreamWeaver function "Log In User", DreamWeaver creates in the code view this:

//declare two session variables and assign them
              $_SESSION['MM_Username'] = $loginUsername;
              $_SESSION['MM_UserGroup'] = $loginStrGroup;

  • So "MM_Username" is needed to be the "Session Variable" in every restricted page that will relate to the logged in user's profile.
  • The page needs to be restricted in order for a "Session Variable" to exist.
  • And of course a "Log Out" button is nice to allow the user to log out.

1 reply

patriciofuertCorrect answer
Participant
July 7, 2010

>but the page is not automatically populated with the member'sinformation

If you are using PHP/MySQL then all you need to do is:

  1. Create a page you want the members profile to be displayed on.
  2. Create a recordset using the "simple" mode.
  3. Then use the filter dropdown menu to select the column name "user_email" (Note: The column you are using to store the users email in)
  4. Make it "="
  5. "Session Variable" and in the text field next to this type this: MM_Username

So it should look in the recordset menu sort of like this:

 
Name:
Connections:
Table:
Columns:

            

     

Filter:
Sort:

  1. Then click "OK"
  2. Now make the page restricted. Go to the panel Server Behaviors--> User Authentication--> Restrict Access to Page
  3. And then go to the panel Server Behaviors--> User Authentication--> Log Out User
  4. Next go to the "Bindings Panel" click on the "+"symbol and then highlight the field you want to display. Click the insert button at the bottom of the "Bindings Panel". You can only insert one field at a time.

And there you go. A "Profile Page" is created.

For the "Update Page" follow the same steps as above but eliminate the "Bindings Panel" step. Instead use the "Update Record Wizard" to make the profile update page.
  (Remember to create the recordset the same as I described above. This is mandatory to for restricted pages to be user profile related)

Explanation of the above process is that when you create a login page with the DreamWeaver function "Log In User", DreamWeaver creates in the code view this:

//declare two session variables and assign them
              $_SESSION['MM_Username'] = $loginUsername;
              $_SESSION['MM_UserGroup'] = $loginStrGroup;

  • So "MM_Username" is needed to be the "Session Variable" in every restricted page that will relate to the logged in user's profile.
  • The page needs to be restricted in order for a "Session Variable" to exist.
  • And of course a "Log Out" button is nice to allow the user to log out.
Participating Frequently
July 7, 2010

I have one more question. Is there any way to create more $_SESSION variables, than only those given by Dreamweaver? For example $_SESSION["user_id"] or something like that?

Participating Frequently
July 8, 2010

I imagine, but how to do that?


//I imagine, but how to do that?

patriciofuert alread showed you - look at the bottom of their post where it shows how to declare and assign session variables. Before going any further you should really learn the basics of the scripting language you are working with. Trying to jump into the middle without knowing the basics is going to be frustrating.