开发者

Duplicate User login

Is there an option to set Duplicate user login in PHP? W开发者_如何学Chen im logged in one tab and if i open another tab. It must display duplicate user or user already logged in. Kindly send me suggestions or the ways in which i can handle Duplicate user Login.


Well, store the user info in _SESSION vars

And at the top of page

<?php

check_login();

And on check_login() function

function check_login()
{
    session_start();

    if(isset($_SESSION['is_logged']))
    {
        echo "user is already logged";
    }
    else
    {
        echo "user is not logged";
    }
}

I am sure if you put this on top of every page, you will be able to do it so.

This will work for same browser. But for different browser, it will not work.


I'm afraid you can't do it since (as far as i see) e.g. Google's dupe login can't do the trick too. When you switch account within Google they actually switch the user but you can't login with two different identities in the same browser. Maybe somehow you can trick the browser but probably that will come with a security issue.

Btw, have you tried tricking cookies to do it?

Update:

  • build a database backend for manage (dupe) logins
  • use cookies beside sessions (store a unique value to differentiate each login)
  • on every page request compare your cookie > session > database to decide who requested the page

Note: this is a rough outline for the task, you'll need to take care of unique session_id's, etc.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜