Storing Users Sessions in Database
Printed From: Web Wiz Forums
Category: Web Wiz Web App Support Forums
Forum Name: Web Wiz Forums
Forum Description: Support forum for Web Wiz Forums application.
URL: https://forums.webwiz.net/forum_posts.asp?TID=20697
Printed Date: 08 April 2026 at 1:44pm Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com
Topic: Storing Users Sessions in Database
Posted By: SMR Group
Subject: Storing Users Sessions in Database
Date Posted: 16 July 2006 at 3:10am
|
boRg,
I've got users who visit from different machines during the day (work, then home) and they would like to keep track of their viewed topics, last visit etc. across different machines. IE. they log out at work at 12pm and when accessing via their home computer their last visit reflects that, rather than the last time they visited on that machine as it is now.
If DatabaseHeldSessions is set to True, will all that be covered, or just their current session state?
I'm not too bothered about the performance hit, the board isn't that busy, I'm using the MySQL version and there's nothing else running on the server.
Thanks.
|
Replies:
Posted By: WebWiz-Bruce
Date Posted: 16 July 2006 at 12:10pm
No the changes you mention wouldn't change this.
In version 7.x it did do this, but when witting the new login system for version 8, I must have missed coding this part in.
To get this to work place the following at line 176 of the file functions/functions_login.asp:-
'Read in the last login date/time for this user If isDate(rsCommon("Last_visit")) Then dtmLastVisitDate = CDate(rsCommon("Last_visit")) Call saveSessionItem("LV", internationalDateTime(dtmLastVisitDate)) End If |
You will also need to chnage line 94 of the same file to:-
strSQL = "SELECT " & strDbTable & "Author.Password, " & strDbTable & "Author.Salt, " & strDbTable & "Author.Username, " & strDbTable & "Author.Author_ID, " & strDbTable & "Author.User_code, " & strDbTable & "Author.Active, " & strDbTable & "Author.Login_attempt, " & strDbTable & "Author.Last_visit " & _ |
------------- https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting
|
Posted By: SMR Group
Date Posted: 08 August 2006 at 2:37am
|
boRg, thanks for the code snippet, I updated the pages as above a week or so ago and it seems to have done the trick for users who visit using different computers.
However, something seems to have significantly slowed the system down when new messages are posted and this is the only change I have made in the last few weeks. It takes a long time (many seconds) for the forum to respond when clicking the "Post Reply" button in either the quick reply form or the new_reply_form.asp page.
All the other operations such as searches and general navigation are really fast (I'm running the MySQL version), the board is quiet and the only thing running on the server, so it can't be a resources issue.
Any ideas?
|
Posted By: WebWiz-Bruce
Date Posted: 08 August 2006 at 10:47am
This code I have given will not effect performance in the slightest when you post a reply, new post, etc. as the code doesn't run during these times.
Usually if you have a delay when posting replies, etc. it is usually an email problem with delays in connecting to the SMTP server to send email notifications.
To test this disable email notifications from the admin area and make a post, it it runs faster you know it is this that is at fault.
To make it run faster see if you can use a localhost SMTP server as this would eliminate any delays in connecting to the SMTP server across a network.
------------- https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting
|
Posted By: SMR Group
Date Posted: 02 December 2006 at 2:34am
boRg, I'm revisiting this topic because the changes in where user sessions are stored that I made back in August, might have had a negative impact on users of Firefox 2.0.
While IE functions as expected, Firefox 2.0 does not correctly store user visit information. The board does not accurately reflect the last time a user visited, all the date displays are wrong (they don't appear to be updated) and therefore the list of new messages and icons are all incorrect.
If it's not the session storage method, do you know what else it could be? I've asked people to clear their cookies and that helps, but only for the first visit. So if a user revisits a day later, the board says they visited a day ago, but if they then revisit after another day, the board says their last activity was two days ago.
FYI, I'm also seeing odd login behaviour with Firefox 2 here, sometimes I stay logged in between visits, sometimes I'm logged out. This board has also got my last visit information wrong at least once, but I can't consistently recreate that bug, although it may have something to do with browsing with tabs.
|
Posted By: WebWiz-Bruce
Date Posted: 02 December 2006 at 8:24am
There is no difference in the way the last visit is stored between IE and Firefox, they use the same method. The last visit date is stored in the database under the users details.
I have used Firefox 2 as my default browser since beta versions at the end of September and never had any of the issues you have mentioned.
------------- https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting
|
Posted By: tjodalv
Date Posted: 02 December 2006 at 9:36am
|
I use FF 2.0 and I have the same issue. For example this forum (http://www.webwiz.net/bbs), when I login today, all forums are marked as read, but my last visit was 20 Nov 2006 at 12:04am, so that would mean that there is no new topic from 20 Nov till today ...
|
Posted By: WebWiz-Bruce
Date Posted: 02 December 2006 at 1:40pm
Like I mentioned previously the browser being used makes no difference as the data is not stored in cookies it is stored server side so makes no difference what browser you are using.
------------- https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting
|
Posted By: SMR Group
Date Posted: 02 December 2006 at 9:44pm
-boRg- wrote:
Like I mentioned previously the browser being used makes no difference as the data is not stored in cookies it is stored server side so makes no difference what browser you are using.
|
Well, something's definitely not working right with Firefox.
When I deployed Web Wiz I was using IE and always visited here for assistance using IE too. With IE my board and this board always remembered (and still remembers) the details of my last visit and whether I'm logged in or not.
Firefox doesn't. Each time I visit here I have to log in again, even though I always select the "remember" option. Then the last login time/date information is wrong, which of course messes up the display of messages.
For some completely unknown reason it's actually worse here than on my own board, which (most of the time) does remember me between visits but gets the time/date wrong.
I fully understand what you're saying about the data being stored server-side so it shouldn't matter what browser is being used, that makes perfect sense, but Firefox 2 is not behaving as it should (or how IE behaves).
The only thing I've found that helps a little is if users with Firefox manually log-out of the forum via the link. Then the chances of it remembering the date/time of the last visit are somewhat improved.
|
|