Example #1
0
 function comment($id)
 {
     $captcha = $this->session->userdata('captcha');
     if ($_POST['captcha'] == $captcha && !empty($captcha)) {
         if ($this->session->userdata('id')) {
             $_POST['user_id'] = $this->session->userdata('id');
         }
         $_POST['blogpost_id'] = $id;
         $comment = new blogcomment();
         $comment->from_array($_POST);
         $comment->save();
         set_notify('success', 'บันทึกข้อมูลเรียบร้อยค่ะ');
         redirect($_SERVER['HTTP_REFERER'] . '#comment' . $comment->id);
     } else {
         set_notify('error', 'กรุณากรอกตัวเลขให้ตรงกับภาพค่ะ');
         redirect($_SERVER['HTTP_REFERER']);
     }
 }