Get ready for BLACK FRIDAY shopping starting in

Forums

ASP

This topic is locked

Log in user and use USERNAME as session variabele

Posted 25 Jan 2004 23:40:23
1
has voted
25 Jan 2004 23:40:23 Rene Bandsma posted:
I have created a simple log-in page in DMX and when the user logs in the gain access to 'access.asp'.

In the 'access.asp' page I want to create something that says "Hi Rob".

Beside the username and password I have stored their real name, address and telephone numer in one record.

When "Rob" is logged in, my ASP pages have to remember this record during their session.

I thought this was very easy with click-and-go in DMX2004... but I can't get it to work.

Does anybody has ideas of a tutorial?

Replies

Replied 26 Jan 2004 00:12:13
26 Jan 2004 00:12:13 Dave Thomas replied:
it is click and go in a sense.

you dont have to write no session code, all you have to do is assign a session variable and its done.

in the Bindings panel, chosse "SESSION VARIABLE" and enter <b>MM_UserName</b> (case sensitive)

theres a session created for a user who logs in. voila.

now underneath the session menu in bindings, you will see the session MM_UserName with a little lightning symbol next to it.
Drag this onto your page where you wish to display the persons name.

so it should look like this.

<pre id=code><font face=courier size=2 id=code>Hi &lt;%= Session("MM_UserName" %&gt; </font id=code></pre id=code>

with the &lt;%= replacing response.write

hope that helps.

Regards,
Dave

[DWMX 2004]|[FlashMX 2004 Pro]|[Studio MX 2004]|[SQL]|[Access2000/2002]|[ASP/VBScript]|[XP-Pro]
If you like online gaming, please register @ www.nova-multigaming.com
Replied 26 Jan 2004 00:23:37
26 Jan 2004 00:23:37 Rene Bandsma replied:
WOW! Stunning... (it works <img src=../images/dmxzone/forum/icon_smile_big.gif border=0 align=middle>

I thought already it would be easy!

Many thanx UltraDev for your reply!
Replied 25 Feb 2004 16:19:16
25 Feb 2004 16:19:16 david pearson replied:
Hello,

I have just read the rest of the post and managed to get the idea of it working in Dreamweaver. I was wondering if it was possible to be able to pull the name(s) of the user that has logged in from a different table within the database.

The situation I have is that the usernames and passwords are in one table, and this is linked to 2 more tables (staff and pupils). In the username table I have each record linked to either the pupil or staff table, depending on whom the account is for. I was wondering if it would be possible to display the name(s) of the user that is logged in not matter who it is. I am thinking I need some kind of SQL statement that will be linked to the username table and then goes and searches into the other table.

Also is there a way of checking whether a user is logged in on a page and whether they have access to the page, as I am trying to create a secure site that will restrict pupils and staffs access to certain parts of the site. I was thinking a session variable but not sure how I would go about implementing this.

Hope someone can help.

Cheers

David Pearson
<font face='Arial'></font id='Arial'>
Replied 26 Feb 2004 13:08:48
26 Feb 2004 13:08:48 Rene Bandsma replied:
Sure it is possible. Just link the two tables.

The Id's of the UserName table should be the same as the Detail table's. Then 1 UserName can have more records in the Detailtable.

It is called Master-Detail I think.

Reply to this topic