Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - save_new_session_data
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

save_new_session_data

 Post Reply Post Reply Page  <1234>
Author
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 14 December 2023 at 3:01pm
Thanks Roberto.

I believe the idea was not to have an extra database lookup for performance reasons, and while a bot may visit the forum multiple time in the same second from the same IP it is very unlikely that a real person could open the forum in multiple web browsers in the same second. 

Cookies are shared between browser tabs so opening a second tab in the same browser the user would be linked to the same session.
Back to Top
Roberto Randall View Drop Down
Senior Member
Senior Member
Avatar

Joined: 21 August 2009
Location: San Pedro Alc.
Status: Offline
Points: 277
Post Options Post Options   Thanks (0) Thanks(0)   Quote Roberto Randall Quote  Post ReplyReply Direct Link To This Post Posted: 14 December 2023 at 3:12pm
You're right. It's just something to keep in mind in case in the future...
https://www.lanocion.es - https://www.lanocion.games - https://www.lanocion.chat
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 14 December 2023 at 3:32pm
Thumbs Up
Back to Top
Roberto Randall View Drop Down
Senior Member
Senior Member
Avatar

Joined: 21 August 2009
Location: San Pedro Alc.
Status: Offline
Points: 277
Post Options Post Options   Thanks (0) Thanks(0)   Quote Roberto Randall Quote  Post ReplyReply Direct Link To This Post Posted: 14 December 2023 at 6:26pm
One last question.

By tracking the IPs that appear in the log as a duplicate session, I have seen that there are IPs from Google and others from Microsoft that appear identified as Android or Windows.


Would anything happen if the error line was deleted and the forum was allowed to continue?

That is, delete the error line when recording the session:

'If an error has occurred write an error to the page
 If Err.Number <> 0 Then    Call errorMsg("An error has occurred while writing to the database.", "save_new_session_data" & strSessionErrorText, "functions_session_data.asp")



Edited by Roberto Randall - 14 December 2023 at 6:37pm
https://www.lanocion.es - https://www.lanocion.games - https://www.lanocion.chat
Back to Top
Roberto Randall View Drop Down
Senior Member
Senior Member
Avatar

Joined: 21 August 2009
Location: San Pedro Alc.
Status: Offline
Points: 277
Post Options Post Options   Thanks (0) Thanks(0)   Quote Roberto Randall Quote  Post ReplyReply Direct Link To This Post Posted: 15 December 2023 at 6:51am
I think I created a function (modified createForumSessionID() function) to create a session id without duplicating it. I left it on all night and when I woke up I accessed the log and no error for a duplicate session appears. I'm going to spend more time testing and if it works I'll copy the code I created or send it to you by email (whatever you want).
https://www.lanocion.es - https://www.lanocion.games - https://www.lanocion.chat
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 15 December 2023 at 8:47am
The two IP address from Google and Microsoft are for their Cloud Services and would likely be people running bots on their Cloud Service. These maybe research bots, content scrappers, or more often that not these days malicious bots looking for things like SQL Injection vulnerabilities.
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 15 December 2023 at 8:56am
I am just look through the code for the createForumSessionID()  function and it uses an application variable that is incremented by one for each new session ID created.  

'Application session number to ensure that the sessions ID is unquie
Application("SessionNum") = Application("SessionNum") + 1


Are you running the latest version that has this code in the createForumSessionID() ?
Back to Top
Roberto Randall View Drop Down
Senior Member
Senior Member
Avatar

Joined: 21 August 2009
Location: San Pedro Alc.
Status: Offline
Points: 277
Post Options Post Options   Thanks (0) Thanks(0)   Quote Roberto Randall Quote  Post ReplyReply Direct Link To This Post Posted: 15 December 2023 at 2:04pm
Yes, I have the latest version and it duplicates the session.

With this change I have made there have been no duplicate sessions:

Private Function createForumSessionID()

      Dim dblNowDate
      Dim strClientIP
      Dim TypeLib
      Dim strSessionIDFunc

      'Generate unique session ID
    Set TypeLib = CreateObject("Scriptlet.TypeLib")
        strSessionIDFunc = LCase(Mid(Replace(CStr(TypeLib.Guid), "-", ""), 2, 20))
    Set TypeLib = Nothing           


      'Get the time as a double number
      dblNowDate = CDbl(Now())
      dblNowDate = Mid(dblNowDate, InStr(1, dblNowDate, ".")+1, Len(dblNowDate))


      'Application session number to ensure that the sessions ID is unquie
    Application("SessionNum") = Application("SessionNum") + 1

    'Calculate a code for the user
    createForumSessionID= Application("SessionNum") & "-" & strSessionIDFunc & dblNowDate

End Function

https://www.lanocion.es - https://www.lanocion.games - https://www.lanocion.chat
Back to Top
 Post Reply Post Reply Page  <1234>

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.