<?
    function if_user ($arg)
    {
        global $user, $config;
        if ($arg == 'no_reg')  // если юзер не авторизирован
        {
            if (isset($user))
            {
                header ("Location: $config[profile_page]");
                exit();
            } else return true;
        }
        elseif ($arg == 'is_reg') // если юзер авторизирован
        {
            if (!@$user['id'])
            {
                header ("Location: /login");
                exit();
            } else return true;
        }
    }
?>