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(); } }
public function forgotPassword() { if (!isset($this->session->userdata['user_id'])) { $data = array(); $model = new Common_model(); if ($this->input->post()) { $arr = $this->input->post(); $user_email = trim(strtolower($arr['user_email'])); $is_valid_email = $model->is_exists('user_id, user_status, user_fullname, user_username', TABLE_USERS, array('user_email' => $user_email)); if (!empty($is_valid_email)) { // valid $user_status = $is_valid_email[0]['user_status']; if ($user_status == '1') { // active user $full_name = ucwords($is_valid_email[0]['user_fullname']); $new_password = substr(getEncryptedString($user_email . "-" . $user_status . time()), 0, 6); $model->updateData(TABLE_USERS, array('user_password' => md5($new_password)), array('user_email' => $user_email)); // updating redis keys now $this->redis_functions->set_user_profile_data($is_valid_email[0]['user_username']); if ($_SERVER['REMOTE_ADDR'] != '127.0.0.1') { $this->load->library('EmailTemplates'); $emailTemplate = new EmailTemplates(); $messageContent = $emailTemplate->forgot - password($full_name, $new_password); $email_model = new Email_model(); $email_model->sendMail($user_email, 'Forgot Password - ' . $this->redis_functions->get_site_setting('SITE_NAME'), $messageContent); } $this->session->set_flashdata('error', '<strong>Success!</strong> We have sent you a new password on your email. Please check'); redirect(base_url('login')); } else { // account not active $this->session->set_flashdata('error', '<strong>Sorry!</strong> Your account is not active'); redirect(base_url('forgot-password')); } } else { // invalid $this->session->set_flashdata('error', 'No such record found.'); redirect(base_url('forgot-password')); } } else { $page_title = 'Forgot Password'; $input_arr = array(base_url() => 'Home', '#' => $page_title); $breadcrumbs = get_breadcrumbs($input_arr); $data["breadcrumbs"] = $breadcrumbs; $data["page_title"] = $page_title; $data['meta_title'] = $data["page_title"] . ' - ' . $this->redis_functions->get_site_setting('SITE_NAME'); $this->template->write_view("content", "pages/index/forgot-password", $data); $this->template->render(); } } else { redirect(base_url('change-password')); } }
public function paypal_success() { if ($this->input->get('trip_url_key') && $this->input->get('plan_key') && $this->input->get('id') && $this->input->post()) { if ($this->input->post('item_number1') == $this->input->get('trip_url_key')) { $user_id = $this->session->userdata['user_id']; $user_email = $this->session->userdata['user_email']; if ($user_id == getEncryptedString($this->input->get('id'), 'decode')) { $model = new Common_model(); $redis_functions = new Redisfunctions(); $trip_url_key = $this->input->get('trip_url_key'); $featured_plan_key = $this->input->get('plan_key'); $post_details = $redis_functions->get_trip_details($trip_url_key); $feature_plan_details = $model->fetchSelectedData('*', TABLE_FEATURED_MASTER, array('pfm_key' => $featured_plan_key)); if (!empty($post_details) && !empty($feature_plan_details)) { if ($post_details['post_user_id'] == $user_id) { $paypal_data = $this->input->post(); $payment_reference_number = getUniquePaymentReferenceNumber(getEncryptedString($paypal_data['txn_id'])); $payment_created_on = date('Y-m-d H:i:s'); $data_array = array('payment_reference_number' => $payment_reference_number, 'payment_user_id' => $user_id, 'payment_pfm_id' => $feature_plan_details[0]['pfm_id'], 'payment_post_id' => $post_details['post_id'], 'payment_txn_id' => $paypal_data['txn_id'], 'payment_amount' => $paypal_data['payment_gross'], 'payment_payer_email' => $paypal_data['payer_email'], 'payment_receiver_email' => $paypal_data['receiver_email'], 'payment_status' => '1', 'payment_json' => json_encode($paypal_data), 'payment_created_on' => $payment_created_on); $is_exists = $model->fetchSelectedData('payment_id', TABLE_PAYMENTS, array('payment_post_id' => $post_details['post_id'], 'payment_txn_id' => $paypal_data['txn_id'])); if (empty($is_exists)) { $model->insertData(TABLE_PAYMENTS, $data_array); $this->session->set_flashdata('success', 'Payment successful'); } else { $this->session->set_flashdata('error', 'Transaction ID already exists'); redirect(getTripUrl($trip_url_key)); } // Adding post to featured table if ($this->add_post_to_featured($post_details['post_id'], $feature_plan_details[0]['pfm_id']) == FALSE) { $this->session->set_flashdata('error', 'Unauthorized access to post'); redirect(getTripUrl($trip_url_key)); } // Updating redis table here $redis_functions->set_trip_details($trip_url_key); $redis_functions->set_featured_trips(); // Sending invoice email here if (USER_IP != '127.0.0.1') { $invoice_data_array = array('payment_reference_number' => $payment_reference_number, 'payment_created_on' => $payment_created_on, 'payer_user_fullname' => $this->session->userdata['user_fullname'], 'payer_user_email' => $user_email, 'payment_txn_id' => $paypal_data['txn_id'], 'post_title' => $post_details['post_title'], 'pfm_title' => $feature_plan_details['pfm_title'], 'payment_currency' => 'USD', 'payment_amount' => $paypal_data['payment_gross']); $email_model = new Email_model(); $invoice_html_data = $email_model->invoice_template($invoice_data_array); $email_model->sendMail($user_email, $invoice_html_data['email_subject'], $invoice_html_data['email_message']); } $page_title = 'Payment confirmed'; $input_arr = array(base_url() => 'Home', '#' => $page_title); $breadcrumbs = get_breadcrumbs($input_arr); $data["post_details"] = $post_details; $data["feature_plan_details"] = $feature_plan_details[0]; $data["payment_reference_number"] = $payment_reference_number; $data["breadcrumbs"] = $breadcrumbs; $data["page_title"] = $page_title; $data['meta_title'] = $data["page_title"] . ' - ' . $this->redis_functions->get_site_setting('SITE_NAME'); $this->template->write_view("content", "pages/payments/paypal-success", $data); $this->template->render(); } else { $this->session->set_flashdata('error', 'Unauthorized access'); display_404_page(); } } else { $this->session->set_flashdata('error', 'No such records found'); display_404_page(); } } else { $this->session->set_flashdata('error', 'Invalid request'); display_404_page(); } } else { $this->session->set_flashdata('error', 'Invalid request'); display_404_page(); } } else { $this->session->set_flashdata('error', 'Invalid request'); display_404_page(); } }