| Server IP : 103.48.194.25 / Your IP : 216.73.216.74 Web Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.33 System : Linux VMHostDefault 3.10.0-1160.42.2.el7.x86_64 #1 SMP Tue Sep 7 14:49:57 UTC 2021 x86_64 User : sieuthimay ( 1016) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/hocthongminh.net-bk/public_html/site/components/lienhe/controllers/ |
Upload File : |
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Lienhe extends MX_Controller
{
function __construct()
{
parent::__construct();
$this->load->model('lienhe_model','lienhe');
}
function index()
{
if(isset($_POST['bt_submit']))
{
$csrf = $this->input->post('csrf');
$ses_csrf = isset($_SESSION['ses_csrf']) ? $_SESSION['ses_csrf'] : '';
if($ses_csrf == $csrf)
{
$this->form_validation->set_rules('lb_cusname','Họ tên','trim|required');
$this->form_validation->set_rules('nb_phone','Điện thoại','trim|required');
if($this->form_validation->run() == FALSE)
{
$this->pre_message = validation_errors();
}
else
{
$req = $this->build_data();
if($this->lienhe->save($req))
{
//send mail to admin
$subject = "Khach lien he huynhgiatrading.com";
$content = $this->load->view("mail_contact", $req, true);
$this->load->helper('mail') ;
sendmail("Huynhgia Trading|info@huynhgiatrading.com", "","Trieu Thang|tritigi@gmail.com", $subject, $content) ;
$this->session->set_flashdata('message','Lưu thành công');
redirect('lien-he-thanh-cong');
}
else
{
$this->pre_message = 'Lưu không thành công';
}
}
}
else
{
}
}
$data['csrf'] = $_SESSION['ses_csrf'] = create_csrf();
$data['title'] = "Liên hệ" ;
$data['page'] = 'index';
$this->load->view("skin", $data);
}
private function build_data($flag=0)
{
$req["lb_cusname"] = $this->input->post("lb_cusname");
$req["lb_address"] = $this->input->post("lb_address");
$req["nb_phone"] = $this->input->post("nb_phone");
$req["lb_cusmail"] = $this->input->post("lb_cusmail");
$req["lb_content"] = $this->input->post("lb_content");
$req["dt_create"] = date('Y-m-d H:i:s');
$req["bl_active"] = 0;
return $req;
}
function thanhcong()
{
$data['title'] = "Liên hệ thành công" ;
$data['cont'] = "Gởi thông tin thành công" ;
$data['page'] = 'thanhcong';
$this->load->view("skin", $data);
}
}
?>