Example #1
0
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    if (isset($_POST['reply'])) {
        //$subject = test_input($_POST["subject"]);
        $reply = test_input($_POST["reply"]);
    }
}
function test_input($data)
{
    $data = trim($data);
    $data = stripslashes($data);
    $data = htmlspecialchars($data);
    return $data;
}
// Update the database -> forum_reply table
if (isset($_POST['submit'])) {
    $new_forum_topic = new forumReply();
    $new_forum_topic->createNew(array('post_id' => $_SESSION["id"], 'reply_title' => $subject, 'reply_post' => $reply, 'reply_posted_user' => $name, 'reply_posted_date' => $date));
    $new_forum_topic->register();
    header("Location: forum_view_posts.php?cid=" . $_SESSION["id"]);
    exit;
}
ob_flush();
// Get the updated details of forum_reply table
echo "<div class='datagrid'>\n<table><thead><tr><th width=\"70%\">Reply</th><th width=\"10%\">Posted Date</th><th width=\"10%\">Posted By</th></tr></thead>";
$allposts = forumReply::getallForumReply();
foreach ($allposts as $key => $value) {
    $post_id = $value->get_Postid();
    if ($post_id == $_SESSION["id"]) {
        $reply_id = $value->get_Replyid();
        #$subject=$value->get_Title();
        $reply = $value->get_Post();
Example #2
0
 public static function search($values = array())
 {
     $posts = array();
     $result1 = DB::getInstance()->search("forum_reply", $values);
     foreach ($result1 as $post) {
         $post_data = array("reply_id" => $post["post_id"], "post_id" => $post["post_id"], "reply_title" => $post["post_title"], "reply_post" => $post["reply_post"], "reply_posted_date" => $post["reply_posted_date"], "reply_posted_user" => $post["reply_posted_user"]);
         $new_post = new forumReply();
         $new_post->create($post_data);
         $posts[] = $new_post;
     }
     if (count($posts) == 1) {
         return $posts[0];
     } else {
         return $posts;
     }
     /*}
             else{
               return null;
     
           }*/
 }