Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Help Groups for Snitz Forums 2000 Users
 Help: General / Classic ASP versions(v3.4.XX)
 Create userid session on login.
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

rpain
Starting Member

United Kingdom
9 Posts

Posted - 20 July 2004 :  12:14:53  Show Profile  Visit rpain's Homepage
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  Show Profile
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.”
Go to Top of Page

rpain
Starting Member

United Kingdom
9 Posts

Posted - 20 July 2004 :  13:28:18  Show Profile  Visit rpain's Homepage
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
Go to Top of Page

proeder
Junior Member

Australia
230 Posts

Posted - 20 July 2004 :  19:04:38  Show Profile  Visit proeder's Homepage
??? 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
Go to Top of Page

rpain
Starting Member

United Kingdom
9 Posts

Posted - 21 July 2004 :  04:59:34  Show Profile  Visit rpain's Homepage
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
Go to Top of Page

chumbawumba
Junior Member

United Kingdom
304 Posts

Posted - 21 July 2004 :  06:18:35  Show Profile
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
Go to Top of Page

rpain
Starting Member

United Kingdom
9 Posts

Posted - 21 July 2004 :  12:01:04  Show Profile  Visit rpain's Homepage
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
Go to Top of Page

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 21 July 2004 :  13:01:11  Show Profile
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.”
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 2.4 seconds. Powered By: Snitz Forums 2000 Version 3.4.07