function detail($id_product) { $url = '/index.php/order/getOrderData/'; //post variable $order_panel = $this->input->post('dispatch'); //new model $this->load->model('product_model'); //captcha $this->load->helper('captcha'); $vals = array('img_path' => './captcha/', 'img_url' => 'http://khanlen.vn/captcha/', 'font_patht' => './captcha/fonts/Heineken.ttf', 'expiration' => 7200, 'img_width' => '200', 'img_height' => 30); $cap = create_captcha($vals); $data = array('captcha_time' => $cap['time'], 'ip_address' => $this->input->ip_address(), 'word' => $cap['word']); $query = $this->db->insert_string('captcha', $data); $this->db->query($query); $expiration = time() - 7200; // Two hour limit $this->db->query("DELETE FROM captcha WHERE captcha_time < " . $expiration); $data['captcha'] = $cap; //new model $this->load->model('order_model'); $order_data = $this->order_model->SelectAll($encryption); $data['encrypt'] = $encryption; $data['ordered'] = $order_data['rows_order']; $data['paid_row'] = $order_data['paid_row']; $data['total_quantity'] = $order_data['total_quantity']; $data['row_product'] = ''; //load header $header = new header(); $header->loadheader('Chi ti?t s?n ph?m'); //sql $district = $this->db->select('*')->from('district')->get()->result_array(); if ($order_panel == 1) { $data['order_panel'] = "<script>loadDivFromUrl('order','{$url}" . "',1); </script>"; } if ($order_panel == null) { $data['order_panel'] = ""; } $result = $this->product_model->get_comment($id_product); $height = 715 + $result['num_rows'] * 15; $data['comment'] = $result['data_rows']; $data['footer_height'] = 980 + $result['num_rows'] * 15; $data['num_rows'] = $result['num_rows']; $data['height'] = $height; $data['datadistrict'] = $district; $data['err'] = ''; $data['detail'] = $this->product_model->get_detail($id_product); $data['city'] = $this->db->select('*')->from('city')->get()->result_array(); $data['id_product'] = $id_product; //session $this->load->library('session'); $encryption = $this->session->userdata('md5_time'); $data['encrypt'] = $encryption; $this->load->view('product/detail', $data); }