Author |
Topic |
|
seven
Senior Member
USA
1037 Posts |
Posted - 19 January 2001 : 23:35:51
|
Hi...
Well my months of frustration are over. I finally figured out a way to really tie the forum into the rest of my site. I did this using session variables instead of cookies. (I hate cookies). Now a user is tracked throughout my site using a session variable called "MM_USERNAME" both in the site and in the forum. If anyone is actually interested in my sloppy (but functional) code, I can post it. Could use some cleaning up.
|
|
jlaw
Junior Member
USA
120 Posts |
Posted - 19 January 2001 : 23:54:01
|
I would like to see what you have done...post it.
|
|
|
seven
Senior Member
USA
1037 Posts |
Posted - 20 January 2001 : 00:31:55
|
Here's my code. I haven't eliminated the cookie code, so I think the code is sloppy right now, but it works like a champ. Your login pages throughout your site need to create the session MM_Username and MM_Password for this to work. Any comments?
in the file inc_top.asp
above this line: strDBNTUserName = Request.Cookies(strUniqueID & "User")("Name")
paste in: strDBNTUserName = Session("MM_USERNAME") ' ###### SESSION VARIABLE MOD ####
comment out: strDBNTUserName = Request.Cookies(strUniqueID & "User")("Name")
below this line: if (ChkUser2((strDBNTUserName), (Request.Cookies(strUniqueID & "User" ("Pword"))) = 0) then
paste in: if (Session("MM_USERNAME")) then %>
comment out: if (ChkUser2((strDBNTUserName), (Request.Cookies(strUniqueID & "User" ("Pword"))) = 0) then
in the file inc_functions.asp
the sub Docookies() last few lines should look like:
' Session("MM_USERNAME") = strDBNTFUserName Session("MM_USERNAME") = Request.Form("Name") Session("MM_PASSWORD") = Request.Form("Password") end sub
the sub clearcookies() last few lines should look like:
'Response.Cookies(strUniqueID & "User").Expires = dateadd("d", -2, strForumTimeAdjust) Session.Abandon() end sub |
|
|
seven
Senior Member
USA
1037 Posts |
Posted - 20 January 2001 : 01:23:50
|
I also have the updates for this to work with private messages... |
|
|
lcs78816
Junior Member
195 Posts |
Posted - 20 January 2001 : 06:10:37
|
can this work on pop_preview.asp? Cause preview functions is not language-friendly.
|
|
|
seven
Senior Member
USA
1037 Posts |
Posted - 20 January 2001 : 10:46:50
|
I don't understand the question or issue...
This mod doesn't effect pop_preview.asp |
|
|
slemieux
Junior Member
USA
234 Posts |
Posted - 20 January 2001 : 13:42:48
|
Session Variables vs Cookies has been brought up many times. The problem with session variables is they consume server resources, so if you have a busy board, your going to need to upgrade your server much sooner. They basically have the same function and with the ease of cookies in ASP, it just makes sense to use them.
Scott LeMieux NDesigns.net |
|
|
Doug G
Support Moderator
USA
6493 Posts |
Posted - 20 January 2001 : 14:09:42
|
Scott, Snitz has always used some Session variables anyway. The biggest resource jump is for the 1st one, after that session data isn't a big hit unless you store giant arrays, recordsets, etc in them.
Session data is a problem on web farms. Early asp implementations (like 1.0) had various resource allocation problems, but with IIS4 and up sessions are pretty well-behaved. There are some who dislike session data based on outdated information. There are good articles on MS and other sites about using session data. Used properly, they can be a valuable tool.
====== Doug G ====== |
|
|
slemieux
Junior Member
USA
234 Posts |
Posted - 20 January 2001 : 14:32:11
|
quote:
Scott, Snitz has always used some Session variables anyway. The biggest resource jump is for the 1st one, after that session data isn't a big hit unless you store giant arrays, recordsets, etc in them.
Your right Doug and session variables have their place. But what I am saying is if you have 100 users on your site and there are 200 sites on your server and they are all eating resources because of session vaiables your going to run into problems much quicker.
With an app like forums which are server intensive in the first place, why put an extra load on your server besides making it easier to integrate your entire site?
Scott LeMieux NDesigns.net |
|
|
Doug G
Support Moderator
USA
6493 Posts |
|
ruudb
Starting Member
Netherlands
2 Posts |
Posted - 12 April 2001 : 17:53:26
|
quote:
Here's my code. I haven't eliminated the cookie code, so I think the code is sloppy right now, but it works like a champ. Your login pages throughout your site need to create the session MM_Username and MM_Password for this to work. Any comments?
in the file inc_top.asp
above this line: strDBNTUserName = Request.Cookies(strUniqueID & "User")("Name")
paste in: strDBNTUserName = Session("MM_USERNAME") ' ###### SESSION VARIABLE MOD ####
comment out: strDBNTUserName = Request.Cookies(strUniqueID & "User")("Name")
below this line: if (ChkUser2((strDBNTUserName), (Request.Cookies(strUniqueID & "User" ("Pword"))) = 0) then
paste in: if (Session("MM_USERNAME")) then %>
comment out: if (ChkUser2((strDBNTUserName), (Request.Cookies(strUniqueID & "User" ("Pword"))) = 0) then
in the file inc_functions.asp
the sub Docookies() last few lines should look like:
' Session("MM_USERNAME") = strDBNTFUserName Session("MM_USERNAME") = Request.Form("Name") Session("MM_PASSWORD") = Request.Form("Password") end sub
the sub clearcookies() last few lines should look like:
'Response.Cookies(strUniqueID & "User").Expires = dateadd("d", -2, strForumTimeAdjust) Session.Abandon() end sub
Airilm
I have the error below. Do you know how to solve this?
Ruudb
Snitz Forums 2000 Home | Profile | Register | Active Topics | Members | Search | FAQ Microsoft VBScript runtime fout '800a000d' Type mismatch: '[string: "admin"]'
/teamwork/forum/inc_top.asp, regel 194
|
|
|
ruudb
Starting Member
Netherlands
2 Posts |
Posted - 12 April 2001 : 17:53:35
|
quote:
Here's my code. I haven't eliminated the cookie code, so I think the code is sloppy right now, but it works like a champ. Your login pages throughout your site need to create the session MM_Username and MM_Password for this to work. Any comments?
in the file inc_top.asp
above this line: strDBNTUserName = Request.Cookies(strUniqueID & "User")("Name")
paste in: strDBNTUserName = Session("MM_USERNAME") ' ###### SESSION VARIABLE MOD ####
comment out: strDBNTUserName = Request.Cookies(strUniqueID & "User")("Name")
below this line: if (ChkUser2((strDBNTUserName), (Request.Cookies(strUniqueID & "User" ("Pword"))) = 0) then
paste in: if (Session("MM_USERNAME")) then %>
comment out: if (ChkUser2((strDBNTUserName), (Request.Cookies(strUniqueID & "User" ("Pword"))) = 0) then
in the file inc_functions.asp
the sub Docookies() last few lines should look like:
' Session("MM_USERNAME") = strDBNTFUserName Session("MM_USERNAME") = Request.Form("Name") Session("MM_PASSWORD") = Request.Form("Password") end sub
the sub clearcookies() last few lines should look like:
'Response.Cookies(strUniqueID & "User").Expires = dateadd("d", -2, strForumTimeAdjust) Session.Abandon() end sub
Airilm
I have the error below. Do you know how to solve this?
Ruudb
Snitz Forums 2000 Home | Profile | Register | Active Topics | Members | Search | FAQ Microsoft VBScript runtime fout '800a000d' Type mismatch: '[string: "admin"]'
/teamwork/forum/inc_top.asp, regel 194
|
|
|
work mule
Senior Member
USA
1358 Posts |
Posted - 13 April 2001 : 10:05:52
|
quote:
I did this using session variables instead of cookies. (I hate cookies).
You stated that you hate cookies and your using sessions instead of cookies.
I don't know if you're aware of this, but technically speaking, sessions utilize cookies too!
Here's a line out of an asp book: The actual sessionID information is stored as a cookie with no expiry date set, so that it expires when the client browser is closed down.
The only difference is that your only storing the ID and not all the other information in the cookie, and the expiration date is not set. So you could do the same with the plain 'ol cookie too. If someone comes to your site with cookies turned off, then your session variables won't work either.
|
|
|
seven
Senior Member
USA
1037 Posts |
Posted - 13 April 2001 : 11:11:37
|
I think it was more of change to get the forum to work within my site. I still haven't figured everything out. That's why my rank is only "new member". Maybe there should be an effort to put url parameters as an option to track users in the forum? |
|
|
work mule
Senior Member
USA
1358 Posts |
Posted - 13 April 2001 : 12:51:42
|
I know this doesn't help you now since you already did the conversion to using session variables, but for future reference maybe it's useful.
In the admin area, there are two settings to look at.
In the Main Forum Configuration Form, there is an option to set Cookie to either the Forum or the Website. If set to the website, then it's available anywhere on the domain.
In the Feature Configuration Form, there is an option for Non-Cookie mode which would do use the URL (Querystring) method.
|
|
|
Brent Trevel
Junior Member
Canada
122 Posts |
Posted - 13 April 2001 : 15:27:44
|
quote:
I know this doesn't help you now since you already did the conversion to using session variables, but for future reference maybe it's useful.
In the admin area, there are two settings to look at.
In the Main Forum Configuration Form, there is an option to set Cookie to either the Forum or the Website. If set to the website, then it's available anywhere on the domain.
In the Feature Configuration Form, there is an option for Non-Cookie mode which would do use the URL (Querystring) method.
This above technique is the one I chose to implement on my web site to enable logins throughout instead of just from the Forum. Then, I simply included a inc_login.asp page (which is an edited version of inc_top.asp) into all my pages to check/allow logins/logouts.
If my demo site is still up (who knows, CFM-Resources has been crazy lately...) you can see this in action. (Or just visit Alan's site at www.iamviet.com )
Demo of all site pages using same forum login www.freecfm.com/n/ninjaman/" target="_blank">http://www.freecfm.com/n/ninjaman/
Demo user id: dwerty demo user pass: qwerty
I guess it's too late to help now, but, maybe when the new version of the forum comes out, you might want to change?
Sincerely,
Brent Trevel, Combat Intelligence www.combatintelligence.com |
|
|
|
Topic |
|