今日、編集者は、同じユーザー名を同時にログインする方法を制限する方法の導入を紹介します。興味のある友達は編集者と一緒にそれについて学びます!
この問題に対する私の解決策は、ユーザーがアクティブな時間間隔の問題を抱えていることです。このアクティブな時間間隔を超える人はオフラインと見なすことができ、後者はログインできます。後者がログインしない場合、前者が再びログインする必要があるという意味ではありません。彼のセッションはまだそこにあるからです。時間設定が小さいほど、より正確であり、絶対的ではないということです。
コードは著者によって参照のために投稿されます。
function checkonline()dim ip、rsprv、sql、prvdbstateprvdbstate = false dbstate = false thendbopen()prvdbstate = trueend ifset rsprv = server.createobject( "adodb.recordset")if session( "username")= " & "''" rsprv.open sql、conn、1,3if rsprv.eof thenrrsprv.addnewsprv( "sessionid")= session.sessionidrsprv( "groupchargelv")= -1rsprv( "lastactime")= now()rsprv( "userip")= getiprsprv( "onlineTime") 0rsprv( "userwhere")= request.servervariables( "http_referer")elsersprv( "usershere")= request.servervariables( "http_referer")rsprv( "onlinetime")= request.servervariables( "http_referer")rsprv( "onlinetime")require rsprv( "onlinetime") + datediff( "n"、rsprv( "lastacttime")、now()))rsprv( "lastacttime")= now()end ifrsprv.updatersprv.close() 'response.write "notlogin" els'response.write " session( "username")& "'" rsprv.open sql、conn、1,3if rsprv.eof thenrsprv.addnewsprv( "sessionid")= session.sessionidrsprv( "username")= session( "username")rsprv( "groupchargelv")= session now()rsprv( "onlinetime")= 0rsprv( "userip")= getiprsprv( "usershere")= request.servervariables( "http_referer")elsef rsprv( "sessionid")session.sessionidおよびapplication( "loginset")( "loginset")ウェブサイトには1つのIDがあり、後でログインすることができますdatediff( "n"、rsprv( "lastacttime")、now())rsprv( "lastacttime")= now()end ifrsprv.updatersprv.close()end ifset rsprv = nothif datiff( "s"、application( "onlinelastdelete")、nows) ThenApplication.Lock()Application( "OnlinElastDelete")= nowapplication.unlock()conn.execute( "online where where where where where where where where where where where where where where where where where( 's'、now())>"&int(application( "checkonlinediff")& "") '
上記は、同じユーザー名を同時にログインすることを制限する方法の紹介です。気に入っていただければ幸いです。その他のコンテンツについては、間違った新しいテクノロジーチャネルのWebサイトに注意を払い続けてください!