|
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 : /proc/self/root/var/www/symphony-solusi.co.id/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'] = $website_name->website_icon;
$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 thankyou()
{
// 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'] = $website_name->website_icon;
$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-thankyou', $this->data);
$this->load->view('template/footer', $this->data_footer);
}
public function submit_message()
{
//test if ajax call to prevent direct access
if (!$this->input->is_ajax_request()) {
exit('No direct script access allowed');
}
$name = $this->input->post('name');
$email = $this->input->post('email');
$message = $this->input->post('message');
//get website data
$this->db->select('logo, from_email, website_name, email_smtp_host, email_smtp_port, email_smtp_password, email_smtp')->from('configuration')->where('id_configuration', 1);
$website_data = $this->db->get()->row();
$data['logo'] = $website_data->logo;
$data['website_name'] = $website_data->website_name;
$this->load->model('configuration_m');
$data['emails'] = $this->configuration_m->get_emails();
$data['bank'] = $this->configuration_m->get_bank();
$data['title'] = 'Contact Us';
$myMessage = '<html><body>';
$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>Message : </strong> </td><td>" . $message . "</td></tr>";
$myMessage .= "</table>";
$myMessage .= "<p>Thanks.</p>";
$myMessage .= "</body></html>";
// send email
$email_data['email'] = $data['emails']->from_email;
// $email_data['customer_email'] = 'bakrisea@gmail.com';
$email_data['subject'] = 'Business Enquiry';
$this->send_email($myMessage, $email_data, true);
// var_dump($this->email->print_debugger()); exit();
// end email
$data = 'test';
echo json_encode($data);
}
public function sendemail()
{
if (!$_POST) {
redirect(base_url());
}
$data_email = array();
$nama_lengkap = $this->input->post('nama');
$email = $this->input->post('email');
$phone = $this->input->post('telepon');
$message = $this->input->post('pesan');
$data_email['nama_lengkap'] = $nama_lengkap;
$data_email['email'] = $email;
$data_email['phone'] = $phone;
$data_email['message'] = $message;
$website_data = $this->db->select('logo, website_name')->from('configuration')->where('id_configuration', 1)->get()->row();
$data_email['website_name'] = $website_data->website_name;
$data_email['logo'] = $website_data->logo;
$this->load->library('email');
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.gmail.com';
$config['smtp_port'] = '465';
$config['smtp_user'] = 'firstglass.id@gmail.com';
$config['smtp_pass'] = 'Webmasterfirstglass';
$config['mailtype'] = 'html';
// $config['smtp_crypto'] = 'ssl';
$config['charset'] = 'iso-8859-1';
// $config['charset'] = 'UTF-8';
$config['wordwrap'] = TRUE;
$config['newline'] = "\r\n"; //use double quotes to comply with RFC 822 standard
$this->email->set_crlf("\r\n"); //must add this for hotmail
$this->email->initialize($config);
$this->email->from('noreply', $website_data->website_name);
$this->email->to('project@firstglass.id');
$this->email->subject('Website Visitor Inquiry');
$myMessage = $this->load->view('email/send_faq_admin.php', $data_email, true);
$this->email->message($myMessage);
$respon_email = $this->email->send();
if (!$respon_email) {
var_dump($this->email->print_debugger());
exit();
}
$this->session->set_flashdata('success', '<p style="background:#2a5d33; color:white; padding:15px;font-size:20px; width:100%; text-align:center; margin-bottom:30px; margin-top:30px;">Your message was sent successfully!</p>');
redirect(base_url('contact'));
}
}