Pretty much the same code as what Glenn posted, but in a UDF.

SessionType() -
http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=195471

How to use UDFs -
http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=81943#Post81943

The rest of the UDFs are here -
http://www.kixtart.org/forums/ubbthreads.php?ubb=postlist&Board=7&page=1
_________________________
(... better days ahead)