| Server IP : 103.234.187.230 / Your IP : 216.73.216.216 Web Server : Apache System : Linux lserver42043-ind.megavelocity.net 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64 User : apache ( 48) 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/html/adeetie/application/controllers/ |
Upload File : |
<?php defined('BASEPATH') OR exit('No direct script access allowed');
class Fi extends CI_Controller {
function __construct() {
parent::__construct();
$this->load->library(array('ion_auth'));
$this->load->model('mbank');
$this->load->model('mfi');
$this->data['menu'] = $this->db->query('SELECT A.menu_name,A.id,A.menu_type,A.menu_external_link,A.menu_order,group_concat(B.page_slug ) as
page_slug, group_concat(B.page_name ORDER BY FIND_IN_SET(B.id,A.menu_related_pages)) as page_name FROM
'.TBL_MENU.' A left join '.TBL_PAGES.' B on FIND_IN_SET(B.id,A.menu_related_pages) WHERE A.status=1 AND (( A.menu_type=3 ) OR ( A.menu_type!=3 AND B.status=1 ) )
group by A.menu_name ORDER BY A.menu_order ASC ' )->result();
}
function register() {
$this->load->library('form_validation');
$this->form_validation->set_rules('company','Bank name','required|alpha_numeric_spaces');
$this->form_validation->set_rules('address','Address','required');
$this->form_validation->set_rules('name','Name','required|alpha_numeric_spaces');
$this->form_validation->set_rules('designation','Designation','required|alpha_numeric_spaces');
$this->form_validation->set_rules('branch_name','Branch Name','required');
$this->form_validation->set_rules('mobile_number','Mobile No','required|numeric');
$this->form_validation->set_rules('email','Email','required|valid_email');
$this->form_validation->set_rules('authorized_by','Authorized By','required');
$this->form_validation->set_rules('category','Category','required');
$this->form_validation->set_rules('inc_date','Incorporation Date','required');
$this->form_validation->set_rules('rbi_reg_date','Incorporation Date','required');
$this->form_validation->set_rules('financial_report','Last year Balance sheet','required');
$this->form_validation->set_rules('loan_sanction_financial','business_performance','required');
$this->form_validation->set_rules('loan_disbursed_financial','business_performance','required');
$this->form_validation->set_rules('consent','Consent','required');
if($this->form_validation->run() == FALSE) {
$this->data['csrf_token'] = md5(uniqid());
$this->session->set_userdata('csrftoken', $this->data['csrf_token']);
$this->data['page']='fi/register';
$this->_render_page(get_template(), $this->data);
} else {
if($this->session->userdata('csrftoken') != $this->input->post('csrf_token')) {
redirect('fi/register');
return ;
}
$email = strtolower($this->input->post('email'));
$password = $this->input->post('password');
$adata = [
'category' => $this->input->post('category'),
'authorized_by' => $this->input->post('authorized_by'),
'address' => $this->input->post('address'),
];
$filename = $this->_uploadimg();
if($filename['status'] == 'failed' ) {
return;
}
$adata['loan_sanction_financial'] = $this->input->post('loan_sanction_financial');
$adata['loan_disbursed_financial'] = $this->input->post('loan_disbursed_financial');
$adata['financial_report'] = $this->input->post('financial_report');
$adata['credit_report'] = $this->input->post('credit_report');
$adata['branch_name'] = $this->input->post('branch_name');
$adata['rbi_reg_date'] = $this->input->post('rbi_reg_date');
$adata['nbfc_category'] = $this->input->post('nbfc_category');
$adata['credit_rating'] = $this->input->post('credit_rating');
$adata['letter_link'] = 'static/letter/'.$filename['filename'];
$this->mfi->create_fi($adata);
}
}
function thanks() {
$data = [];
// $data['states'] = $this->mconsole->get_state();
$this->data['page']='fi/thanks';
$this->_render_page(get_template(), $this->data);
}
function upload() {
$config['upload_path'] = './static/fi/';
$config['allowed_types'] = 'pdf|PDF';
$config['max_size'] = '200000';
$this->load->library('upload', $config);
if (!$this->upload->do_upload()) {
return $this->output
->set_content_type('application/json')
->set_status_header(500)
->set_output(json_encode([
'message' => strip_tags($this->upload->display_errors())
]));
} else {
$data = $this->upload->data();
return $this->output
->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode([
'filename' => $data['file_name'],
'type' => 'danger'
]));
}
}
function _uploadimg() {
$config['upload_path'] = './static/letter/';
$config['allowed_types'] = 'pdf|PDF';
$config['max_size'] = '200000';
$this->load->library('upload', $config);
if (!$this->upload->do_upload()) {
return ['status' => 'failed', 'msg' => $this->upload->display_errors() ];
} else {
$data = $this->upload->data();
return [
'status' => 'success',
'filename' => $data['file_name'],
];
}
}
public function _render_page($view, $data=null, $returnhtml=false) {
$this->viewdata = (empty($data)) ? $this->data: $data;
$view_html = $this->load->view($view, $this->viewdata, $returnhtml);
if ($returnhtml) return $view_html;//This will return html on 3rd argument being true
}
}