Skip to main content
Known Participant
January 7, 2010
Answered

Where to place $Session MM_Username

  • January 7, 2010
  • 2 replies
  • 1570 views

I know the code for the $session to make a username but where exactly do I place it on my login page so that it creats the variable and then where exactly do I place the code to display that session on one of my pages?

This topic has been closed for replies.
Correct answer David_Powers

I know I created a correct Session variable because dreamweaver automatically did it for me when I made my login page and because my restrict access to page functions work.


Just pause for a moment to reflect on what you have just written. You say you know you have created a correct session variable because Dreamweaver did it for you. At the same time, you say it doesn't display. Doesn't that tell you that something is wrong somewhere? If the session variable has been created correctly - and you're using it correctly - it should display. But without showing others any of your code, there's no way anyone can tell you why it's not working.

Relying on Dreamweaver to do everything for you automatically is a recipe for frustration.

2 replies

David_Powers
Inspiring
January 8, 2010

See the following article: http://cookbooks.adobe.com/post_Display_user_s_name_and_other_details_after_login-16672.html.


Known Participant
January 11, 2010

Thank you Mr.Power you have pointed me to that same link before but I have successfully created a session variable but when i try to display it it won't display.

David_Powers
Inspiring
January 11, 2010

gabessdsp wrote:

I have successfully created a session variable but when i try to display it it won't display.

If it fails to display, you have NOT successfully created a session variable. First of all, you need to use session_start(); before you can work with session variables. Secondly, your subject line refers to $Session MM_Username. That's complete nonsense in PHP. It's $_SESSION['MM_Username']. Correct syntax is vital when working with a server-side language like PHP.

Participating Frequently
January 7, 2010

You would create and assign the session variable after the user is authenticated. To display it, put it on the page exactly where you want it to appear. Right?