function mecontexttt()
{
    global $topmenu;
    global $lifestylelid;
    global $lifestart;
    global $newlifestyleid;
    //  public logic and signed in
    if ($_SESSION[pubuser] == 44) {
        //echo 'START';
        if ($_SESSION[pubuser] == 44 && $_SESSION[user_id]) {
            //echo 'user unclear';
            unset($_SESSION[user_id]);
            unset($_SESSION[username]);
            unset($_SESSION[logged_in]);
            //first time at url then set metext to 4
            if (!$_SESSION[metext]) {
                $_SESSION[metext] = 4;
            }
            if (!$_GET['lifestyleid'] || !$_SESSION[mecid]) {
                $lifestylelid = 1;
            } else {
                $idlifestart = $_SESSION[mecid];
                //echo $idlifestart;
                idstartconvert($idlifestart);
                $lifestylelid = $newlifestyleid;
            }
        }
        // closes if user id info. exists, delete it
        //  if lifestyle activity has been clicked, set next context with it.
        if ($_GET['lifestyleid']) {
            //echo 'AAA';
            $lifestylelid = escapeinteger($_GET['lifestyleid']);
            $topmenu = $_SESSION[topmenu];
            if (!$topmenu) {
                $topmenu['me'] = $lifestyleid;
            }
            memenucode($topmenu, $lifestylelid);
            idconvert($lifestylelid);
            $_SESSION[mecid] = $lifestart;
        } elseif ($_POST['lifestylesid']) {
            // echo 'BBB';
            // need a set of function that will take existing lifestyle menu and add/delete activities and then disply the new lifestyle menu
            $humaddlist = escapeinteger($_POST['lifestylesid']);
            humanaddpublic($humaddlist);
            $idlifestart = $_SESSION[mecid];
            //echo $idlifestart;
            idstartconvert($idlifestart);
            $lifestylelid = $newlifestyleid;
            memenucode($topmenu, $lifestylelid);
            $_SESSION[metext] = 4;
        } elseif ($_GET['mags']) {
            // echo 'DDD';
            $getmag = escapeinteger($_GET['mags']);
            maggroupsel($getmag);
            memenucode($topmenu, $lifestylelid);
            $_SESSION[metext] = 4;
        } else {
            //echo 'CCC';
            if ($_GET['metext'] || $_SESSION[metext]) {
                // need to set a session variable to use to redisplay right context
                $_SESSION[chartreturn] = 1;
                // need to find what lifestlye activity is current and set lifestylelid for it and build menu, if first logged skip
                if ($_GET['metext']) {
                    $_SESSION[metext] = escapeinteger($_GET['metext']);
                } else {
                    $_SESSION[metext] = 4;
                }
            }
            // closes if
            if ($_SESSION[mecid]) {
                $idlifestart = $_SESSION[mecid];
                //echo $idlifestart;
                idstartconvert($idlifestart);
                $lifestylelid = $newlifestyleid;
                //echo $lifestylelid;
            } else {
                $lifestylelid = 1;
                //echo$lifestylelid;
            }
            // if topmenu empty then make it me
            $topmenu = $_SESSION[topmenu];
            if (!$topmenu) {
                $topmenu['me'] = 46;
            }
            memenucode($topmenu, $lifestylelid);
        }
        // closes else
    } else {
        //  if lifestyle activity has been clicked, set next context with it.
        if ($_GET['lifestyleid']) {
            $lifestylelid = escapeinteger($_GET['lifestyleid']);
            $_SESSION[filtext] = 2;
            $topmenu = $_SESSION[topmenu];
            if (!$topmenu) {
                $topmenu['me'] = $lifestyleid;
            }
            memenucode($topmenu, $lifestylelid);
            idconvert($lifestylelid);
            $_SESSION[mecid] = $lifestart;
        } elseif ($_GET['filtext']) {
            $setfiltext = escapeinteger($_GET['filext']);
            $_SESSION[filtext] = $setfiltext;
            if ($setfiltext == 1) {
                $filtext = 1;
            } else {
                $filtext = 2;
            }
            // get current lifestyleid from session to keep its context
            $idlifestart = $_SESSION[mecid];
            //echo $idlifestart;
            idstartconvert($idlifestart);
            $lifestylelid = $newlifestyleid;
            $topmenu = $_SESSION[topmenu];
            if (!$topmenu) {
                $topmenu['me'] = $lifestyleid;
            }
            memenucode($topmenu, $lifestylelid);
        } elseif ($_POST['lifestylesid']) {
            // need a set of function that will take existing lifestyle menu and add/delete activities and then disply the new lifestyle menu
            $humaddlist = escapeinteger($_POST['lifestylesid']);
            humanadd($humaddlist);
            formmenuin();
            memenucode($topmenu, $lifestylelid);
            // if logged in to this
            //header("Location: /lifestylelinking/me/mein.php");
            $_SESSION[metext] = 1;
        } else {
            if ($_GET['metext'] && $_SESSION[mecid]) {
                // need to set a session variable to use to redisplay right context
                $_SESSION[chartreturn] = 1;
                // need to find what lifestlye activity is current and set lifestylelid for it and build menu, if first logged skip
                $_SESSION[metext] = escapeinteger($_GET['metext']);
                $idlifestart = $_SESSION[mecid];
                //echo $idlifestart;
                idstartconvert($idlifestart);
                $lifestylelid = $newlifestyleid;
                //echo $lifestylelid;
                // if topmenu empty then make it me
                $topmenu = $_SESSION[topmenu];
                if (!$topmenu) {
                    $topmenu['me'] = 46;
                }
                memenucode($topmenu, $lifestylelid);
            } else {
                unset($_SESSION[mefid]);
                formmenuin();
                if ($topmenu) {
                    memenucode($topmenu, $lifestylelid);
                    $_SESSION[metext] = 1;
                    $_SESSION[filtext] = 2;
                } else {
                    $_SESSION[metext] = 3;
                }
                //  first time need to match user id to feedsid
                if (!$_SESSION[mefid]) {
                    // need to find out feedid from login userid
                    $db->query = "SELECT * FROM " . RSSDATA . ".rssjoin WHERE " . RSSDATA . ".rssjoin.userid = '{$_SESSION['user_id']}' ";
                    $resultmefid = mysql_query($db->query) or die("Error in query: {$db->query}. " . mysql_error());
                    //echo $db->query;
                    if (mysql_num_rows($resultmefid) == 1) {
                        $row = mysql_fetch_object($resultmefid);
                        $feedmeid = $row->feedsid;
                        $_SESSION[mefid] = $feedmeid;
                    } else {
                        $_SESSION[mefid] = 598;
                    }
                }
                // closes if feedid set
            }
        }
        // closes else
    }
    // closes open else
}
<div class="contenttabpeer">
<br /><br /><br />

<div class="peergroup">

<?php 
    //mostlikelifestyle ($lifestylelid);
    pergroupdplay($lifestylelid, $feedid);
    echo $ppeergroup;
} elseif (($_GET['filtext'] == 2 || $_SESSION['filtext'] == 2) && $_SESSION[metext] == 1) {
    // latest from personalized peer group and filter to pick out the best from the posts. (also can have publics peer groups)
    //echo 'filtered';
    $lifestylelid = $_SESSION[mecid];
    //echo $lifestylelid.' lifestlyeid??';
    $lifestylelidaa = idstartconvert($_SESSION[mecid]);
    //echo $lifestylelidaa.' lifestlyeid??';
    $feedid = $_SESSION[mefid];
    if (isset($_GET['filtext'])) {
        $filtext = escapeinteger($_GET['filtext']);
    } else {
        $filtext = $_SESSION['filtext'];
    }
    pergrpposts($feedid, $lifestylelidaa, $filtext);
    ?>

<br /><br />

<?php 
    //echo $llpaging;
    ?>