|
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 if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Contact extends Public_Controller {
function __construct() {
parent::__construct();
}
public function index() {
// 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'] = 'Contact';
$this->data_header['meta_description'] = 'Contact';
$this->data_header['meta_keywords'] = 'Contact';
$this->data_header['website_icon'] = 'Contact';
$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->load->view('template/header', $this->data_header);
$this->load->view('contact',$this->data);
$this->load->view('template/footer', $this->data_footer);
}
public function submit_message() {
if(!$_POST['name']) {
redirect('welcome');
}
$name=$this->input->post('name');
$email=$this->input->post('email');
$phone=$this->input->post('phone');
$subject=$this->input->post('subject');
$message=$this->input->post('message');
$this->load->model('configuration_m');
$myMessage = '<html><body>';
$myMessage = '<p>Hello PTBos Admin. You have received customer inquiry.</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>Subject : </strong> </td><td>" . $subject . "</td></tr>";
$myMessage .= "<tr><td><strong>Message : </strong> </td><td>" . $message . "</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('Website Visitor Inquiry');
$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');
}
}