How to set notify If user already logged in the systems
<p>I have a code like this :</p>

<p>

<pre><code>include ("config.php");

$username = $_POST['username'];
$password = $_POST['password'];

$do = $_GET['do'];

if($do=="login")
{
    $cek = mysql_query("SELECT password, user_level FROM t_users WHERE username='$username' AND password='$password'");
    if(mysql_num_rows($cek)==1)
    {
        $c = mysql_fetch_array($cek);
        $_SESSION['username'] = $c['username'];
        $_SESSION['user_level'] = $c['user_level'];

        if($c['user_level']=="supervisor")
        {
            header("location:supervisor.php");
        }

        else if($c['user_level']=="user")
        {
            header("location:home.php");
        }
        else if($c['user_level']=="root")
        {
            header("location:administrator.php");
        }
        else if($c['user_level']=="manager")
        {
            header("location:manager.php");
        }
        else if($c['user_level']=="admin")
        {
            header("location:admin.php");
        }
        else if($c['user_level']=="director")
        {
            header("location:director.php");
        }
    }
    else
    {
        header('Location: index.html');
    }
}
else if($do=="logout")
{
    date_default_timezone_set("Asia/Jakarta");
    $last_logged_out = date("j-F-Y, G:i ");
    $ip_address=$_SERVER['REMOTE_ADDR'];
    mysql_query("update t_users set last_logged_out='$last_logged_out', ip_address='$ip_address' WHERE username='$_SESSION[username]'");

    unset($_SESSION['username']);
    unset($_SESSION['user_level']);
    header("location:index.html");
}
</code></pre>

<p>How can I give the function code if someone logged in and the same time or different time someone logged in to with a same username and then I want the systems will be notify that user already logged in, so user with same username can't login until user before logged out.</p>

<p>Someone can help me ?
Thank you.</p>
