Author |
Topic |
|
therookery
Starting Member
29 Posts |
Posted - 25 July 2002 : 12:37:17
|
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 |
|
therookery
Starting Member
29 Posts |
Posted - 27 July 2002 : 09:32:03
|
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
|
|
|
ruirib
Snitz Forums Admin
Portugal
26364 Posts |
Posted - 27 July 2002 : 10:34:21
|
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 |
|
|
ruirib
Snitz Forums Admin
Portugal
26364 Posts |
Posted - 29 July 2002 : 14:42:45
|
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 |
|
|
therookery
Starting Member
29 Posts |
Posted - 29 July 2002 : 15:19:38
|
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 |
|
|
ruirib
Snitz Forums Admin
Portugal
26364 Posts |
Posted - 30 July 2002 : 14:35:45
|
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 |
|
|
therookery
Starting Member
29 Posts |
Posted - 31 July 2002 : 17:27:34
|
Thanks ruirib.
I could imagine our users moaning if the password protected forums did not have more permanent cookies hence my code change .
|
|
|
RichardKinser
Snitz Forums Admin
USA
16655 Posts |
Posted - 03 August 2002 : 05:20:39
|
chkForumAccess function has been updated in v3.4 |
|
|
Massimo
Junior Member
Italy
125 Posts |
Posted - 09 August 2002 : 05:42:18
|
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 |
|
|
ruirib
Snitz Forums Admin
Portugal
26364 Posts |
Posted - 09 August 2002 : 08:08:12
|
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. |
|
|
Massimo
Junior Member
Italy
125 Posts |
Posted - 09 August 2002 : 13:49:56
|
'############################################## '## 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 |
|
|
ruirib
Snitz Forums Admin
Portugal
26364 Posts |
Posted - 09 August 2002 : 14:04:09
|
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 |
|
|
Massimo
Junior Member
Italy
125 Posts |
|
ruirib
Snitz Forums Admin
Portugal
26364 Posts |
Posted - 09 August 2002 : 14:35:55
|
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 |
|
|
Massimo
Junior Member
Italy
125 Posts |
Posted - 09 August 2002 : 15:04:03
|
Thanks very many
ciao ;) |
|
|
|
Topic |
|