| 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/khonguyenlieu.vn/public_html/site/controllers/ |
Upload File : |
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class lienhe extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->load->model('lienhe_model','lienhe');
}
function index()
{
if(isset($_POST['btnlienhe']))
{
$csrf = $this->input->post('csrf');
$ses_csrf = isset($_SESSION['ses_csrf']) ? $_SESSION['ses_csrf'] : '';
if($ses_csrf == $csrf)
{
$this->form_validation->set_rules('cusmail','Email','trim|required');
if($this->form_validation->run() == FALSE)
{
$this->pre_message = validation_errors();
}
else
{
if($this->lienhe->addContacts())
{
$this->load->helper('mail') ;
$subject = "Lien he tu Kho nguyen lieu" ;
$content = 'Liên hệ từ khonguyenlieu.vn. <a href="https://khonguyenlieu.vn/">Quản lý</a>';
sendmail("Kho nguyen lieu|khonguyenlieuvn@gmail.com", "","Nguyen Trieu Thang|tritigi@gmail.com", $subject, $content) ;
$this->session->set_flashdata('message','Lưu thành công');
redirect('thanh-cong.html');
}
else
{
$this->pre_message = 'Lưu không thành công';
}
}
}
}
$data['csrf'] = $_SESSION['ses_csrf'] = create_csrf();
$data['title'] = "Liên hệ" ;
$data['page'] = 'lienhe/index';
$this->load->view('html/skin_news', $data);
}
function contacts()
{
if(isset($_POST['btnlienhe']))
{
$csrf = $this->input->post('csrf');
$ses_csrf = isset($_SESSION['ses_csrf']) ? $_SESSION['ses_csrf'] : '';
if($ses_csrf == $csrf)
{
$this->form_validation->set_rules('cusmail','Email','trim|required');
if($this->form_validation->run() == FALSE)
{
$this->pre_message = validation_errors();
}
else
{
if($this->lienhe->addContacts())
{
$this->load->helper('mail') ;
$subject = "Lien he tu Kho nguyen lieu" ;
$content = 'Liên hệ từ khonguyenlieu.vn. <a href="https://khonguyenlieu.vn/">Quản lý</a>';
sendmail("Kho nguyen lieu|khonguyenlieuvn@gmail.com", "","Nguyen Trieu Thang|tritigi@gmail.com", $subject, $content) ;
$this->session->set_flashdata('message','Lưu thành công');
redirect('thanh-cong.html');
}
else
{
$this->pre_message = 'Lưu không thành công';
}
}
}
}
}
function thanhcong()
{
$data['title'] = "Liên hệ thành công" ;
$data['cont'] = "Gởi thông tin thành công" ;
$data['page'] = 'lienhe/thanhcong';
$this->load->view('html/skin_news', $data);
}
}
?>