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

I need help showing a users e-mail when they log in. Any help would be much appreciated!

Participant ,
May 12, 2009 May 12, 2009

Hi,

Now that I am able to show someones username after they login using the code below, how in the world do I get a page to show their e-mail. For example when they go to change their e-mail address in the settings in says next to the form "Your current e-mail is set as ..." how do I get it to show?

Username code:

<?php echo $_SESSION['MM_Username']; ?>

Is it at all similar to this?

Thank you for any help.

TOPICS
Server side applications
1.8K
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

Deleted User
May 14, 2009 May 14, 2009

Okay, if that so then u just need to pull the email variable from the recorset. To make the recorset, go to server behaviour > recordset. On filter field, choose username > session variable > MM_Username. Next, at the panel u may see "Bindings", click it and click at the recorset which u have made before to see all the variables in that recorset(click on plus +). Then u just need to drag that email variable onto your page. It's done!

Translate
Advisor ,
May 12, 2009 May 12, 2009

It is similar in that you use a session variable to display info from database after user has logged in. To show email you must create a session variable for table field of users email address in DB and echo the variable onto the page to display logged in users email address. So create session variable for users email address and echo session variable binding of email address to display on page.

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
Participant ,
May 12, 2009 May 12, 2009

But how does the Session variable know were to get its information? It only lets me name it not change its properties.

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
Advisor ,
May 12, 2009 May 12, 2009

You are talking about setting the binding for the session variable. That does not create the session variable, just the binding for it. Take a look here to see how to create a session variable. Once the session variable is set you can set the binding for it by the session variable name and then place binding onto page to show dynamic info for logged in user.  For php to add a session from linked tutorial add code similar to this adding info = to $sessFirstName where appropriate. You can add the session variable onto the page that your users login form is located on. Just add a registered session line and another line to define the newly-registered session variable.

<?php
session_start();
session_register("sessFirstName");
$sessFirstName = $XXXXXXXXXXXX;
?>

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 ,
May 13, 2009 May 13, 2009

<?php
session_start();
session_register("sessFirstName");
$sessFirstName = $XXXXXXXXXXXX;
?>

session_register() is deprecated, and won't work on all servers.

The correct way to set session variables is like this:

<?php

session_start();

$_SESSION['firstName'] = 'whatever';

?>

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
Advisor ,
May 13, 2009 May 13, 2009

Thanks for the clarification David just pasted code from Adobe kb article I linked in earlier post.

Perhaps Adobe should be informed to update their kb article.

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
Participant ,
May 13, 2009 May 13, 2009

Ok, now what do I insert in the "whatever" area? The table name or row or something of that sort?

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
Advisor ,
May 13, 2009 May 13, 2009

what do I insert in the "whatever" area?

Read the article I linked in earlier post.

Insert the variable = to email_address of logged in user from recordset into 'whatever' area.

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
Guest
May 13, 2009 May 13, 2009

I just want to ask, is the email stored in same table as with the username?

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
Participant ,
May 14, 2009 May 14, 2009

Yes it is.

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
Guest
May 14, 2009 May 14, 2009

Okay, if that so then u just need to pull the email variable from the recorset. To make the recorset, go to server behaviour > recordset. On filter field, choose username > session variable > MM_Username. Next, at the panel u may see "Bindings", click it and click at the recorset which u have made before to see all the variables in that recorset(click on plus +). Then u just need to drag that email variable onto your page. It's done!

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
Participant ,
May 15, 2009 May 15, 2009

Thank you very much for that simple easy to follow working answer. It is very appreciated.

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
Advisor ,
May 16, 2009 May 16, 2009

I guess I need to get familiar with DW's server behaviors if I want to be able to help in this forum. Nothing in QiQi86's reply seemed simple or easy for me to follow

I'm glad she was here!

--
Mark A. Boyd
Keep-On-Learnin' 🙂

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
Participant ,
May 17, 2009 May 17, 2009

Its alright. I know you tried to help. And I still appreciate it.

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
Advisor ,
May 18, 2009 May 18, 2009
LATEST

The method that QiQi86 suggested is effective but if a session variable was created like I was trying to explain earlier then you'd eliminate the need to create a filtered recordset on every page you wanted logged in users info displayed on. You'd simply need to start a session on your page by putting this on first line of php page:

<?php session_start(); ?>

Then echo your session variables on page where you want logged in users info like

<?php echo $_SESSION['logged_in_users_info']; ?>

It's really just the difference between two lines of code on your page to show logged in users info vs. filtered recordset on every page ~ I don't even know how many lines that is!

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
Advisor ,
May 14, 2009 May 14, 2009

I can't see your login code. Is the user's email address stored in another session variable the same way as MM_Username is? If not, just add this after the line that sets the username. (This assumes your login form has a field named 'email').

$_SESSION['email'] = $_POST['email'];

Then in your other pages,


<?php echo "Your current e-mail is set as {$_SESSION['email']}"?>

--
Mark A. Boyd
Keep-On-Learnin' 🙂

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