Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function posts($category = 0) {
- if ($this->session->userdata('student_login') != 1)
- redirect(base_url(), 'refresh');
- $page_data['category_filter'] = $category;
- $page_data['page_name'] = 'posts';
- $page_data['page_title'] = 'Postagens';
- $this->load->view('backend/index', $page_data);
- }
- function create_comment($post) {
- if ($this->session->userdata('student_login') != 1)
- redirect(base_url(), 'refresh');
- $data['content'] = $this->input->post('comment');
- $data['post_id'] = $post;
- $data['created_by_student'] = $this->session->userdata('student_id');
- $data['created_by'] = 'student';
- $data['created_at'] = date('d/m/Y H:m');
- $this->db->insert('post_comments', $data);
- $this->session->set_flashdata('flash_message', 'Enviado com sucesso');
- redirect(site_url('student/posts'), 'refresh');
- }
- function delete_comment($comment) {
- if ($this->session->userdata('student_login') != 1)
- redirect(base_url(), 'refresh');
- $this->db->where('id', $comment);
- $this->db->delete('post_comments');
- $this->session->set_flashdata('flash_message', 'Removido com sucesso');
- redirect(site_url('student/posts'), 'refresh');
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement