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 : /var/www/kanvakanva.com/public_html/application/controllers/ |
Upload File : |
<?php defined('BASEPATH') or exit('No direct script access allowed'); class Welcome extends Public_Controller { public function __construct() { parent::__construct(); $this->load->model('configuration_m'); } public function index() { // $this->session->set_userdata('already_subscribe', 'no'); //SEO get browser title and meta details $this->db ->select('browser_title, meta_description, meta_keywords') ->from('configuration') ->where('id_configuration', 1); $website_name = $this->db->get()->row(); $this->data_header['browser_title'] = $website_name->browser_title; $this->data_header['meta_description'] = $website_name->meta_description; $this->data_header['meta_keywords'] = $website_name->meta_keywords; //get home slideshow $this->db ->select('*') ->from('home_slideshow') ->where('status', '1') ->order_by('priority', 'ASC'); $data['home_slideshow'] = $this->db->get()->result(); //get home static center banners $this->db ->select('*') ->from('home_centerbanners') ->where('id_home_centerbanners', 1); $data['home_staticbanners'] = $this->db->get()->row(); //get welcome message $this->db ->select('home_welcome') ->from('configuration') ->where('id_configuration', 1); $data['welcome_message'] = $this->db->get()->row()->home_welcome; //get new products $this->db ->select('*') ->from('products') ->where('new_arrival', 'yes') ->where('product_status', '1') ->order_by('created_at', 'DESC') ->limit(12); $data['new_products'] = $this->db->get()->result(); //get products sale $this->db ->select('*') ->from('products a') ->where('a.new_sale', 'yes') ->where('discount_price > 0') ->order_by('a.id_products', 'DESC') ->limit(1); $data['sale_product'] = $this->db->get(); //get promo $this->db->select('*') ->from('promotion') ->where('id_promotion', '1'); $data['promo'] = $this->db->get()->row(); //get best sale product $this->db ->select('*') ->from('products') ->where('product_status', '1') ->where("id_products in ( SELECT item_id FROM ( SELECT a.item_id FROM orders_detail a LEFT JOIN orders b on a.orders_id=b.id_orders WHERE b.order_date >= NOW() - INTERVAL 3 MONTH GROUP BY a.item_id ORDER BY count(a.id_orders_detail) DESC LIMIT 12 )z )") ->order_by('created_at', 'DESC'); $data['best_sale'] = $this->db->get()->result(); //get blog $this->db->select('*') ->from('blog') ->order_by('publish_date', 'DESC') ->limit(10); $data['blogs'] = $this->db->get()->result(); //get testimonials $this->db ->select('*') ->from('testimonies') ->where('status', 'active') ->order_by('ordering', 'ASC') ->limit(20); $data['testimonies'] = $this->db->get()->result(); $this->db ->select('*') ->from('popup') ->where('id_popup', 1); $data['popup_voucher'] = $this->db->get()->row(); $this->load->view('template/header', $this->data_header); $this->load->view('welcome', $data); $this->load->view('template/footer', $this->data_footer); } function submit() { $this->load->helper('form'); $this->load->library('form_validation'); //set validation rule $this->form_validation->set_rules( 'email', 'Email', 'trim|required|valid_email' ); if ($this->form_validation->run() == false) { echo validation_errors(); } else { $email = $this->input->post('email'); $this->db->where('email', $email); $query = $this->db->get('popup_subscription'); $count_row = $query->num_rows(); $data = [ 'email' => $email, ]; if ($count_row == 0) { $this->db->insert('popup_subscription', $data); } $this->session->set_userdata('already_subscribe', 'yes'); } redirect("welcome/index"); } public function get_csrf() { $data['csrf_token'] = $this->security->get_csrf_hash(); echo json_encode($data); die(); } function tes_mail(){ //get website data $this->db->select('logo, from_email, website_name, email_smtp_host, email_smtp_port, email_smtp_password, email_smtp, bank')->from('configuration')->where('id_configuration', 1); $website_data = $this->db->get()->row(); $data['logo'] = $website_data->logo; $data['website_name'] = $website_data->website_name; $data['bank'] = $website_data->bank; $data['emails'] = $this->configuration_m->get_emails(); $data['title'] = 'Payment Reminder'; $this->load->library('email'); //get email setting $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['charset'] = 'iso-8859-1'; $config['wordwrap'] = TRUE; $config['newline'] = "\r\n"; //use double quotes to comply with RFC 822 standard $this->email->initialize($config); $this->email->from($data['emails']->from_email, $data['emails']->website_name); $this->email->to('ahmadmuflih1@gmail.com'); $this->email->subject('Payment Reminder'); $email = 'hallo'; $this->email->message($email); $r = $this->email->send(); if (!$r) echo $this->email->print_debugger(); ; //----end send email } }