This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Dreamweaver > March 2005 > Session variables ?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Session variables ?
VegaLA

2005-03-07, 11:17 pm

Hello all, I need some advice with Session Variables. I have ben
reading through the authentication section in the 'The Missing Manual' book for
Dreamweaver MX and it has been very helpfull. Using the session variable
mm_Username I have got the asp page to display the username of the user that
has logged in, however I would now like to use that to allow the user to edit
records they have created themselves. For example I have created a asp page
that allows them to book rooms in the office. They are booked by name, room and
time start and time finnish. The asp page that list all the rooms booked from
today onwards has also allows the users to edit the times by clicking the edit
text next to each record, however anyone who logs in can edit someone else's
booking. I would like it to only allow the person who booked the room/created
the record to be able to edit that particular record. I read through the
chapter in the book and typed in this code... <% IF Session('MM_Username') =
'UserN' THEN %><a
href='editbook.asp?id=<%=(rstBookList.Fields.Item('IDbk').Value)%>'>Edit</a><%
END IF %> ...however having tested it myself it does not work, all the edit
links have disapeared from the view and the one I created using my username is
also not displayed, the one record that should actually show. I realize that
the code above should not say 'usern' but the variable that is used for
username, however i do not know how to code this. Can anyone offer some advice
please ? Mitch....

Paul Whitham TMM

2005-03-08, 11:19 pm

It is not the session value on its own that you want to test on. I assume
that you have stored the users ID in the booking table then you would have
the following code

<% IF Session('MM_Username') = rstBookList.Fields.Item('Bookedid').Value
THEN %>
<a
href='editbook.asp?id=<%=(rstBookList.Fields.Item('IDbk').Value)%>'>Edit</a>
<% END IF %>


--
Regards

Paul Whitham
Macromedia Certified Professional for Dreamweaver MX2004
Valleybiz Internet Design
www.valleybiz.net

Team Macromedia Volunteer for Ultradev/Dreamweaver MX
www.macromedia.com/support/forums/team_macromedia

"VegaLA" <webforumsuser@macromedia.com> wrote in message
news:d0ipu2$t75$1@forums.macromedia.com...
> Hello all, I need some advice with Session Variables. I have ben
> reading through the authentication section in the 'The Missing Manual'

book for
> Dreamweaver MX and it has been very helpfull. Using the session variable
> mm_Username I have got the asp page to display the username of the user

that
> has logged in, however I would now like to use that to allow the user to

edit
> records they have created themselves. For example I have created a asp

page
> that allows them to book rooms in the office. They are booked by name,

room and
> time start and time finnish. The asp page that list all the rooms booked

from
> today onwards has also allows the users to edit the times by clicking the

edit
> text next to each record, however anyone who logs in can edit someone

else's
> booking. I would like it to only allow the person who booked the

room/created
> the record to be able to edit that particular record. I read through the
> chapter in the book and typed in this code... <% IF

Session('MM_Username') =
> 'UserN' THEN %><a
>

href='editbook.asp?id=<%=(rstBookList.Fields.Item('IDbk').Value)%>'>Edit</a>
<%
> END IF %> ...however having tested it myself it does not work, all the

edit
> links have disapeared from the view and the one I created using my

username is
> also not displayed, the one record that should actually show. I realize

that
> the code above should not say 'usern' but the variable that is used for
> username, however i do not know how to code this. Can anyone offer some

advice
> please ? Mitch....
>



Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews