Is the session variable being reset? I see your set session code is:
if ("" == "") {
$_SESSION["UserID"] = "".($_GET['UserID']) ."";
}
That means that if you visit that page without the url parameter it will be reset to blank.
Perhaps it should be:
if (isset(($_GET['UserID']))) {
$_SESSION["UserID"] = "".($_GET['UserID']) ."";
}