Esempio n. 1
0
function indivtopfivelife($feedid)
{
    $topmenu = array();
    $rank = '';
    $date = time();
    $standmenu = standardtopmenutwo();
    $memenure = memenu($feedid);
    //echo '<br /><br />new feed';
    //print_r($lifequalify);
    //echo '<br /><br />';
    $topmenure = compareusermenutwo($standmenu, $memenure);
    //echo '<br /><br />top 5 feed';
    //print_r($topmenure);
    $db->query = " INSERT INTO " . RSSDATA . ".toplife (feedid, rank, date, lifestyleid) VALUES ";
    foreach ($topmenure as $tpf) {
        $rank++;
        $convtpf = idconvert($tpf);
        $db->query .= "('{$feedid}', '{$rank}', '{$date}', '{$convtpf}'), ";
    }
    $db->query = substr($db->query, 0, strLen($db->query) - 2);
    //this will eat the last comma
    //echo $db->query;
    $resultmelifet = mysql_query($db->query) or die(mysql_error());
}
function feedexistadd($meurlfeedid, $entryurl)
{
    global $lifemenu;
    global $lifequalify;
    $lmenuexist = $_SESSION['topmenu'];
    unset($_SESSION[topmenu]);
    //print_r($lmenuexist);
    //print_r($_SESSION['topmenu']);
    //echo 'pastexisting';
    // find out the number of top level lifestyles, first form arrary of all possible lifestyle options
    standardtopmenutwo();
    // find out if this url qualifies for any lifestyle?
    memenu($meurlfeedid);
    $_SESSION[lifemenu] = $lifemenu;
    $_SESSION[lifequalify] = $lifequalify;
    // find lifestyles that qualify
    compareusermenutwo($lifemenu, $lifequalify);
    // builds menus  /////////////////////////////////////////////////////////////////////////////////////////////////////////////
    memenucode($topmenu, $lifestylelid);
    $_SESSION[me_url] = $entryurl;
    $_SESSION[mefid] = $newfeedid;
    $topfivem = $_SESSION[topmenu];
    //print_r($topfivem);
    //echo 'pasttopfive';
    // now need to add manually added back lifestlye menu items not included by mepath in the individuals users top5. (obviously mepath would not want this outcome if they blog out the lifestlye in question ie. mepath has got it wrong).
    // compare topmenubefore with current menu.
    comptop5man($lmenuexist, $topfivem);
    $db->query = "INSERT INTO " . RSSDATA . ".rssjoin (userid, feedsid) VALUES ('{$_SESSION['user_id']}', '{$meurlfeedid}')";
    // execute query grouped words
    $savejoinrss = mysql_query($db->query) or die("Error in query: {$db->query}. " . mysql_error());
    //echo $db->query;
    // need array to contain top lifesytle and save so on return personalized lifestyle menu is presented
    // need to differenciate between man add items and autotop5
    $toplifestle = $_SESSION[newtopm];
    $db->query = "INSERT INTO " . RSSDATA . ".userlife (userid, lifestyleid, humadd) VALUES ";
    foreach ($toplifestle as $toplsi => $mortf) {
        $db->query .= " ('{$_SESSION['user_id']}', '{$toplsi}', '{$mortf}'), ";
    }
    $db->query = substr($db->query, 0, strLen($db->query) - 2);
    //this will eat the last comma
    $resultlmenu = mysql_query($db->query) or die("Error in query: {$db->query}. " . mysql_error());
    //echo $db->query;
}
</form>
<br />
<br />

<?php 
if (isset($_POST['melifetopfive'])) {
    error_reporting(5);
    $date = time();
    feedarray();
    standardtopmenutwo();
    foreach ($feedids as $efid) {
        $lifequalify = '';
        $topmenu = array();
        $rank = '';
        memenu($efid);
        compareusermenutwo($lifemenu, $lifequalify);
        $db->query = " INSERT INTO " . RSSDATA . ".toplife (feedid, rank, date, lifestyleid) VALUES ";
        foreach ($topmenu as $tpf) {
            $rank++;
            $db->query .= "('{$efid}', '{$rank}', '{$date}', '{$tpf}'), ";
        }
        $db->query = substr($db->query, 0, strLen($db->query) - 2);
        //this will eat the last comma
        $resultmelifet = mysql_query($db->query) or die(mysql_error());
    }
    // closes foreach
}
// closes button pressed
?>

<br />