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

 All Forums
 Snitz Forums 2000 DEV-Group
 DEV Bug Reports (Closed)
 Bug+Fix: Password protected forums
 Forum Locked  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

therookery
Starting Member

29 Posts

Posted - 25 July 2002 :  12:37:17  Show Profile  Visit therookery's Homepage
We're using Snitz Forums 3.3.03 at www.orlando-guide.info/forums and have the following problem with password protected topics:

When you are logged in with a persistent login cookie (as all users
do) if you enter a password to enter a password protected forum, it
turns your persistent cookie into a session cookie and next time you
come to the forums you have to log in again from scratch :(

I've had a look at the code and have an idea where to look but could anyone just confirm any quick pointers as to where in the code I might look to quickly fix this?

Thanks

John




Edited by - ruirib on 29 July 2002 14:40:06

Edited by - Davio on 30 July 2002 14:53:07

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 25 July 2002 :  20:08:59  Show Profile  Send ruirib a Yahoo! Message
I think it's at the chkUser4 function in inc_functions.asp.

-------------------------------------------------
Installation Guide | Do's and Dont's | MODs
Go to Top of Page

therookery
Starting Member

29 Posts

Posted - 27 July 2002 :  09:32:03  Show Profile  Visit therookery's Homepage
Thanks ruirib.

I've nnow narrowed it down to the fact that as soon as you enter a passowrd in a password protected category, the forum cookie is deleted from the hard disk. I've checked the chkUser4 function and it does not happen in there so must presumably be somewhere in topics.asp.

Anyone any ideas?

John

Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 27 July 2002 :  10:34:21  Show Profile  Send ruirib a Yahoo! Message
I believe the problem is with both chkUser4 and chkForumAccess functions.

Ok, here is what I think. As much as I could find, these functions have a common bug. According to my ASP book, if you change a value in a multiple value cookie, with ASP, all other existing values are lost. In order for those values not to be lost, you need to write them again. Since the problem in these functions is that it's setting a new value to the Snitz00User cookie, all the other values set to the user are lost.

A way out of this, I thought, would be to set the password for forum access in another cookie, say Snitz00Forum. This seems to have worked, but you also need to change the ChkForumAccess function in the same way. So, what do you need to change to get this working:

1. In ChkUser4 and chkForumAccess you need to change every ocurrence of


Request.Cookies(strUniqueID & "User")("PRIVATE_" & rsStatus("F_SUBJECT"))


by


Request.Cookies(strUniqueID & "Forums")("PRIVATE_" & rsStatus("F_SUBJECT"))


Of course, you can use a different name other than Forums.

2. You also need to change in the same functions


Response.Cookies(strUniqueID & "User").Path = strCookieURL


for


Response.Cookies(strUniqueID & "Forums").Path = strCookieURL


Of course this is an overall solution. To fix your problem you only need to change the setting of cookie values in the lines corresponding to password protected forums (corresponding to case 2 in the functions code), but this solution will also solve your problem for mixed types of forum access (members and password or allowed members list and password).

Hope this is clear. I will be moving this to the bug forum later on.
-------------------------------------------------
Installation Guide | Do's and Dont's | MODs


Edited by - ruirib on 27 July 2002 12:02:54
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 29 July 2002 :  14:42:45  Show Profile  Send ruirib a Yahoo! Message
Bumping this. I've just moved this to the bug forums and want it to be seen.

-------------------------------------------------
Installation Guide | Do's and Dont's | MODs
Go to Top of Page

therookery
Starting Member

29 Posts

Posted - 29 July 2002 :  15:19:38  Show Profile  Visit therookery's Homepage
Thanks for the solution ruirib.

I've enhanced it slightly by substituting pForum_ID (in chkUser4) and fForum (in chkForumAccess) for your "Forums" in the above code to deal with the case of more than one password protected Forum. I've also added the following every time the cookie is set to save the user having to enter the password every time they visit:

Response.Cookies(strUniqueID & pForum_ID).Expires = dateAdd("d", 30, strForumTimeAdjust)

Works great

Thanks again.

John



Edited by - therookery on 29 July 2002 15:28:45
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 30 July 2002 :  14:35:45  Show Profile  Send ruirib a Yahoo! Message
quote:

Thanks for the solution ruirib.


You're welcome .

quote:

I've enhanced it slightly by substituting pForum_ID (in chkUser4) and fForum (in chkForumAccess) for your "Forums" in the above code to deal with the case of more than one password protected Forum. I've also added the following every time the cookie is set to save the user having to enter the password every time they visit:

Response.Cookies(strUniqueID & pForum_ID).Expires = dateAdd("d", 30, strForumTimeAdjust)


Well the use of pForum_ID and fForum only makes sense if you do save the cookies for a later visit, as you do by setting the expiring date for the cookie. I did set an expiry date on my test code, but I decided not to include it here, since it that "feature" was not available previously.

Your changes, however, do enhance the usefulness of the fix though .

-------------------------------------------------
Installation Guide | Do's and Dont's | MODs


Edited by - ruirib on 30 July 2002 14:36:50
Go to Top of Page

therookery
Starting Member

29 Posts

Posted - 31 July 2002 :  17:27:34  Show Profile  Visit therookery's Homepage
Thanks ruirib.

I could imagine our users moaning if the password protected forums did not have more permanent cookies hence my code change .

Go to Top of Page

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 03 August 2002 :  05:20:39  Show Profile
chkForumAccess function has been updated in v3.4
Go to Top of Page

Massimo
Junior Member

Italy
125 Posts

Posted - 09 August 2002 :  05:42:18  Show Profile  Visit Massimo's Homepage
I have fixato the rows inc_funcitions.asp now but it does not make the logout me of the admin why?

Massimo Farieri
Snitz Italian Community
===============
http://www.snitz.it
http://www.superdeejay.net/forum/


Edited by - Massimo on 09 August 2002 06:56:08
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 09 August 2002 :  08:08:12  Show Profile  Send ruirib a Yahoo! Message
Your problem certainly is a cookie problem, not related to this fix. Just delete all your cookies, close all your browser windows and try login and logout and probably the problem will go away.
Go to Top of Page

Massimo
Junior Member

Italy
125 Posts

Posted - 09 August 2002 :  13:49:56  Show Profile  Visit Massimo's Homepage
'##############################################
'## Cookie functions and Subs ##
'##############################################

sub doCookies(fSavePassWord)
if strSetCookieToForum = 1 then
Response.Cookies(strUniqueID & "Forums").Path = strCookieURL
else
Response.Cookies(strUniqueID & "User").Path = "/"
end if

fix?!?!

'##############################################
'## Cookie functions and Subs ##
'##############################################

sub doCookies(fSavePassWord)
if strSetCookieToForum = 1 then
Response.Cookies(strUniqueID & "Forums").Path = strCookieURL
else
Response.Cookies(strUniqueID & "Forums").Path = "/"
end if

or not fix:

'##############################################
'## Cookie functions and Subs ##
'##############################################

sub doCookies(fSavePassWord)
if strSetCookieToForum = 1 then
Response.Cookies(strUniqueID & "Forums").Path = strCookieURL
else
Response.Cookies(strUniqueID & "User").Path = "/"
end if
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 09 August 2002 :  14:04:09  Show Profile  Send ruirib a Yahoo! Message
What?! You lost me here, man.

Anyway your problem is not with any Snitz code, it's probably an Internet Explorer problem. Do as I suggested in my previous post and that should fix it.


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

Massimo
Junior Member

Italy
125 Posts

Posted - 09 August 2002 :  14:14:04  Show Profile  Visit Massimo's Homepage
this my rows inc_functions.asp do not only give the logout to me of the admion replacing the old rows me go all good.... thanks for your patience

Massimo Farieri
Snitz Italian Community
===============
http://www.snitz.it
http://www.superdeejay.net/forum/

Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 09 August 2002 :  14:35:55  Show Profile  Send ruirib a Yahoo! Message
Massimo,

The problem is that you did not understand correctly the changes needed to fix the problem. The change of


Request.Cookies(strUniqueID & "User")("PRIVATE_" & rsStatus("F_SUBJECT"))

by


Request.Cookies(strUniqueID & "Forums")("PRIVATE_" & rsStatus("F_SUBJECT"))


was to be made only inside the chkUser4 and chkForumAccess functions. However you changed it also outside these functions.

To fix your problem you need to undo the changes in lines 1928, 2093 and 2108. In these lines you cannot replace User by Forums, ok?


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

Massimo
Junior Member

Italy
125 Posts

Posted - 09 August 2002 :  15:04:03  Show Profile  Visit Massimo's Homepage
Thanks very many

ciao ;)
Go to Top of Page
  Previous Topic Topic Next Topic  
 Forum Locked  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.24 seconds. Powered By: Snitz Forums 2000 Version 3.4.07