Example #1
0
					<br><br>
					<input type="submit" class="buttonStyle" value="Submit">
					</form>	<?php 
}
?>
			</div>
		</article>
		<article id="article2"> <!-- group similar information  -- articles can have headers and footers-->
	<?php 
if (isset($_GET['threadId'])) {
    $postsFor = $_GET['threadId'];
    $postResults = getPosts($postsFor);
    if (count($postResults) == 0) {
        echo "Be the first to comment";
    } else {
        printPosts($postResults);
    }
} else {
    echo "Error - no topic was selected";
}
?>
</article>
	</section>
		<aside id="trendingNow" class="sideRight side_news twitter feed trendingNow general post posts channelFeed">
		<h4>What's Trending?</h4>
		<?php 
$arr = getTwitterInfo();
$handle = $arr[0];
$twitter_id = $arr[1];
if (is_null($handle) || is_null($twitter_id)) {
    echo "No twitter data found";
Example #2
0
include "inc/connect.php";
if (isset($_GET['tab'])) {
    $tab = $_GET['tab'];
    switch ($tab) {
        case "new":
            $where = "user.user_id = adventure.user_id ORDER BY posted_at DESC";
            printPosts(makeQuery($db, $where));
            break;
        case "top":
            $where = "user.user_id = adventure.user_id ORDER BY vote_score DESC";
            printPosts(makeQuery($db, $where));
            break;
    }
} else {
    $where = "user.user_id = adventure.user_id ORDER BY posted_at DESC";
    printPosts(makeQuery($db, $where));
}
function makeQuery($db, $where)
{
    $query = $db->query("SELECT * FROM user,adventure WHERE {$where}");
    if ($query->num_rows > 0) {
        //if there is one row that matches the searched query
        while ($row = $query->fetch_array()) {
            $postRows[] = $row;
        }
        return $postRows;
    }
}
function strCat($str)
{
    $string = strip_tags($str);