Exemplo n.º 1
0
 function comment($id)
 {
     if ($_POST['captcha'] == $this->session->userdata('captcha')) {
         if ($this->session->userdata('id')) {
             $_POST['user_id'] = $this->session->userdata('id');
         }
         $_POST['information_id'] = $id;
         $comment = new information_comment();
         $comment->from_array($_POST);
         $comment->save();
         set_notify('success', 'บันทึกข้อมูลเรียบร้อยค่ะ');
         redirect($_SERVER['HTTP_REFERER'] . '#comment' . $comment->id);
     } else {
         set_notify('error', 'กรุณากรอกตัวเลขให้ตรงกับภาพค่ะ');
         redirect($_SERVER['HTTP_REFERER']);
     }
 }
Exemplo n.º 2
0
 function commentdel($id)
 {
     if ($this->session->userdata('id')) {
         $comment = new information_comment($id);
         if ($comment->user_id == $this->session->userdata('id') || is_login('Administrator')) {
             $comment->delete();
         }
         set_notify('success', 'ลบความคิดเห็นเรียบร้อยค่ะ');
     }
     redirect($_SERVER['HTTP_REFERER']);
 }