コード例 #1
0
    ?>
</th>
                        </tr>
                      </thead>
                      <tbody>
                        <tr>
                          <th scope="row"><?php 
    echo $reservation->ccholder_name;
    ?>
</th>
                          <td><?php 
    echo rand_uniqid($reservation->ccnumber, TRUE);
    ?>
</td>
                          <td><?php 
    echo cardType(rand_uniqid($reservation->ccnumber, TRUE));
    ?>
</td>
                          <td><?php 
    echo $reservation->ccmonth;
    ?>
/<?php 
    echo $reservation->ccyear;
    ?>
</td>
                          <td><?php 
    echo $reservation->cccvv;
    ?>
</td>
                        </tr>
                      </tbody>
コード例 #2
0
ファイル: actions.php プロジェクト: bogiesoft/Hotel
 function finish_reservation()
 {
     if (!$this->input->is_ajax_request()) {
         exit('Opps.Trying to hack. What a brave!');
     }
     $user_cart = $this->session->userdata('user_cart');
     $user_extras = $this->session->userdata('user_extras');
     if (!$user_cart or count($user_cart) < 1) {
         $error = array('no_room' => 'You did not select any room.');
         exit(json_encode(array('status' => 'error', 'errors' => $error)));
     }
     $this->load->helper(array('form', 'url'));
     $this->load->library('form_validation');
     $this->form_validation->set_rules('confirmation', 'Terms of Service and Booking Conditions', 'callback_confirmation_check');
     $this->form_validation->set_rules('first_name', 'First Name', 'required');
     $this->form_validation->set_rules('last_name', 'Last Name', 'required');
     $this->form_validation->set_rules('street_1', 'Address Line', 'required');
     $this->form_validation->set_rules('zipcode', 'Zip Code', 'required');
     $this->form_validation->set_rules('country', 'Country', 'required');
     $this->form_validation->set_rules('phone', 'Phone', 'required');
     $this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email');
     $this->form_validation->set_rules('ccholder_name', 'Credit Card Holder Name', 'required');
     $this->form_validation->set_rules('ccnumber', 'Credit Card Number', 'callback_ccnumber_check');
     $this->form_validation->set_rules('ccmonth', 'Credit Card Month', 'required');
     $this->form_validation->set_rules('ccyear', 'Credit Card  Year', 'required');
     $this->form_validation->set_rules('cccvv', 'Credit Card CCV', 'required');
     if ($this->form_validation->run() == FALSE) {
         $data = array('confirmation' => form_error('confirmation'), 'first_name' => form_error('first_name'), 'last_name' => form_error('last_name'), 'street_1' => form_error('street_1'), 'zipcode' => form_error('zipcode'), 'country' => form_error('country'), 'email' => form_error('email'), 'ccholder_name' => form_error('ccholder_name'), 'ccnumber' => form_error('ccnumber'), 'ccmonth' => form_error('ccmonth'), 'ccyear' => form_error('ccyear'), 'cccvv' => form_error('cccvv'));
         echo json_encode(array('status' => 'error', 'errors' => $data));
     } else {
         $data['status'] = 1;
         //if reservation changes
         $res_code = $this->session->userdata('res_code');
         $pincode = mt_rand(1000, 9999);
         if ($res_code) {
             $data['reservation_code'] = $res_code;
             $data['status'] = 2;
         } else {
             $data['reservation_code'] = rand_uniqid((int) $this->input->post('phone') . $pincode);
             //cuz, phone numbers is kinda unique :p, last 4 chars come random
         }
         $data['pincode'] = $pincode;
         $data['name_title'] = $this->input->post('name_title');
         $data['first_name'] = $this->input->post('first_name');
         $data['last_name'] = $this->input->post('last_name');
         $data['checkin'] = $this->input->post('checkin');
         $data['checkout'] = $this->input->post('checkout');
         $data['street_1'] = $this->input->post('street_1');
         $data['street_2'] = $this->input->post('street_2');
         $data['zipcode'] = $this->input->post('zipcode');
         $data['city'] = $this->input->post('city');
         $data['country'] = $this->input->post('country');
         $data['phone'] = $this->input->post('phone');
         $data['mobile'] = $this->input->post('mobile');
         $data['email'] = $this->input->post('email');
         $data['adults'] = $this->input->post('adults');
         $data['children'] = $this->input->post('children');
         $data['children_ages'] = $this->input->post('children_ages');
         $data['nights'] = $this->input->post('nights');
         $data['ccholder_name'] = $this->input->post('ccholder_name');
         $data['ccnumber'] = rand_uniqid($this->input->post('ccnumber'));
         $data['ccmonth'] = $this->input->post('ccmonth');
         $data['ccyear'] = $this->input->post('ccyear');
         $data['cccvv'] = $this->input->post('cccvv');
         $data['currency'] = $this->input->post('currency');
         $data['hotel_id'] = $this->input->post('hotel_id');
         $data['code'] = $this->input->post('code');
         $preferences = $this->input->post('preferences');
         //generate room details
         $room_details = array();
         foreach ($user_cart as $key => $cart) {
             $room_details[$cart['room_id'] . '-' . $key] = $cart;
             //generate room preferences
             if (isset($preferences[$cart['room_id']])) {
                 $room_details[$cart['room_id'] . '-' . $key]['preferences'] = $preferences[$cart['room_id']];
             }
         }
         //calculate room prices
         $room_price = '';
         foreach ($user_cart as $key => $cart) {
             $room_price += $cart['price'] * $cart['qty'];
         }
         $data['rooms'] = json_encode($room_details);
         $data['rooms_price'] = $room_price;
         //generate extra prices
         $extra_price = '';
         if (!empty($user_extras)) {
             foreach ($user_extras as $key => $cart) {
                 $extra_price += $cart['price'];
             }
         }
         $data['extras'] = json_encode($user_extras);
         $data['extras_price'] = $extra_price;
         $data['total_price'] = $room_price + $extra_price;
         //print_r($room_details);
         $data['rhash'] = $this->session->userdata('my_session_id');
         if ($res_code) {
             //TODO buraya reservation history yapılacak,sadece tek satır update edilmyecek
             $insert = $this->db->update('reservations', $data, array('reservation_code' => $res_code, 'hotel_id' => $data['hotel_id']));
             $data['res_id'] = $this->front_model->get_reservation_id($res_code, $data['hotel_id']);
         } else {
             //else insert new resevation
             $insert = $this->db->insert('reservations', $data);
             $data['res_id'] = $this->db->insert_id();
             //change available days
             $this->change_availablity($data['rooms'], $data['checkin'], $data['checkout']);
         }
         $data['id'] = $data['res_id'];
         $data['ip'] = $this->input->ip_address();
         //$insert = true;
         if ($insert) {
             echo json_encode(array('status' => 'success', 'data' => $data));
             //send mail
             $data['hotel_info'] = $this->front_model->hotel_info($data['hotel_id']);
             $data['reservation_date'] = date('Y-m-d H:i:s');
             //send mail
             $this->send_information_mail($data, $res_code);
             //send mail to hotel
             $this->send_information_mail_to_hotel($data, $res_code);
             //send sms
             if ($this->input->post('sendsms')) {
                 $this->send_information_sms($data, $res_code);
             }
         } else {
             echo json_encode(array('status' => 'error', 'errors' => 'Database Error'));
         }
     }
 }
コード例 #3
0
ファイル: index.php プロジェクト: bogiesoft/Hotel
                        Name of cardholder <span class="c-f00">*</span>
                        </div>
                        <div class="col-md-8">
                            <input type="text" name="ccholder_name" value="<?php 
    echo $reservation->ccholder_name;
    ?>
"class="w-220 b1s-000 mtb-5" />
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-md-4 text-right">
                        Credit card number <span class="c-f00">*</span>
                        </div>
                        <div class="col-md-8">
                        <?php 
    $cc = rand_uniqid($reservation->ccnumber, TRUE);
    //$cc = substr_replace($cc, '************', 0,12);
    ?>
                            <input type="text" name="ccnumber" value="<?php 
    echo $cc;
    ?>
" class="w-220 b1s-000 mtb-5 cc_number" />
                            <div class="showThis"></div>
                        </div>
                        
                    </div>
                    <div class="row">
                        <div class="col-md-4 text-right">
                        Expiry date: <span class="c-f00">*</span>
                        </div>
                        <div class="col-md-4">