loggedin.php is fixed, see description

You can now use $user_data['username'] instead of $user_data[1]