whoami7 - Manager
:
/
proc
/
self
/
root
/
home
/
papecmvm
/
www
/
application
/
controllers
/
webapp
/
Upload File:
files >> //proc/self/root/home/papecmvm/www/application/controllers/webapp/Welcome.php
<?php use Aws\S3\S3Client; use Aws\S3\Exception\S3Exception; use Aws\CommandPool; if ( ! defined('BASEPATH')) exit('No direct script access allowed'); require_once APPPATH."third_party/aws/autoload.php"; class Welcome extends CI_Controller { function __construct() { parent::__construct(); $this->load->model('app', "model"); $CI = & get_instance(); $this->db = $CI->load->database('default', TRUE); $this->db2 = $CI->load->database('db2', TRUE); //aws $bucketname = 'paperpushbucket'; $key = 'AKIAJJ72VRLHXBD272YQ'; $secret = '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'; $this->s3 = S3Client::factory( array( 'credentials' => array( 'key' => $key, 'secret' => $secret ), 'version' => 'latest', 'region' => 'ap-south-1' ) ); } public function index(){ $ses = $this->session->get_userdata(); $userdata = $this->session->userdata('reg_info'); //echo "<pre>"; print_r($userdata); die; if(!isset($userdata)) { $base = base_url(); redirect($base); } $cur_year = date('Y'); $id = $ses['reg_info'][0]['rid']; $where = array('ato' => $id); $ses_data = $this->model->DetailData('tbl_access', $where); /*$where_cust = array('type' => 'customer'); $this->db2->order_by('rid', 'DESC'); $this->db2->limit(10); $data['cust'] = $this->db2->get_where('tbl_registration', $where_cust)->result_array(); echo "<pre>"; print_r($data['cust']); die;*/ /*if($_SESSION['reg_info'][0]['type'] == "team_leader"){ $rids = $this->getAssignedCustomerCheck($_SESSION['reg_info'][0]['rid']); $this->db2->select('r.*,i.name as leadername'); $this->db2->from('tbl_registration as r'); $this->db2->where("r.type" , "customer"); $this->db2->where_in("r.rid" , $rids); $this->db2->order_by('r.rid', 'DESC'); $this->db2->limit(10); $this->db2->join('tbl_assign_customer_teamleader as b', 'b.customer_id = r.rid', 'left'); $this->db2->join('tbl_registration as i', 'i.rid = b.leader_id', 'left'); $data['cust'] = $this->db2->get()->result_array(); //echo "<pre>"; print_r($data['cust']); die; }*/ $type = $ses['reg_info'][0]['type']; if($type == 'admin'){ /*$where_cust_new = array('type' => 'customer'); $this->db2->order_by('rid', 'DESC'); $this->db2->limit(10); $data['cust'] = $this->db2->get_where('tbl_registration', $where_cust_new)->result_array(); //echo "<pre>"; print_r($data['cust']); die;*/ $this->db2->select('r.*,i.name as leadername'); $this->db2->from('tbl_registration as r'); $this->db2->where('r.type', 'customer'); $this->db2->order_by('r.rid', 'DESC'); $this->db2->limit(10); $this->db2->join('tbl_assign_customer_teamleader as b', 'b.customer_id = r.rid', 'left'); $this->db2->join('tbl_registration as i', 'i.rid = b.leader_id', 'left'); $data['cust'] = $this->db2->get()->result_array(); //echo "<pre>"; print_r($data['cust']); die; $where_cust = array('type' => 'customer'); $data['c_count'] = $this->model->getDatamodelCountWhere('tbl_registration', $where_cust); $where_office = array('type' => 'office_user'); $data['of_count'] = $this->model->getDatamodelCountWhere('tbl_registration', $where_office); $where_tl = array('type' => 'team_leader'); $data['tl_count'] = $this->model->getDatamodelCountWhere('tbl_registration', $where_tl); $where_form = array('approve_status' => 'approved'); $data['c_forms'] = $this->model->getDatamodelCountWhere('tbl_form', $where_form); $data['uploads'] = $this->model->uploadNotiAdmin(); $this->load->view('webapp/dashbord', $data); }elseif ($type == 'team_leader') { $rids = $this->getAssignedCustomerCheck($_SESSION['reg_info'][0]['rid']); $this->db2->select('r.*,i.name as leadername'); $this->db2->from('tbl_registration as r'); $this->db2->where("r.type" , "customer"); $this->db2->where_in("r.rid" , $rids); $this->db2->order_by('r.rid', 'DESC'); $this->db2->limit(10); $this->db2->join('tbl_assign_customer_teamleader as b', 'b.customer_id = r.rid', 'left'); $this->db2->join('tbl_registration as i', 'i.rid = b.leader_id', 'left'); $data['cust'] = $this->db2->get()->result_array(); //echo "<pre>"; print_r($data['cust']); die; /*$where_cust = array('type' => 'customer'); $data['c_count'] = $this->model->getDatamodelCountWhere('tbl_registration', $where_cust);*/ $data['c_count'] = count($data['cust']); $where_office = array('type' => 'office_user'); $data['of_count'] = $this->model->getDatamodelCountWhere('tbl_registration', $where_office); $where_tl = array('type' => 'team_leader'); $data['tl_count'] = $this->model->getDatamodelCountWhere('tbl_registration', $where_tl); $where_form = array('approve_status' => 'approved'); $data['c_forms'] = $this->model->getDatamodelCountWhere('tbl_form', $where_form); $data['uploads'] = $this->model->uploadNotiAdmin(); $this->load->view('webapp/dashbord', $data); }elseif ($type == 'customer') { $code = $userdata[0]['folder_code']; $where_cust = array('code' => $code, 'year' => $cur_year); $data['struct'] = $this->db2->get_where('cust_upload_structure',$where_cust)->row_array(); $data['templates'] = $this->db2->get_where('cust_templates', array('ct_code'=>$code))->result_array(); //echo "<pre>"; print_r($data); die; $Rid = $ses['reg_info'][0]['rid']; $where = array('rid' => $Rid); $Checkdata = $this->model->DetailData('tbl_registration', $where); //echo "<pre>"; print_r($Checkdata); die; $country = $Checkdata[0]['country']; $gst = $Checkdata[0]['gst']; $pan = $Checkdata[0]['pan']; $cin_no = $Checkdata[0]['cin_no']; $tax_id = $Checkdata[0]['tax_id']; if($country == "India"){ if($gst == "" || $pan == "" || $cin_no == ""){ $this->session->set_flashdata('msg', ' <div class="alert alert-danger alert-dismissible" role="alert"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"> <span aria-hidden="true">×</span></button> <strong>Error!</strong> One of the information is missing in GST, PAN and CIN. </div>'); redirect('webapp/users/profile'); } }elseif($country == "Canada" || $country == "United States"){ if($tax_id == ""){ $this->session->set_flashdata('msg', ' <div class="alert alert-danger alert-dismissible" role="alert"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"> <span aria-hidden="true">×</span></button> <strong>Error!</strong> Please Fill TAX Id Number. </div>'); redirect('webapp/users/profile'); } } //die; $this->load->view('webapp/customer/dashbord', $data); }elseif ($type == 'office_user') { $where_oid = array('oid' => $id); $data['form_count'] = $this->model->getDatamodelCountWhere('tbl_form', $where_oid); $data['cust_upload'] = $this->model->custUploads2($id); $customer = $this->model->officeModel($id); $data['custCnt'] = count($customer); $this->load->view('webapp/office_user/dashbord', $data); } } public function getAssignedCustomerCheck($lid){ $this->db2->select("customer_id"); $this->db2->from("tbl_assign_customer_teamleader"); $this->db2->where("leader_id" , $lid ); $data = $this->db2->get()->result_array(); //echo "<pre>"; print_r($data); die; $temp = [] ; if(!empty($data)){ foreach($data as $k => $v){ $temp[] = $v['customer_id']; } }else{ $temp[] = ""; } return $temp ; } public function changeYear($myYear){ mkdir("./all_xml/".$myYear); $dirs = array_filter(glob('documents/*'), 'is_dir'); foreach ($dirs as $key => $value) { $exp = explode('/', $value); $user_folder = $exp[1]; $path = array_filter(glob('documents/'.$user_folder.'/*'), 'is_dir'); $path2 = 'documents/'.$user_folder.'/'.$myYear; if(!in_array($path2,$path)){ mkdir("./documents/".$user_folder."/".$myYear); $month = ['a_january', 'b_february', 'c_march', 'd_april', 'e_may', 'f_june', 'g_july', 'h_august', 'i_september', 'j_october', 'k_november', 'l_december']; foreach ($month as $value) { mkdir("./documents/".$user_folder."/".$myYear.'/'.$value); $entries = ['purchase', 'sales', 'payment', 'receipt', 'contra', 'journal', 'debit', 'credit', 'bank', 'cheque_reg', 'reports']; foreach ($entries as $ent) { mkdir("./documents/".$user_folder."/".$myYear.'/'.$value.'/'.$ent); $stage = ['recycle']; foreach ($stage as $st) { mkdir("./documents/".$user_folder."/".$myYear.'/'.$value.'/'.$ent.'/'.$st); } } } } } $data = array('year' => $myYear); $this->model->insertData('tbl_years', $data); $this->session->set_flashdata('msg', ' <div class="alert alert-success alert-dismissible" role="alert"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"> <span aria-hidden="true">×</span></button> <strong>Success!</strong> Folders has been created. </div>'); redirect('webapp/welcome'); } public function abort(){ $this->session->sess_destroy(); redirect(base_url("webapp/welcome")); } public function removeAll($rid){ $rid = $this->model->decryptdata($rid); $this->model->UpdateData('tbl_login_check', ['status' => 0 ], ['rid' => $rid]); $session_id = session_id(); $this->session->set_userdata('mysesion', $session_id ); $this->model->UpdateData('tbl_login_check', ['status' => 0 ], $where); $dataIns = array( 'rid' => $rid, 'session_id' => $session_id, 'status' => '1', ); $this->model->insertData('tbl_login_check', $dataIns); redirect("webapp/welcome"); } public function duplicate($rid){ $existingLoginData = $this->db2->get_where("tbl_login_check" , ['rid' => $rid , 'status' => 1 ])->result_array(); $data['existingLoginData'] = $existingLoginData ; $data['rid'] = $rid ; $this->load->view('webapp/duplicate', $data); } } /* End of file Welcome.php */
Copyright ©2021 || Defacer Indonesia