Usually style is at the beginning ( now there is ."\"> at the end of first link tag and style is inside it - that \ is needed before " to print " so that outer "..." tags are not broken )
Links should look like
<a style="color: #ffffff" href="The address">The address</a>
Try
$realuserinfo = " [<a style=\"color: #ffffff\" $CFG->frametarget
href=\"$CFG->wwwroot/course/loginas.php?id=$course->id&return=1&sesskey=".sesskey()."\.">$fullname</a>] ";