Пример #1
0
include_once "header.php";
?>

<?php 
$numEntries = getIndexNum();
$cookie = $_COOKIE['mindof'];
$storedcookie = getCookie();
$twitter_update = gettwitterCheck();
$twitter_email = gettwitterEmail();
if (checkCookie()) {
    showUpdateForm();
}
if (checkCookie() && stripslashes($_POST['checksubmit'])) {
    $update = strip_tags($_POST['update']);
    addEntry($update);
    if ($twitter_update == 1 && strlen($twitter_email) > 0) {
        $twit_update = stripslashes($_POST['update']);
        updateTwitter($update);
    }
    echo " <img src=\"icon_accept.gif\" border=\"0\" /> mindof updated. ";
}
showEntriesIndex($numEntries);
echo "<a href=\"" . $siteUrl . "archive.php?pagenum=2\" class=\"box\">older &#187;</a>";
?>

<?php 
include_once "footer.php";
?>

Пример #2
0
function outputFeed($db, $hashtag)
{
    $html = '<ul class="feed">';
    $db_con = mysqli_connect($db['host'], $db['user'], $db['password'], $db['name']);
    $query = mysqli_query($db_con, "SELECT * FROM media WHERE hashtag='{$hashtag}' ORDER BY time_now DESC");
    if (mysqli_num_rows($query) > 0) {
        while ($post = mysqli_fetch_assoc($query)) {
            if ($post['type'] == 'photo') {
                $media = '<a href="' . $post['post_url'] . '"><img class="' . $post['source'] . '" src="' . $post['media_url'] . '" alt=""/></a>';
            } else {
                if ($post['media_url_https'] != '') {
                    $media = '<video width="100%" height="100%" controls poster="' . $post['media_url'] . '">
                    <source src="' . $post['media_url_https'] . '" type="video/mp4">
                    Your browser does not support the video tag.
                    </video>';
                }
            }
            $html .= '<li class="' . $post['source'] . ' col-sm-3">' . $media . '</li>';
        }
    }
    $html .= '</ul>';
    mysqli_close($db_con);
    return $html;
}
$shouldUpdate = shouldUpdate($db, $hashtag);
if ($shouldUpdate !== false) {
    $twitter['last_id'] = $shouldUpdate;
    updateInstagram($db, $instagram, $hashtag);
    updateTwitter($db, $twitter, $hashtag);
}
echo outputFeed($db, $hashtag);