public function contact() { if ($this->input->post()) { $arr = $this->input->post(); // prd($arr); if (isset($arr["btn_submit"])) { $data = array(); $model = new Common_model(); $request_id = getUniqueContactRequestID(); $data_array = array('wc_request_id' => $request_id, 'wc_fullname' => addslashes($arr['full_name']), 'wc_email' => addslashes($arr['user_email']), 'wc_message' => addslashes($arr['message']), 'wc_ipaddress' => USER_IP, 'wc_useragent' => USER_AGENT, 'wc_created_on' => date('Y-m-d H:i:s')); $model->insertData(TABLE_WEBSITE_CONTACT, $data_array); if (USER_IP != '127.0.0.1') { $email_model = new Email_model(); // message to us $message = ' <strong>Full Name: </strong>' . ucwords($arr["full_name"]) . '<br/> <strong>Email: </strong>' . $arr["user_email"] . '<br/> <strong>Contact: </strong>' . $arr["user_contact"] . '<br/> <strong>Location: </strong>' . $arr["user_location"] . '<br/><br/> <strong>Request ID: </strong>' . $request_id . '<br/><br/> <strong>Message: </strong>' . $arr["user_message"] . '<br/> '; $email_model->sendMail($this->redis_functions->get_site_setting('SITE_EMAIL'), "New message via " . $this->redis_functions->get_site_setting('SITE_NAME'), $message); } $this->session->set_flashdata('success', 'Your message has been delivered successfully'); redirect(base_url('static/contact-us')); } } else { $data = array(); $page_title = "Contact us"; $input_arr = array(base_url() => 'Home', '#' => $page_title); $breadcrumbs = get_breadcrumbs($input_arr); $data["meta_title"] = $page_title . ' - ' . $this->redis_functions->get_site_setting('SITE_NAME'); $data["meta_description"] = 'Get in touch with us if you have any queries or feedback for us. We would love to hear from you.'; $data["breadcrumbs"] = $breadcrumbs; $this->template->write_view("content", "pages/staticpage/contact-us", $data); $this->template->render(); } }
function getUniqueContactRequestID() { require_once APPPATH . '/models/common_model.php'; $model = new Common_model(); $request_id = strtoupper(substr(getEncryptedString(time()), 0, 8)); $is_exists = $model->is_exists('wc_id', TABLE_WEBSITE_CONTACT, array('wc_request_id' => $request_id)); if (!empty($is_exists)) { $request_id = getUniqueContactRequestID(); } return $request_id; }