{ $sql = "SELECT title FROM blog_posts ORDER BY RAND() LIMIT 10"; $result = readBlogPostQuery($sql); return $result; } } // get posted vars if (!empty($_POST)) { $author_name = $_POST["author_name"]; $author_img_url = $_POST['author_img_url']; $date_time_created = $_POST['date_time']; $title = $_POST['title']; $content = $_POST['content']; $date_time_edited = $_POST['date_time']; $blog_post = new Blog_Post(); $blog_post->setBlogPostValues($title, $author_name, $author_img_url, $date_time_created, $date_time_edited, $content); $blog_post->insertBlogPost(); $protocol = 'http'; if (isset($_SERVER['HTTPS'])) { if (strtoupper($_SERVER['HTTPS']) == 'ON') { $protocol = 'https'; } } header("location: {$protocol}://" . $_SERVER['HTTP_HOST'] . "/blog_view.php"); exit; } //instanciate class object ?>