Server : Apache/2.4.18 (Ubuntu) System : Linux canvaswebdesign 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 UTC 2015 x86_64 User : oppastar ( 1041) PHP Version : 7.0.33-0ubuntu0.16.04.15 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, Directory : /proc/self/root/var/www/blue-sky.co.id/public_html/application/controllers/ |
Upload File : |
<?php defined('BASEPATH') OR exit('No direct script access allowed'); class Book_airport_lounge extends Public_Controller { private $image_filename = NULL; private $image_filename2 = NULL; private $image_filename3 = NULL; private $image_filename4 = NULL; public function __construct() { parent::__construct(); } public function index() { if (!($_POST)) { redirect(base_url()); } //LOAD LANGUAGE FILES if($this->session->userdata('site_lang') == 'english') { $this->lang->load('all_lang', 'english'); } else { $this->lang->load('all_lang', 'indonesian'); } $this->data['lounge_data']= $this->db->select('id_products, title, email, prefix')->from('products')->where('id_products',$this->input->post('lounge_id'))->where('booking_active', 'yes')->order_by('title', 'asc')->get()->row(); $this->data['datepickeri2'] = $this->input->post('arrival_date'); $this->data['arrival_time_1'] =$this->input->post('arrival_time_1'); $this->data['arrival_time_2'] =$this->input->post('arrival_time_2'); $this->data['flight_time_1'] =$this->input->post('flight_time_1'); $this->data['flight_time_2'] =$this->input->post('flight_time_2'); $this->data['number_person'] = $this->input->post('number_of_person'); $this->data['number_children'] = $this->input->post('number_of_children'); //get SEO $this->data_header['browser_title'] = 'Book Airport Lounge'; $this->data_header['meta_description'] = 'Book Airport Lounge'; $this->load->view("themes/$this->theme_no/header", $this->data_header); $this->load->view("themes/$this->theme_no/book_airport_lounge.php",$this->data); $this->load->view("themes/$this->theme_no/footer", $this->data_footer); } public function payment(){ if (!$_POST) { redirect(base_url()); } $data_email = array(); $number_person = $this->input->post('number_person_traveller'); $number_children = $this->input->post('number_person_children'); $data_email['contact_name'] = $this->input->post('contact_name'); $data_email['contact_phone'] = $this->input->post('contact_phone'); $data_email['contact_email'] = $this->input->post('contact_email'); $data_email['booking_date'] = $this->input->post('booking_date'); $data_email['booking_time1'] = $this->input->post('booking_time1'); $data_email['booking_time2'] = $this->input->post('booking_time2'); $data_email['flight_time1'] = $this->input->post('flight_time1'); $data_email['flight_time2'] = $this->input->post('flight_time2'); $data_email['lounge_prefix'] = $this->input->post('lounge_prefix'); $data_email['lounge_email'] = $this->input->post('lounge_email'); $data_email['lounge_id'] = $this->input->post('lounge_id'); $data_email['lounge_name'] = $this->input->post('lounge_name'); if ($number_person > 0) { $data_email['foto_ktp_1'] = $this->input->post('foto_ktp_1'); $data_email['booking_code'] = $this->input->post('booking_code'); $data_email['traveller_name'] = $this->input->post('traveller_name'); $data_email['choose_flight_1'] = $this->input->post('choose_flight_1'); } if ($number_person > 1) { $data_email['booking_code2'] = $this->input->post('booking_code2'); $data_email['traveller_name2'] = $this->input->post('traveller_name2'); $data_email['choose_flight_2'] = $this->input->post('choose_flight_2'); $data_email['foto_ktp_2'] = $this->input->post('foto_ktp_2'); } if ($number_person > 2) { $data_email['booking_code3'] = $this->input->post('booking_code3'); $data_email['traveller_name3'] = $this->input->post('traveller_name3'); $data_email['choose_flight_3'] = $this->input->post('choose_flight_3'); $data_email['foto_ktp_3'] = $this->input->post('foto_ktp_3'); } if ($number_person > 3) { $data_email['booking_code4'] = $this->input->post('booking_code4'); $data_email['traveller_name4'] = $this->input->post('traveller_name4'); $data_email['choose_flight_4'] = $this->input->post('choose_flight_4'); $data_email['foto_ktp_4'] = $this->input->post('foto_ktp_4'); } if ($number_children > 0) { $data_email['choose_flight_child_1'] = $this->input->post('choose_flight_child_1'); $data_email['chlid_name'] = $this->input->post('chlid_name'); $data_email['booking_code_child'] = $this->input->post('booking_code_child'); $data_email['tanggal'] = $this->input->post('tanggal'); $data_email['bulan'] = $this->input->post('bulan'); $data_email['tahun'] = $this->input->post('tahun'); } if ($number_children > 1) { $data_email['choose_flight_child_2'] = $this->input->post('choose_flight_child_2'); $data_email['chlid_name2'] = $this->input->post('chlid_name2'); $data_email['booking_code_child2'] = $this->input->post('booking_code_child2'); $data_email['tanggal2'] = $this->input->post('tanggal2'); $data_email['bulan2'] = $this->input->post('bulan2'); $data_email['tahun2'] = $this->input->post('tahun2'); } $service = $this->input->post('services'); if (isset($service[0])) { $data_email['vip_room'] = $service[0]; } if (isset($service[1])) { $data_email['air_car'] = $service[1]; } $data_email['payment'] = $this->input->post('payment'); // $booking_date_array = explode('-', $booking_date); // $booking_date_month = $booking_date_array[1]; // $booking_date_year = date('y', strtotime($booking_date_array[2])); // $count_reservation = $this->db->select('id')->from('lounge_reservation')->where('lounge_id', $data_email['lounge_id'])->where('month_year', $booking_date_month . '-' . $booking_date_year)->get()->num_rows(); // if($count_reservation > 0) { // //add to reservation count // //first, get current reservation count // $reservation_count = $this->db->select('count')->from('lounge_reservation')->where('lounge_id', $data_email['lounge_id'])->where('month_year', $booking_date_month . '-' . $booking_date_year)->get()->row()->count; // $new_count = $reservation_count + 1; // $update_data = array( // 'count' => $new_count // ); // $this->db->where('lounge_id', $data_email['lounge_id']); // $this->db->where('month_year', $booking_date_month . '-' . $booking_date_year); // $this->db->update('lounge_reservation', $update_data); // if($new_count < 10) { // $new_count = '0' . $new_count; // } // $reservation_id = $data_email['lounge_prefix'] . $booking_date_year . $booking_date_month . $new_count; // } else { // //create new reservation // $insert_data = array( // 'lounge_id' => $lounge_id, // 'month_year' => $booking_date_month . '-' . $booking_date_year, // 'count' => 1 // ); // $this->db->insert('lounge_reservation', $insert_data); // $reservation_id = $data_email['lounge_prefix'] . $booking_date_year . $booking_date_month . '01'; // } $data_email['reservation_id'] = $this->input->post('reservation_id'); $data_email['lounge_banner'] = $this->db->select('image')->from('products')->where('id_products', $data_email['lounge_id'])->get()->row()->image; $website_data = $this->db->select('logo, from_email, website_name, email_smtp_host, email_smtp_port, email_smtp_password, email_smtp')->from('configuration')->where('id_configuration', 1)->get()->row(); $email_data['website_name'] = $website_data->website_name; $email_data['logo'] = $website_data->logo; $this->load->library('email'); $config['protocol'] = 'smtp'; $config['smtp_host'] = $website_data->email_smtp_host; $config['smtp_port'] = $website_data->email_smtp_port; $config['smtp_user'] = $website_data->email_smtp; $config['smtp_pass'] = $website_data->email_smtp_password; $config['mailtype'] = 'html'; $config['smtp_crypto'] = 'ssl'; $config['charset'] = 'iso-8859-1'; //$config['charset'] = 'UTF-8'; $config['wordwrap'] = TRUE; $config['newline'] = "\r\n"; //use double quotes to comply with RFC 822 standard $this->email->set_crlf( "\r\n" ); //must add this for hotmail $this->email->initialize($config); $this->email->from($website_data->from_email, $website_data->website_name); $this->email->to($data_email['contact_email']); $this->email->subject('Your Booking. Reservation ID: ' . $data_email['reservation_id']); $myMessage = $this->load->view('email/english/airport-lounge-booking-for-guest.php',$data_email,true); $this->email->message($myMessage); $respon_email = $this->email->send(); $this->email->set_crlf( "\r\n" ); //must add this for hotmail $this->email->initialize($config); $this->email->from($website_data->from_email, $website_data->website_name); $this->email->to($data_email['lounge_email']); $this->email->subject('Your Booking. Reservation ID: ' . $data_email['reservation_id']); $myMessages = $this->load->view('email/english/airport-lounge-booking-for-admin.php',$data_email,true); $this->email->message($myMessages); $respon_email = $this->email->send(); if(!$respon_email){ var_dump($this->email->print_debugger()); exit(); } $this->session->set_flashdata('success', '<p style="background:#002d57; color:white; padding:15px;font-size:20px; width:100%; text-align:center; margin-bottom:30px; margin-top:30px;">Thank you. Your Booking has been received. Please show Booking Email Confirmation when You arrive, with your IDs and flight ticket.</p>'); $this->index(); } public function submit_form() { if (!$_POST) { redirect(base_url()); } $data_op = array(); $contact_name = $this->input->post('contact_name'); $contact_phone = $this->input->post('contact_phone'); $contact_email = $this->input->post('contact_email'); $payment_type = $this->input->post('payment'); $booking_date = $this->input->post('booking_date'); $booking_time1 = $this->input->post('booking_time1'); $booking_time2 = $this->input->post('booking_time2'); $lounge_prefix = $this->input->post('lounge_prefix'); $lounge_email = $this->input->post('lounge_email'); $lounge_id = $this->input->post('lounge_id'); $traveller_name = $this->input->post('traveller_name'); $booking_code = $this->input->post('booking_code'); $choose_flight_traveller1 = $this->input->post('choose_flight2'); $choose_flight_1 = $this->input->post('choose_flight'); $traveller_name2 = $this->input->post('traveller_name2'); $booking_code2 = $this->input->post('booking_code2'); $choose_flight_traveller2 = $this->input->post('choose_flight3'); $choose_flight_2 = $this->input->post('choose_flight_2'); $traveller_name3 = $this->input->post('traveller_name3'); $booking_code3 = $this->input->post('booking_code3'); $choose_flight_traveller3 = $this->input->post('choose_flight4'); $choose_flight_3 = $this->input->post('choose_flight_3'); $traveller_name4 = $this->input->post('traveller_name4'); $booking_code4 = $this->input->post('booking_code4'); $choose_flight_traveller4 = $this->input->post('choose_flight5'); $choose_flight_4 = $this->input->post('choose_flight_4'); $child = $this->input->post('chlid_name'); $booking_child = $this->input->post('booking_code_child'); $choose_flight_child = $this->input->post('choose_flight_child'); $choose_flight_child_1 = $this->input->post('choose_flight_child_1'); $tgl1 = $this->input->post('tanggal'); $bulan1 = $this->input->post('bulan'); $tahun1 = $this->input->post('tahun'); $child2 = $this->input->post('chlid_name2'); $booking_child2 = $this->input->post('booking_code_child2'); $choose_flight_child2 = $this->input->post('choose_flight_child2'); $choose_flight_child_2 = $this->input->post('choose_flight_child_2'); $tgl2 = $this->input->post('tanggal2'); $bulan2 = $this->input->post('bulan2'); $tahun2 = $this->input->post('tahun2'); $number_person = $this->input->post('number_person_traveller'); $number_children = $this->input->post('number_person_children'); $data_op['number_person'] = $number_person; $data_op['number_children'] = $number_children; $data_op['contact_name'] = $contact_name; $data_op['contact_phone'] = $contact_phone; $data_op['contact_email'] = $contact_email; $data_op['choose_flight'] = $choose_flight; $data_op['payment_type'] = $payment_type; $data_op['booking_date'] = $booking_date; $data_op['booking_time1'] = $booking_time1; $data_op['booking_time2'] = $booking_time2; $data_op['lounge_name'] = $this->input->post('lounge_name'); $data_op['lounge_id'] = $lounge_id; $data_op['lounge_email'] = $lounge_email; $data_op['flight_time1'] = $this->input->post('flight_time1'); $data_op['flight_time2'] = $this->input->post('flight_time2'); //generate unique reservation id.. //eg: PNK190940 //PNK (pontianak), 19 tahun 2019, 09 september, 40 order id for sep //check if lounge_id with month_year exits, if exist, add to count, if not, create new count $booking_date_array = explode('-', $booking_date); $booking_date_month = $booking_date_array[1]; $booking_date_year = date('y', strtotime($booking_date_array[2])); $count_reservation = $this->db->select('id')->from('lounge_reservation')->where('lounge_id', $lounge_id)->where('month_year', $booking_date_month . '-' . $booking_date_year)->get()->num_rows(); if($count_reservation > 0) { //add to reservation count //first, get current reservation count $reservation_count = $this->db->select('count')->from('lounge_reservation')->where('lounge_id', $lounge_id)->where('month_year', $booking_date_month . '-' . $booking_date_year)->get()->row()->count; $new_count = $reservation_count + 1; $update_data = array( 'count' => $new_count ); $this->db->where('lounge_id', $lounge_id); $this->db->where('month_year', $booking_date_month . '-' . $booking_date_year); $this->db->update('lounge_reservation', $update_data); if($new_count < 10) { $new_count = '0' . $new_count; } $reservation_id = $lounge_prefix . $booking_date_year . $booking_date_month . $new_count; } else { //create new reservation $insert_data = array( 'lounge_id' => $lounge_id, 'month_year' => $booking_date_month . '-' . $booking_date_year, 'count' => 1 ); $this->db->insert('lounge_reservation', $insert_data); $reservation_id = $lounge_prefix . $booking_date_year . $booking_date_month . '01'; } $data_op['reservation_id'] = $reservation_id; if ($number_children > 0) { $data_op['child'] = $child; $data_op['booking_child'] = $booking_child; $data_op['choose_flight_child'] = $choose_flight_child; $data_op['choose_flight_child_1'] = $choose_flight_child_1; $data_op['tgl1'] = $tgl1; $data_op['bulan1'] = $bulan1; $data_op['tahun1'] = $tahun1; } if ($number_children > 1) { $data_op['child2'] = $child2; $data_op['booking_child2'] = $booking_child2; $data_op['choose_flight_child2'] = $choose_flight_child2; $data_op['choose_flight_child_2'] = $choose_flight_child_2; $data_op['tgl2'] = $tgl2; $data_op['bulan2'] = $bulan2; $data_op['tahun2'] = $tahun2; } if($number_person > 0) { if ($_FILES['uploadfile1']['size'] !== 0) { $config['upload_path'] = './uploads/'; $config['allowed_types'] = 'jpg|png|jpeg'; $config['max_size'] = '1000'; $this->load->library('upload', $config); $this->upload->initialize($config); if ( ! $this->upload->do_upload('uploadfile1')) { $this->session->set_flashdata('uploadfile1', '<br> <p style="background:orange; color:white; padding:5px; font-weight:bold;">Kesalahan Unggah Gambar. Format atau ukuran salah.</p>'); redirect(); } else { $image = $this->upload->data(); $image_filename = $image['file_name']; } } if (isset($image_filename)) { $data_op['foto_ktp_1'] = $image_filename; } $data_op['traveller_name'] = $traveller_name; $data_op['booking_code'] = $booking_code; $data_op['choose_flight_traveller1'] = $choose_flight_traveller1; $data_op['choose_flight_1'] = $choose_flight_1; } if($number_person > 1) { if ($_FILES['uploadfile2']['size'] !== 0) { $config['upload_path'] = './uploads/'; $config['allowed_types'] = 'jpg|png|jpeg'; $config['max_size'] = '1000'; $this->load->library('upload', $config); $this->upload->initialize($config); if ( ! $this->upload->do_upload('uploadfile2')) { $this->session->set_flashdata('uploadfile2', '<br> <p style="background:orange; color:white; padding:5px; font-weight:bold;">Kesalahan Unggah Gambar. Format atau ukuran salah.</p>'); redirect(); } else { $image2 = $this->upload->data(); $image_filename2 = $image2['file_name']; } } if (isset($image_filename2)) { $data_op['foto_ktp_2'] = $image_filename2; } $data_op['traveller_name2'] = $traveller_name2; $data_op['booking_code2'] = $booking_code2; $data_op['choose_flight_traveller2'] = $choose_flight_traveller2; $data_op['choose_flight_2'] = $choose_flight_2; } if ($number_person > 2) { if ($_FILES['uploadfile3']['size'] !== 0) { $config['upload_path'] = './uploads/'; $config['allowed_types'] = 'jpg|png|jpeg'; $config['max_size'] = '1000'; $this->load->library('upload', $config); $this->upload->initialize($config); if ( ! $this->upload->do_upload('uploadfile3')) { $this->session->set_flashdata('uploadfile3', '<br> <p style="background:orange; color:white; padding:5px; font-weight:bold;">Kesalahan Unggah Gambar. Format atau ukuran salah.</p>'); redirect(); } else { $image3 = $this->upload->data(); $image_filename3 = $image3['file_name']; } } if (isset($image_filename3)) { $data_op['foto_ktp_3'] = $image_filename3; } $data_op['traveller_name3'] = $traveller_name3; $data_op['booking_code3'] = $booking_code3; $data_op['choose_flight_traveller3'] = $choose_flight_traveller3; $data_op['choose_flight_3'] = $choose_flight_3; } if ($number_person > 3) { if ($_FILES['uploadfile4']['size'] !== 0) { $config['upload_path'] = './uploads/'; $config['allowed_types'] = 'jpg|png|jpeg'; $config['max_size'] = '1000'; $this->load->library('upload', $config); $this->upload->initialize($config); if ( ! $this->upload->do_upload('uploadfile4')) { $this->session->set_flashdata('uploadfile4', '<br> <p style="background:orange; color:white; padding:5px; font-weight:bold;">Kesalahan Unggah Gambar. Format atau ukuran salah.</p>'); redirect(); } else { $image4 = $this->upload->data(); $image_filename4 = $image4['file_name']; } } if (isset($image_filename4)) { $data_op['foto_ktp_4'] = $image_filename4; } $data_op['traveller_name4'] = $traveller_name4; $data_op['booking_code4'] = $booking_code4; $data_op['choose_flight_traveller4'] = $choose_flight_traveller4; $data_op['choose_flight_4'] = $choose_flight_4; } //send email // $myMessage = $this->load->view('email/english/airport-lounge-booking-for-admin.php',$data_op,true); //get image banner for lounge $data_op['lounge_banner'] = $this->db->select('image')->from('products')->where('id_products', $lounge_id)->get()->row()->image; $data_op['lounge_data']= $this->db->select('id_products, title, email, prefix')->from('products')->where('id_products',$this->input->post('lounge_id'))->where('booking_active', 'yes')->order_by('title', 'asc')->get()->row(); //get website data $this->load->view("themes/$this->theme_no/header", $this->data_header); $this->load->view("themes/$this->theme_no/payment_lounge.php",$data_op); $this->load->view("themes/$this->theme_no/footer", $this->data_footer); } }