Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Creating member login and update of their own profile

Community Beginner ,
Jul 06, 2010 Jul 06, 2010

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

TOPICS
Server side applications
2.7K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Beginner , Jul 06, 2010 Jul 06, 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

...
Translate
Community Beginner ,
Jul 06, 2010 Jul 06, 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.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 07, 2010 Jul 07, 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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 07, 2010 Jul 07, 2010

You can create as many session variables as you need.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 07, 2010 Jul 07, 2010

I imagine, but how to do that?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 08, 2010 Jul 08, 2010

//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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 08, 2010 Jul 08, 2010
LATEST

Thank you; I will now try it.

Actually I have been working with PHP before but without Dreamweaver so everything was slightly different...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 08, 2010 Jul 08, 2010

Patricio,

I am posting to express my utmost gratitude for your very detailed response. This not only was the correct answer, but it allowed me to complete my entire member login/logout and update process without any additional frustration. I have posted on this (and many other) forums, trying to find a solution, since I am very new to building dynamic web sites. All I have received is one-line answers of "just do this," but for a newbie like me, I needed the step-by-step that you provided. Thank you again for taking the time to walk me through this. I know others will benefit as I have.

Gail

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines