Advertisement
Guest User

Filter File Upload

a guest
Jul 31st, 2015
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.68 KB | None | 0 0
  1. /* -- new_ticket -- */
  2.     public function new_ticket()
  3.     {
  4.         if (!$this->ion_auth->logged_in())
  5.         {
  6.             $this->session->set_flashdata('message', 'You must be an administrator to view this page.');
  7.             redirect(''.base_url().'', 'refresh');
  8.         }
  9.        
  10.         error_reporting(0);
  11.        
  12.         $Sample_Ticket = $_FILES['uploadedimages_ticket'];
  13.         if ((is_uploaded_file($SampleTicket)) && (isset($_FILES['uploadedimages_ticket'])) && !empty($_FILES['uploadedimages_ticket']['name'])) {
  14.             $this->form_validation->set_rules('uploadedimages_ticket[]','Upload Berkas','callback_fileupload_berkas');
  15.         }
  16.         $this->form_validation->set_rules('ticket_sla', 'Urgency', 'required');
  17.         $this->form_validation->set_rules('ticket_subject', 'Subject', 'required');
  18.         $this->form_validation->set_rules('ticket_assign_to', 'Assign Name', 'required');
  19.        
  20.         if ($this->form_validation->run() == true)
  21.         {
  22.             if ($this->_valid_csrf_nonce() === TRUE)
  23.             {
  24.                 if ( !empty($this->input->post('uploadedimages_ticket[]'))) {
  25.                     $SampleTicket = $_FILES['uploadedimages_ticket']['name'];
  26.                     foreach ($SampleTicket as $key => $value)  {
  27.                         $data_ticket = array(
  28.                             'ticketnumber' => $this->input->post('ticket_no'),
  29.                             'sla' => $this->input->post('ticket_sla'),
  30.                             'reporteddate' => $this->input->post('ticket_date'),
  31.                             'reportedduedate' => $this->input->post('ticket_due_date'),
  32.                             'telp' => $this->input->post('ticket_tlp'),
  33.                             'email' => $this->input->post('ticket_email'),
  34.                             'image_from' => var_dump($_FILES['uploadedimages_ticket']),
  35.                             'problemdetail' => $this->input->post('ticket_subject'),
  36.                             'ticketstatus' => 'Assigned',
  37.                             'assignee' => $this->input->post('ticket_assign_to'),
  38.                         );
  39.                         $this->m_ticket->m_new_ticket($data_ticket);
  40.                         $this->session->set_flashdata('message_success', 'Data berhasil ditambahkan');
  41.                         redirect("ListHD", 'refresh');
  42.                     }
  43.                 } else {
  44.                     $data_ticket = array(
  45.                         'ticketnumber' => $this->input->post('ticket_no'),
  46.                         'sla' => $this->input->post('ticket_sla'),
  47.                         'reporteddate' => $this->input->post('ticket_date'),
  48.                         'reportedduedate' => $this->input->post('ticket_due_date'),
  49.                         'telp' => $this->input->post('ticket_tlp'),
  50.                         'email' => $this->input->post('ticket_email'),
  51.                         'image_from' => '',
  52.                         'problemdetail' => $this->input->post('ticket_subject'),
  53.                         'ticketstatus' => 'Assigned',
  54.                         'assignee' => $this->input->post('ticket_assign_to'),
  55.                     );
  56.                     $this->m_ticket->m_new_ticket($data_ticket);
  57.                     $this->session->set_flashdata('message_success', 'Data berhasil ditambahkan');
  58.                     redirect("ListHD", 'refresh');
  59.                 }
  60.             }
  61.         } else {
  62.             redirect("ChangePass", 'refresh');
  63.         }
  64.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement