简体   繁体   English

登录和注销检查

[英]SignIn and SignOut checks

am a beginner to java and have a doubt while recording the signIn and signOut timestamps in mysql database. 是Java的初学者,并在mysql数据库中记录signIn和signOut时间戳时有疑问。 Here I need to check few conditions. 在这里,我需要检查一些条件。 1) The user is logged in with his username and password. 1)用户使用其用户名和密码登录。 At that point, his login time is not recorded. 此时,尚未记录他的登录时间。 2) The user signIn time will be sent to the database when he clicks the signIn button present in his account. 2)用户单击帐户中的登录按钮时,登录时间将发送到数据库。

Now the problem I have is , 1) I can enter the signIn time many times, though the signOut time is not recorded. 现在我遇到的问题是,1)尽管未记录签出时间,但我可以多次输入签入时间。 2)when signed out that particular signed out time is recorded at the first timestamp I signedIn. 2)退出时,特定的退出时间记录在我signIn的第一个时间戳上。

Can anyone suggest me the check I need to make so that every login should have logout. 谁能建议我需要做的检查,以便每次登录都可以注销。

Thanks in advance. 提前致谢。

I believe that you should do the following check: 我相信您应该进行以下检查:

During the "sign-in" ( SI1 ) check whether there is a previous "sign-in"( SI0 ) event for this user with no corresponding "sign-out"(SO0). 在“登录”( SI1 )期间,检查该用户是否存在先前的“登录”( SI0 )事件,而没有相应的“注销”(SO0)。

If you detect such SI0 with no corresponding SO0 - assign this "sign-in" event a "sign-out" time of SI1 , otherwise - business as usual. 如果您检测到没有相应SO0的 SI0,请为该“登录”事件分配SI1的“退出”时间,否则-照常营业。

This way you always close previous sign-ups for user. 这样,您始终可以关闭用户的先前注册。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM