daft question re. session variable

Results 1 to 3 of 3

Thread: daft question re. session variable

  1. #1
    Join Date
    Dec 1969

    Default daft question re. session variable

    I have an appointments facility I am working on for a site.<BR><BR>At the moment, when a user successfully logs into the site, I do this:<BR><BR> username=(newstr(request("username")))<BR> password=(newstr(request("password")))<BR><BR> SQL = "SELECT uid from users where uusername = &#039;"&username&"&#039; AND upassword = &#039;"&password&"&#039;"<BR> response.write sql & "&#060;HR&#062;"<BR> set opRS = oConn.Execute(SQL)<BR><BR> if opRS.EOF then<BR><BR> response.write "Invalid username / password - please &#060;a href=default.asp&#062;try again&#060;/a&#062;"<BR><BR> else<BR><BR> uid = opRS("uid")<BR><BR> session("japanmark") = TRUE<BR> Session("userid")=uid<BR> <BR>However, am I right in assuming here that if one user logs in, with a user id of 3, then the session("userid") will be three? Then if someone else logs in a few minutes later, while the first person is still logged on, then the session("userid") value which was previously three, will be reset to whatever it is for the new user, thereby screwing everything up?<BR><BR>Hopefully I&#039;m wrong, since I have just tested this on my own PC, running IIS. The session("userid") was overwritten with that of the latest person to sign on, but when this site is live, and users are logging in from different PCs, then would I be right in thinking that the session("userid") values will not be overwritten for all users each time a new user logs in, because the session is specific for each user on each pc?<BR><BR>Otherwise, I suppose I might need to use cookies. I have looked as 4guysfromrolla re. the differences between cookies and sessions, but thought I&#039;d just give this an airing here too.<BR><BR>Thanks<BR><BR>Jim

  2. #2
    Join Date
    Dec 1969

    Default RE: daft question re. session variable

    A session is made on a per computer basis.<BR>Many computers/users can have the same<BR>"Session Variable Name", but the values will be different and stay for the life of the session.<BR><BR>So one persons session variables will not mess up somone elses session variables...<BR>

  3. #3
    Join Date
    Dec 1969

    Default Wellll...not quite...

    &#062; A session is made on a per computer basis<BR><BR>A seesion is made on a *PER BROWSER CONNECTION* basis.<BR><BR>If you start three browsers on your machine (from the browser icon, *NOT* by hitting the FILE menu and "New Window"), then each of those browser is a separate process and each will get its own set of session variables.<BR><BR>But that&#039;s a detail. It&#039;s certainly true that nothing in one session/browser connection can affect anything in another session/browser connection. Only *APPLICATION* variables are shared among all users.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts