0?$_GET["page"]:1;
$start = $limit * ($page - 1);
//setting amount of posts allowed on page
if($_GET["type"]=="saved"){
//Getting the saved posts
conn();
$stop = $limit+1;
$stmt = $conn->prepare("SELECT * FROM bookmarks WHERE user_id = :uid ORDER BY unused_id DESC LIMIT $start,$stop");
$stmt->bindParam(":uid", $_GET["user"]);
$stmt->execute();
$row = $stmt->fetchAll();
$count = $stmt->rowCount();
$row = array_slice($row, 0, $limit);
foreach($row as $thing){
$stmt = $conn->prepare("SELECT * FROM forums WHERE post_id = :pid");
$stmt->bindParam(":pid", $thing["post_id"]);
$stmt->execute();
$post = $stmt->fetchAll();
makePost($post[0]);
}
if($count == 0){
$referer = $accountOwner?"your":getUserInfo($_GET["user"])->name."'s";
echo "
";
}
}else{
//Getting user's posts
conn();
$stop = $limit+1;
$stmt = $conn->prepare("SELECT * FROM forums WHERE poster_id = :pid ORDER BY date DESC LIMIT $start,$stop");
$stmt->bindParam(":pid", $_GET["user"]);
$stmt->execute();
$row = $stmt->fetchAll();
$count = $stmt->rowCount();
$row = array_slice($row, 0, $limit);
foreach($row as $post){
makePost($post);
}
}
//Getting how many posts the user has made
$stmt = $conn->prepare("SELECT COUNT(*) FROM forums WHERE poster_id = :id");
$stmt->bindParam(":id", $_GET["user"]);
$stmt->execute();
$numOfPosts = $postCount = $stmt->fetchColumn(0);
$numOfPosts = $numOfPosts==1?"$numOfPosts Post":"$numOfPosts Posts";
if($postCount == 0 && $_GET["type"]!="saved"){
$referer = $accountOwner?"your":getUserInfo($_GET["user"])->name."'s";
echo "
";
$user = $_GET["user"];
$type = $_GET["type"];
echo $page!=1?"
":"
";
echo $count>$limit?"
":"
";
echo "