function inpostresults($lifestylelid, $lifestylesubid)
{
    //Function Output's variables with no html markup
    global $resulttotals;
    global $resulttotalspage;
    global $page;
    global $total_pages;
    global $page_number;
    //global $lifestyleid;
    //global $llresults;
    global $streamstyle;
    global $llpaging;
    if ($resulttotals) {
        $streamstyle = array();
        $llpaging = '';
        // present results in table
        if (mysql_num_rows($resulttotalspage) > 0) {
            while ($row = mysql_fetch_object($resulttotalspage)) {
                $datepost = $row->dcdate;
                $postdate = date("l jS \\of F Y h:i:s A", $datepost);
                $limit = 100;
                //  add functions to see if image or video can be extract from post?
                //images extraction
                $contentb = $row->content;
                $matchesimgi = '';
                $matchesimgi = str_img_src($contentb);
                if ($matchesimgi) {
                    $jpgstring = '.jpg';
                    $pos = stristr($matchesimgi, $jpgstring);
                    //echo $pos;
                    if ($pos === false) {
                        $blogimg = makeurla('display/images/blogimg.gif');
                    } else {
                        $blogimg = $matchesimgi;
                    }
                }
                // closes if
                //  video extraction
                //videoembed ($row->link);
                $cleanhtml = html_entity_decode($row->content);
                $cleantags = strip_tags($cleanhtml);
                $summary = $cleantags;
                if (strlen($summary) > $limit) {
                    $summary = substr($summary, 0, strrpos(substr($summary, 0, $limit), ' ')) . '...';
                }
                $streamstyle[$row->drid][strblogurl] = $row->blogurl;
                $streamstyle[$row->drid][strauth] = $row->author;
                $streamstyle[$row->drid][strtitle] = $row->title;
                $streamstyle[$row->drid][strturl] = $row->link;
                $streamstyle[$row->drid][inimag] = $blogimg;
                $streamstyle[$row->drid][strsumm] = $summary;
                $streamstyle[$row->drid][strdate] = $postdate;
            }
            // closes while loop
        }
        for ($page = 1; $page <= $total_pages; $page++) {
            if ($page == $page_number) {
                // This is the current page. Don't make it a link.
                $llpaging .= "{$page} ";
            } else {
                // This is not the current page. Make it a link.
                $llpaging .= "<a href=\"" . makeurla('index.php') . "?lifestyleid=" . $lifestylelid . "&page_number=" . $page . "\">" . $page . "</a>";
            }
        }
    } else {
        $llresults .= "No posts could be presented.";
    }
    //  print_r($streamstyle);
    return $streamstyle;
}
Exemplo n.º 2
0
function magazinesections()
{
    global $magsect;
    // display lifestyle magazine sections
    // first find out which magazine section have been setup
    $db->query = "SELECT * FROM " . RSSDATA . ".lifestylegroups LIMIT 6 ";
    $resultlg = mysql_query($db->query) or die("Error in query: {$db->query}. " . mysql_error());
    if (mysql_num_rows($resultslg) > 0) {
        while ($row = mysql_fetch_object($resultlg)) {
            $livegroup[] = $row->groupid;
        }
    }
    // closesif
    $db->query = "SELECT * FROM " . RSSDATA . ".lifestylegroups WHERE ";
    foreach ($livegroup as $lgrp) {
        $db->query .= " " . RSSDATA . ".lifestylegroups.groupid = {$lgrp} OR";
    }
    // closes foreach
    $db->query = substr($db->query, 0, strLen($db->query) - 3);
    //this will eat the last OR
    $resultslg = mysql_query($db->query) or die("Error in query: {$db->query}. " . mysql_error());
    if (mysql_num_rows($resultslg) > 0) {
        $magsect = '';
        //  need to find out current magazine section selected, via getmags or via lifestylelid
        if (!$_GET['mags']) {
            if ($_GET['lifestyleid']) {
                $lifeselmag = escapeinteger($_GET['lifestyleid']);
                $db->query = "SELECT * FROM  " . RSSDATA . ".grouplink WHERE " . RSSDATA . ".grouplink.idlifestyle = '{$lifeselmag}' ";
                $resultcmagl = mysql_query($db->query) or die("Error in query: {$db->query}. " . mysql_error());
                if (mysql_num_rows($resultcmagl) == 1) {
                    $row = mysql_fetch_object($resultcmagl);
                    $curmagset = $row->groupid;
                }
            } else {
                $_GET['mags'] = 1;
            }
        } else {
            $curmagset = escapeinteger($_GET['mags']);
        }
        while ($row = mysql_fetch_object($resultslg)) {
            //  if groupid matches currentid then underline
            if ($curmagset == $row->groupid) {
                $magsect .= "<div class=\"magalist\"><b><a href=\"" . makeurla('index.php') . "?mags={$row->groupid}\" id=\"current\" >{$row->groupname}</a></b>&nbsp &nbsp</div>";
            } else {
                $magsect .= "<div class=\"magalist\"><b><a href=\"" . makeurla('index.php') . "?mags={$row->groupid}\">{$row->groupname}</a></b>&nbsp &nbsp</div>";
            }
        }
        //$magsect .= "<div class=\"magalist\"><a href=\"".makeurla('index.php')."?metext=3\">more</a></div>";
    }
    echo $magsect;
}
Exemplo n.º 3
0
$abspath = $siteinfo[absolpath];
define('LLFOLDER', $basefolderurl);
if (isset($_POST['Login'])) {
    if ($_POST['username'] != '' && $_POST['password'] != '') {
        //Use the input username and password and check against 'users' table
        $query = mysql_query('SELECT ID, Username, Active FROM users WHERE Username = "******" AND Password = "******"');
        if (mysql_num_rows($query) == 1) {
            $row = mysql_fetch_assoc($query);
            if ($row['Active'] == 1) {
                session_start();
                $_SESSION['user_id'] = $row['ID'];
                $_SESSION['username'] = $row['Username'];
                $_SESSION['logged_in'] = TRUE;
                setcookie("username", $_POST['Username'], time() + 84600 * 30);
                if ($_SESSION[logged_in] == 1) {
                    $loginloc = makeurla('controlpanel/index.php');
                    header("Location:  " . $loginloc . " ");
                } else {
                    header("Location:  login.php ");
                }
            } else {
                $error = 'Your membership is not activated. Please open the email that was sent and click on the activation link';
            }
        } else {
            $error = 'Login failed !';
        }
    } else {
        $error = 'Please use both your username and password to access your account';
    }
}
?>