function get_blogs($link, $author) { $userid = get_userid($link, $author); return get_blogs_by_userid($link, $userid); }
$userid = get_userid($link, $user); echo "<tr><td><a href=\"index.php?session={$session}&auth={$userid}\">{$user}</a></td></tr>"; } ?> </tbody> </table> <?php } elseif (!isset($_GET["blog"])) { ?> <table> <tbody> <?php $author = $_GET["auth"]; $blogs = get_blogs_by_userid($link, $author); foreach ($blogs as $blog) { $title = get_blog_title($link, $blog); echo "<tr><td><a href=\"index.php?session={$session}&auth={$author}&blog={$blog}\">{$title}</a></td></tr>"; } // If logged in as this author if (isset($_SESSION[$session])) { $userid = $_SESSION[$session]; if ($author === $userid) { // Allow him/her to create new blog echo "<tr><td><a href=\"index.php?session={$session}&auth={$author}&edit&blog=new\"><u><i>Create new blog</i></u></a></td></tr>"; } } ?> </tbody> </table>