html_post($dbh, $posts[$i]); $num_result++; } if ($num_result == 0) { echo '<p>There appears to be no post here</p>'; } } ?> <div class="row" style='border-bottom: 1px solid #000; margin-bottom: 10px; padding-top:20px;'> <div class="row" style='padding-left: 10px; padding-right: 10px; padding-top: 5px;'> <div class="col-md-10"><h2>Recommended Posts</h2></div> </div> </div> <?php $num_result = 0; $resp = get_recommended_posts($dbh, 5, $_SESSION['user']); if ($resp['status'] == 1) { $posts = $resp['posts']; for ($i = 0; $i < count($posts); $i++) { html_post($dbh, $posts[$i]); $num_result++; } if ($num_result == 0) { echo '<p>There appears to be no post here</p>'; } } ?> <div class="row" style='border-bottom: 1px solid #000; margin-bottom: 10px; padding-top:20px;'> <div class="row" style='padding-left: 10px; padding-right: 10px; padding-top: 5px;'> <div class="col-md-10">
<?php session_start(); include "../config.php"; include "../functions.php"; include "../private_functions.php"; if (isset($_SESSION['auth']) && $_SESSION['auth'] == 1) { $dbh = db_connect($MY_HOST, $MY_DB_PORT, $MY_DB, $DB_USER, $DB_PW); $num = 10; if (isset($_GET['count']) && is_numeric($_GET['count'])) { $num = $_GET['count']; } $res = get_recommended_posts($dbh, $num, $_SESSION['user']); close_db_connection($dbh); echo json_encode($res); } else { echo json_encode(array("status" => -1)); }