Author |
Topic  |
|
rpain
Starting Member
United Kingdom
9 Posts |
Posted - 20 July 2004 : 12:14:53
|
Hi,
I know it must be straight forward but I've not been able to work it out. I just want to create a session variable "logid" with the user's member_id when they log in successfully and close the session variable when they log out. Would I add a couple of lines to the login.asp (or default.asp) files? I hate cookies and didn't quite know where I could extract this member_id from.
Any help most grateful.
Richard Pain |
|
Shaggy
Support Moderator
    
Ireland
6780 Posts |
Posted - 20 July 2004 : 12:50:40
|
Do you want to recode the forums completely to work off sessions or simply create a session variable to hold the member's ID? The former would take quite a bit of work but the latter would be simple enough.
|
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
 |
|
rpain
Starting Member
United Kingdom
9 Posts |
Posted - 20 July 2004 : 13:28:18
|
No - just the latter. I have the rest of the site set up to use a session variable to track the user and have linked the user registration with the forum (www.musician-online.com).
I do hate cookies, though...took me an hour to work out why the changes I were making to the site didn't make any difference.
Thanks
Richard
PS Love the quotes on your site  |
Edited by - rpain on 20 July 2004 13:40:51 |
 |
|
proeder
Junior Member
 
Australia
230 Posts |
Posted - 20 July 2004 : 19:04:38
|
??? The question is confusing though... A session stores per definition information in a cookie. No cookies - no session. |
Looking for german Snitz forum? Suchst Du ein deutsches Snitz Forum? Hier findest Du eins...
Hosting with ASP Support available: http://www.sharepointing.com |
 |
|
rpain
Starting Member
United Kingdom
9 Posts |
Posted - 21 July 2004 : 04:59:34
|
I didn't know that - thanks.
I'll try to explain more clearly. I had a forum system before which used a very similar set of tables as the snitz one - I think the system I'd managed to get hold of (http://www.asp-dev.com/forum/default.asp) seems to have been heavily based on the snitz code. A lot of the fields in the database were exactly the same. I started with this and built the rest of the site around it several years ago.
Anyway, I have a table called 'mol_members' which has 1100 users with several fields including email, username, password and member_id which I can now easily merge with the snitz members table.
I just want to create a session variable ("logid") to hold their member_id value when they log in correctly so the user can change other bits and pieces in their account (details of their work experience etc. which is all tracked by their member id). That's all
Thanks
Richard |
 |
|
chumbawumba
Junior Member
 
United Kingdom
304 Posts |
Posted - 21 July 2004 : 06:18:35
|
An easy way to do this is to add the line (shown in red below) to the chkUser function in inc_func_common.asp:
if rsCheck.BOF or rsCheck.EOF or not(ChkQuoteOk(fName)) or not(ChkQuoteOk(fPassword)) then
MemberID = -1
chkUser = 0 '## Invalid Password
if strDBNTUserName <> "" and chkCookie = 1 then
Call ClearCookies()
strDBNTUserName = ""
end if
else
MemberID = rsCheck("MEMBER_ID")
if (rsCheck("MEMBER_ID") & "" = fAuthor & "") and (cLng(rsCheck("M_LEVEL")) <> 3) then
chkUser = 1 '## Author
else
select case cLng(rsCheck("M_LEVEL"))
case 1
chkUser = 2 '## Normal User
case 2
chkUser = 3 '## Moderator
case 3
chkUser = 4 '## Admin
case else
chkUser = cLng(rsCheck("M_LEVEL"))
end select
end if
Session("logid")=MemberID 'id
end if
When the user logs out, the clearcookies sub will kill the session with the "session.abandon" code |
 |
|
rpain
Starting Member
United Kingdom
9 Posts |
Posted - 21 July 2004 : 12:01:04
|
That's fabulous. Just one very last thing - how do I get the cookie to clear (just like the logid session does) when the user closes the browser?
Many thanks for your time,
richard |
 |
|
Shaggy
Support Moderator
    
Ireland
6780 Posts |
Posted - 21 July 2004 : 13:01:11
|
Easiest way to do that is to remove the Save Password checkbox from the login form or, at least, change it so that it is unchecked by default just in case some of your members want to use this feature.
|
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
 |
|
|
Topic  |
|