|
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/ptbos.biz/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->db->select('website_default_language')->from('configuration');
$language=$this->db->get()->row()->website_default_language;
if ($language=='english') {
$this->session->set_userdata('lang','english');
} else {
$this->session->set_userdata('lang','indonesian');
}
}
public function index() {
//SEO browser title and meta details homepage
$this->db->select('browser_title, meta_description, meta_keywords, website_icon')->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;
$this->data_header['website_icon'] = $website_name->website_icon;
//POPUP ACTIVE STATE
$this->db->select('popup_active')->from('home_centerbanners')->where('id_home_centerbanners', 1);
$this->data['popup_active'] = $this->db->get()->row()->popup_active;
//LOAD LANGUAGE FILES FOR HOMEPAGE & BLOG
if($this->session->userdata('site_lang') == 'english') {
$this->lang->load('homepage', 'english');
} else {
$this->lang->load('homepage', 'indonesian');
}
//LOAD LANGUAGE FILES FOR HOMEPAGE & BLOG
if($this->session->userdata('site_lang') == 'english') {
$this->lang->load('contact', 'english');
} else {
$this->lang->load('contact', 'indonesian');
}
$this->db->select('*');
$this->db->from('configuration');
$data['config'] = $this->db->get()->result();
foreach ($data['config'] as $item) {
$this->data_header['image'] = $item->logo;
$this->data_header['icon'] = $item->website_icon;
$this->data['fax'] = $item->fax;
$this->data['hp'] = $item->hp;
$this->data['company_address'] = $item->company_address;
$this->data_footer['twitter']= $item->twitter;
$this->data_header['instagram']= $item->instagram;
$this->data_header['facebook']= $item->facebook;
$this->data_footer['website_name']= $item->website_name;
}
$this->db->select('*')->from('home_centerbanners');
$this->data['home_centerbanners']=$this->db->get()->result();
$this->db->select('*')->from('home_slideshow')->where('status',1)->where('slideshow_type','homepage');
$this->data['slideshows']=$this->db->get()->result();
$this->db->select('*')->from('categories')->where('status', '1')->order_by('priority', 'ASC');
$this->data['services'] = $this->db->get()->result();
//LOAD VIEW
$this->load->view('template/header', $this->data_header);
$this->load->view('welcome', $this->data);
$this->load->view('template/footer', $this->data_footer);
}
public function request_quote() {
if(!$_POST['name']) {
redirect('welcome');
}
$name=$this->input->post('name');
$service=$this->input->post('freight');
$email=$this->input->post('email');
$phone=$this->input->post('phone');
$this->load->model('configuration_m');
$myMessage = '<html><body>';
$myMessage = '<p>Hello PTBos Admin. You have receive request for quote.</p>';
$myMessage .= '<table style="border-color: #666;" cellpadding="10">';
$myMessage .= "<tr><td><strong>Name : </strong> </td><td>" . $name . "</td></tr>";
$myMessage .= "<tr><td><strong>Email : </strong> </td><td>" . $email . "</td></tr>";
$myMessage .= "<tr><td><strong>Phone : </strong> </td><td>" . $phone . "</td></tr>";
$myMessage .= "<tr><td><strong>Service : </strong> </td><td>" . $service . "</td></tr>";
$myMessage .= "</table>";
$myMessage .= "<p>Thanks.</p>";
$myMessage .= "</body></html>";
// send email
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.gmail.com';
$config['smtp_port'] = '465';
$config['smtp_user'] = 'webmasterptbos@gmail.com';
$config['smtp_pass'] = '7quA34=*';
$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->load->library('email');
$this->email->initialize($config);
$this->email->from('noreply@ptbos.biz', 'PTBOS Website');
$this->email->to('management@ptbos.biz');
$this->email->subject('Request for quote');
$this->email->message($myMessage);
$email_sent_status = $this->email->send();
if(!$email_sent_status) {
echo $this->email->print_debugger();
}
$this->session->set_flashdata('success', '<br><p style="background:green; color:white; padding:5px; font-weight:bold;">Email sent. Thank you. We will contact You as soon as possible</p>');
redirect('contact');
}
}