whoami7 - Manager
:
/
proc
/
self
/
root
/
home
/
papecmvm
/
www
/
application
/
controllers
/
webapp
/
Upload File:
files >> //proc/self/root/home/papecmvm/www/application/controllers/webapp/Users.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 Users 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 registration() { //echo "<pre>"; print_r($_POST); die; //echo "hi"; die; $country = explode('_', $this->input->post('country')); $country = $country[1]; $code=$this->input->post('code'); $rcode=$this->input->post('rcode'); $pass=$this->input->post('pass'); $repass=$this->input->post('repass'); $current_url=$this->input->post('current_url'); $year = date('Y'); $email = $this->input->post('email'); $username = $this->input->post('username'); $where_username = array('username' => $username); $query = $this->model->DetailData('tbl_registration', $where_username); $cnt = count($query); //$cnt = 0; if($cnt == 0){ if($code==$rcode){ if($pass == $repass){ if($this->input->post('name') != '' && $this->input->post('email') != '' && $this->input->post('mobile') != '' && $this->input->post('address') != '' && $pass != '' && $code != ''){ $name = $this->input->post('name'); $mobile = $this->input->post('mobile'); $arr = explode(' ',trim($name)); $new_name = $arr[0]; $random_number = mt_rand(1000, 9999); $user_code = $random_number.'_'.$new_name; $where_code = array('folder_code' => $user_code); $chk_folder = $this->model->DetailData('tbl_registration', $where_code); $otp = mt_rand(100000, 999999); $password = md5($pass); $date_incorporation = date("Y-m-d", strtotime($this->input->post('date_incorporation'))); $insertdata=array('pass'=>$password, 'name'=>$this->input->post('name'), 'phone_code'=>$this->input->post('phone_code'), 'email'=>$this->input->post('email'), 'username'=>$this->input->post('username'), 'country'=>$country, 'mobile'=>$this->input->post('mobile'), 'address'=>$this->input->post('address'), /*'constitution'=>$this->input->post('constitution'), 'date_incorporation'=>$date_incorporation, 'nob'=>$this->input->post('nob'), 'ur'=>$this->input->post('ur'), 'ri'=>$this->input->post('ri'), 'gst'=>$this->input->post('gst'), 'pan'=>$this->input->post('pan'), 'country'=>$country, 'state'=>$this->input->post('state'),*/ 'folder_code'=>$user_code, 'type'=>'customer', 'reg_from'=>'web', 'otp'=>$otp ); $last_insid = $this->model->insertData('tbl_registration',$insertdata); //make struct $entries = ['purchase_invoices', 'sales_invoices', 'cash_payment', 'cash_receipt', 'cheque_paid', 'expense_vouchers', 'debit_notes', 'credit_notes', 'bank_statements', 'cheque_deposited', 'reports', 'others']; $json_entry = json_encode($entries); $ins_struct = array( 'code'=>$user_code, 'year'=>$year, 'stage'=>$json_entry, ); $this->model->insertData('cust_upload_structure',$ins_struct); //make struct //echo "<pre>"; print_r($last_insid); //echo $insert_id = $this->db2->insert_id(); die; //$last_insid = 2; $enc_id = $this->model->encryptdata($last_insid); $enc_otp = $this->model->encryptdata($otp); $url = base_url()."webapp/users/auth/".$enc_id."/".$enc_otp; $to = $this->input->post('email'); //$to='vishal.panara@staroneweb.co.in'; $msg = ' <!DOCTYPE html> <html> <head> <title>Authentication</title> </head> <body style="font-family: sans-serif;"> <div class="container" style="width:50%; margin: 0 auto; background-color: #eee; box-shadow: 1px 1px 1px 1px #a09191; margin-top: 5rem; margin-bottom: 5rem;"> <div style="color:#fff; background-image: linear-gradient(-20deg, #CF212A 0%, #003865 100%); padding: 10px; text-align: center;"> <h3>Welcome to Paperpush</h3> </div> <div style="padding: 1rem;"> <p><strong>Dear User,</strong></p> <p><strong>Thank you for registering with PaperPush. Please click on verfication link to verify your email address.</strong></p> <p><strong>Verfication link:</strong> <a href="'.$url.'">'.$url.'</a></p> <p><strong>Your Username:</strong> "'.$username.'"</p> <p><strong>Your Password:</strong> "'.$pass.'"</p> </div> </div> Regards,<br> Team PaperPush. <p>Note: Please do not reply of this email. This is system generated email. </p> </body> </html>'; $sub = "Authentication"; $this->model->emailsend($to, $sub, $msg); //======================================================= $msg_admin = ' <!DOCTYPE html> <html> <head> <title>New user registation</title> </head> <body style="font-family: sans-serif;"> <div class="container" style="width:50%; margin: 0 auto; background-color: #eee; box-shadow: 1px 1px 1px 1px #a09191; margin-top: 5rem; margin-bottom: 5rem;"> <div style="color:#fff; background-image: linear-gradient(-20deg, #CF212A 0%, #003865 100%); padding: 10px; text-align: center;"> <h3>New user registation</h3> </div> <div style="padding: 1rem;"> <p><strong>Hello,</strong></p> <p><strong>New account has been registered. You can activate the account from Admin Panel after received payment authentication.</strong></p> <p><strong>Registration Details:</strong></p> <p><strong>Name:</strong> "'.$name.'"</p> <p><strong>Email:</strong> "'.$email.'"</p> <p><strong>Phone:</strong> "'.$mobile.'"</p> </div> </div> </body> </html>'; $to_admin='cjrajpara@gmail.com'; //anil.patel@staroneweb.co.in $sub_admin = "New user registation"; $this->model->emailsend_reg($to_admin, $sub_admin, $msg_admin); $bucketname = 'paperpushbucket'; $this->s3->putObject( [ 'Bucket' => $bucketname, 'Key' => $user_code."/", 'Key' => $user_code."/".$year."/", 'Key' => $user_code."/Templates/", 'Body' => "", 'ACL' => 'public-read' ], ); //$sdr = md5($six_digit_random_number); //$sdr = password_hash($six_digit_random_number, PASSWORD_BCRYPT); //$authcode['auth'] = $sdr; //$this->load->view('Web/auth'); $j_array['msg'] = '<p style="text-align:center!important;"><strong style="color: #c82333; text-align:center!important;">Thank you for registering with PaperPush. Please check your email to verify your account. If you don't see email in your INBOX please check in SPAM BOX.</strong></p>'; $j_array['year'] = $year; $j_array['code'] = $user_code; echo json_encode($j_array); //$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> Thankyou for Registration. </div>'); }else{ $j_array['msg'] = 'sum'; echo json_encode($j_array); } }else{ //$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> Password and Re-Password should be match. </div>'); /* echo ' <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> <h3 class="text-danger">Password and Re-Password should be match.</h3>'; */ $j_array['msg'] = 'pass'; echo json_encode($j_array); } }else{ //$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 enter the valid sum. </div>'); // echo ' // <button type="button" class="close" data-dismiss="modal" aria-label="Close"> // <span aria-hidden="true">×</span> // </button> // <h3 class="text-danger">Please enter the valid sum.</h3>'; $j_array['msg'] = 'sum'; echo json_encode($j_array); } }else{ //$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> Email ID is already available. </div>'); /* echo ' <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> <h3 class="text-danger">Sorry, Email ID is already available.</h3>'; */ $j_array['msg'] = 'username'; echo json_encode($j_array); } //redirect($current_url); } public function makeStructure(){ $user_code = $this->input->post('code'); $year = $this->input->post('year'); $bucketname = 'paperpushbucket'; //$this->s3->putObject(['Bucket' => $bucketname, 'Key' => $user_code."/".$year."/", 'Body' => "", 'ACL' => 'public-read']); $month = ['a_april', 'b_may', 'c_june', 'd_july', 'e_august', 'f_september', 'g_october', 'h_november', 'i_december', 'j_january', 'k_february', 'l_march']; foreach ($month as $value) { $this->s3->putObject(['Bucket' => $bucketname, 'Key' => $user_code."/".$year."/".$value."/", 'Body' => "", 'ACL' => 'public-read']); $entries = ['purchase_invoices', 'sales_invoices', 'cash_payment', 'cash_receipt', 'cheque_paid', 'expense_vouchers', 'debit_notes', 'credit_notes', 'bank_statements', 'cheque_deposited', 'reports', 'others']; foreach ($entries as $ent) { $this->s3->putObject(['Bucket' => $bucketname, 'Key' => $user_code."/".$year."/".$value."/".$ent."/", 'Body' => "", 'ACL' => 'public-read']); //$this->s3->putObject(['Bucket' => $bucketname, 'Key' => $user_code."/".$year."/".$value."/".$ent."/completed/", 'Body' => "", 'ACL' => 'public-read']); //$this->s3->putObject(['Bucket' => $bucketname, 'Key' => $user_code."/".$year."/".$value."/".$ent."/rejected/", 'Body' => "", 'ACL' => 'public-read']); } } $array['status'] = 'success'; echo json_encode($array); } public function makeStructure_cust(){ $user_code = $this->input->post('code'); $year = $this->input->post('year'); $this->db2->select('*'); $this->db2->from('cust_upload_structure'); $this->db2->where('code', $user_code); $this->db2->order_by('year', 'DESC'); $get = $this->db2->get()->row_array(); $entries = json_decode($get['stage'], TRUE); $bucketname = 'paperpushbucket'; //$this->s3->putObject(['Bucket' => $bucketname, 'Key' => $user_code."/".$year."/", 'Body' => "", 'ACL' => 'public-read']); $month = ['a_april', 'b_may', 'c_june', 'd_july', 'e_august', 'f_september', 'g_october', 'h_november', 'i_december', 'j_january', 'k_february', 'l_march']; foreach ($month as $value) { $this->s3->putObject(['Bucket' => $bucketname, 'Key' => $user_code."/".$year."/".$value."/", 'Body' => "", 'ACL' => 'public-read']); //$entries = ['purchase_invoices', 'sales_invoices', 'cash_payment', 'cash_receipt', 'cheque_paid', 'expense_vouchers', 'debit_notes', 'credit_notes', 'bank_statements', 'cheque_deposited', 'reports', 'others']; foreach ($entries as $ent) { $this->s3->putObject(['Bucket' => $bucketname, 'Key' => $user_code."/".$year."/".$value."/".$ent."/", 'Body' => "", 'ACL' => 'public-read']); //$this->s3->putObject(['Bucket' => $bucketname, 'Key' => $user_code."/".$year."/".$value."/".$ent."/completed/", 'Body' => "", 'ACL' => 'public-read']); //$this->s3->putObject(['Bucket' => $bucketname, 'Key' => $user_code."/".$year."/".$value."/".$ent."/rejected/", 'Body' => "", 'ACL' => 'public-read']); } } $json_entry = json_encode($entries); $ins_struct = array( 'code'=>$user_code, 'year'=>$year, 'stage'=>$json_entry, ); $this->model->insertData('cust_upload_structure',$ins_struct); $array['status'] = 'success'; echo json_encode($array); } public function check_login(){ $code=$this->input->post('code'); $rcode=$this->input->post('rcode'); $current_url=$this->input->post('current_url'); if($code==$rcode){ $pass=md5($this->input->post("pass")); $this->db2 ->where("username", $this->input->post("username")); $this->db2->where("pass",$pass); $this->db2->where("status", '1'); //$this->db2->where("payment_status", '1'); $query=$this->db2->get("tbl_registration"); $logindata=$query->result_array(); //echo "<pre>"; print_r($logindata); die; if($query->num_rows() == 1){ $rid = $logindata[0]['rid']; $type = $logindata[0]['type']; $payment_status = $logindata[0]['payment_status']; if($type != 'customer' && $type != 'admin'){ if($_SERVER['REMOTE_ADDR'] != '122.170.114.66'){ $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> Your IP Address is Blocked. </div>'); redirect($current_url); } } if($type == 'customer'){ if($payment_status == 0){ $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> Your payment is pending. </div>'); redirect($current_url); } } $current_time = date('Y-m-d H-:i:s'); $data = array('last_activity' => $current_time,'login_status' => "yes",); $where = array('rid' => $rid); $this->model->UpdateData('tbl_registration', $data, $where); $this->session->set_userdata('reg_info', $logindata); // start check duplicate login $rid = $logindata[0]['rid']; $encrypted_id = $this->model->encryptdata($rid); $existingrows = $this->db2->get_where("tbl_login_check" , ['rid' => $rid , 'status' => 1 ])->num_rows(); $session_id = session_id(); if($existingrows > 0){ // is login $customurl = base_url("webcontroller/index?duplicate=yes&rid=$encrypted_id"); redirect($customurl) ; }else{ // nothinng $dataIns = array( 'rid' => $rid, 'session_id' => $session_id, 'status' => '1', ); $this->model->insertData('tbl_login_check', $dataIns); redirect("webapp/welcome"); } // end check duplicate login }else{ $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> Wrong username or Password OR email not verified. </div>'); redirect($current_url); } }else{ $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 enter the valid sum. </div>'); redirect($current_url); } } public function auth($enc_id, $enc_otp){ $id = $this->model->decryptdata($enc_id); $otp = $this->model->decryptdata($enc_otp); $where = array('rid' => $id); $regData = $this->model->DetailData('tbl_registration', $where); $reg_otp = $regData[0]['otp']; if($otp != $reg_otp){ $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>Oopps!</strong> Something went wrong. </div>'); }else{ $data = array('status'=>'1', 'otp'=>'0'); $this->model->UpdateData('tbl_registration', $data, $where); $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> Thank you for veryfing your account. You will receive account activation email from PaperPush shortly! </div>'); } $base = base_url(); redirect($base); } public function logout(){ $userdata = $this->session->userdata('reg_info'); $rid = $userdata[0]['rid']; $current_time = date('Y-m-d H-:i:s'); $data = array('last_activity' => $current_time,'login_status' => "no",); $where = array('rid' => $rid); $this->model->UpdateData('tbl_registration', $data, $where); $dataUpa = array( 'status' => "0", ); $where = array('rid' => $rid, 'status' => '1',); $this->model->UpdateData('tbl_login_check', $dataUpa, $where); $this->session->unset_userdata('reg_info'); $this->session->userdata('reg_info'); $this->session->unset_userdata('mysession'); $base = base_url(); redirect($base); } public function access_two(){ $folder = implode('|', $this->input->post('folder')); $posted_fol = $this->input->post('folder'); $wise = $this->input->post('wise'); $hid = $this->input->post('hid'); $ato = $this->input->post('to'); $ato_cnt = count($ato); //echo $hid; die; $where = array('afrom'=>$hid); $check = $this->model->DetailData('tbl_access', $where); //echo "<pre>"; print_r($check); die; if(!empty($check)){ for ($i=0; $i < $ato_cnt; $i++) { //echo $ato[$i]; die; $where_ato = array('afrom'=>$hid, 'ato'=>$ato[$i]); $check_ato = $this->model->DetailData('tbl_access', $where_ato); //echo "<pre>"; print_r($check_ato); die; if(!empty($check_ato)){ $where = array('afrom'=>$hid, 'ato'=>$ato[$i]); $upd = array('folder'=> $folder, 'wise' => $wise); $this->model->UpdateData('tbl_access', $upd, $where); }else{ $insertdata=array( 'afrom'=>$hid, 'ato'=>$ato[$i], 'folder'=>$folder, 'wise'=>$wise ); $this->model->insertData('tbl_access', $insertdata); } //for notifications $ins=array( 'afrom'=>$hid, 'ato'=>$ato[$i], 'banned'=>'', 'given'=>$folder, 'status'=>'unseen' ); $this->model->insertData('tbl_access_notification',$ins); } //for }else{ for ($i=0; $i < $ato_cnt; $i++) { $insertdata=array( 'afrom'=>$hid, 'ato'=>$ato[$i], 'folder'=>$folder, 'wise'=>$wise ); $this->model->insertData('tbl_access', $insertdata); //for notifications $ins=array( 'afrom'=>$hid, 'ato'=>$ato[$i], 'banned'=>'', 'given'=>$folder, 'status'=>'unseen' ); $this->model->insertData('tbl_access_notification',$ins); } //for } $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> Access has been given. </div>'); $id = $this->model->encryptdata($hid); redirect('webapp/people/view/'.$id); } //access_two public function access(){ $folder = implode('|', $this->input->post('folder')); $posted_fol = $this->input->post('folder'); $hid = $this->input->post('hid'); $ato = $this->input->post('to'); $where = array('afrom'=>$hid); $check = $this->model->DetailData('tbl_access', $where); if(!empty($check)){ //$avail_fol = $check[0]['folder']; //$ex_avail_fol = explode('|', $avail_fol); foreach ($check as $key => $value) { $avail_fol = $value['folder']; $avail_ato = $value['ato']; $ex_avail_fol = explode('|', $avail_fol); for ($i=0; $i < count($posted_fol) ; $i++) { $pf = $posted_fol[$i]; if(in_array($pf,$ex_avail_fol)){ //echo $pf."available"."<br>"; $where3 = array('afrom'=>$hid, 'ato'=>$avail_ato); //$check3 = $this->model->DetailData('tbl_access', $where3); //$get_fol = explode('|', $check3[0]['folder']); if (($key2 = array_search($pf, $ex_avail_fol)) !== false) { $ins4=array( 'afrom'=>$hid, 'ato'=>$avail_ato, 'banned'=>$ex_avail_fol[$key2], 'given'=>'', 'status'=>'unseen' ); unset($ex_avail_fol[$key2]); $this->model->insertData('tbl_access_notification',$ins4); } $imp_get_all = implode('|', $ex_avail_fol); $upd2 = array('folder'=> $imp_get_all); $this->model->UpdateData('tbl_access', $upd2, $where3); //echo "banned ",$folder."<br>"; /*$ins1=array( 'afrom'=>$hid, 'ato'=>$avail_ato, 'banned'=>$folder, 'given'=>'', 'status'=>'unseen' ); $this->model->UpdateData('tbl_access_notification',$ins1,$where3);*/ //echo "<pre>"; print_r($imp_get_all); } } } } //die; $where2 = array('afrom'=>$hid, 'ato'=>$ato); $check2 = $this->model->DetailData('tbl_access', $where2); if(!empty($check2)){ //echo "available"; $avail_fol2 = $check2[0]['folder']; $ex_avail_fol2 = explode('|', $avail_fol2); $merge = array_merge($posted_fol, $ex_avail_fol2); $imp_mrg = implode('|', $merge); $upd = array('folder'=> $imp_mrg); $this->model->UpdateData('tbl_access', $upd, $where2); //echo "<pre>"; print_r($imp_mrg); //echo "all ".$imp_mrg."<br>"; $ins2=array( 'afrom'=>$hid, 'ato'=>$ato, 'banned'=>'', 'given'=>$imp_mrg, 'status'=>'unseen' ); $this->model->insertData('tbl_access_notification',$ins2); }else{ $insertdata=array( 'afrom'=>$hid, 'ato'=>$ato, 'folder'=>$folder ); $last_insid = $this->model->insertData('tbl_access',$insertdata); //echo "only insert ".$folder."<br>"; $ins3=array( 'afrom'=>$hid, 'ato'=>$ato, 'banned'=>'', 'given'=>$folder, 'status'=>'unseen' ); $this->model->insertData('tbl_access_notification',$ins3); } $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> Access has been given. </div>'); $id = $this->model->encryptdata($hid); redirect('webapp/people/view/'.$id); } public function upload(){ $id = $this->input->post('id'); $path = $this->input->post('path'); $filename = $_FILES['doc']['name']; $ext = pathinfo($filename, PATHINFO_EXTENSION); $ext = strtolower($ext); if(!empty($ext)){ if($ext == 'jpg' || $ext == 'jpeg' || $ext == 'png' || $ext == 'pdf'){ //$date_time = date('d').'_'.time(); $rand =rand(10,100); $target_file = preg_replace("/[^a-z0-9\_\-\.]/i", '', $_FILES['doc']['name']); $new_file = $rand.'_'.$target_file; $_FILES['file']['name'] = $new_file; $_FILES['file']['type'] = $_FILES['doc']['type']; $_FILES['file']['tmp_name'] = $_FILES['doc']['tmp_name']; $_FILES['file']['error'] = $_FILES['doc']['error']; $_FILES['file']['size'] = $_FILES['doc']['size']; // File upload configuration $config['upload_path'] = './'.$path.'/'; $config['allowed_types']= 'gif|jpg|png|pdf|jpeg'; //$config['encrypt_name'] = TRUE; // Load and initialize upload library $this->load->library('upload', $config); $this->upload->initialize($config); // Upload file to server $this->upload->do_upload('file'); $fileData = $this->upload->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> File has been Uploaded. </div>'); redirect('webapp/people/view/'.$id); } public function remove($enc_url, $id){ $dec_url = base64_decode($enc_url); $old = substr($dec_url, 0, strrpos( $dec_url, '/')); $name = substr($dec_url, strrpos($dec_url, '/') + 1); $new = $old.'/recycle/'.$name; //rename($dec_url, $new) //if(unlink($dec_url)){ if(rename($dec_url, $new)){ $cust_id = $this->model->decryptdata($id); $where = array('ufrom' => $cust_id, 'path' => $dec_url); $upd = array('recycle' => '1'); $this->model->UpdateData('tbl_cust_uploads', $upd, $where); $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> File has been Recycled. </div>'); redirect('webapp/people/view/'.$id); }else{ $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> Something went wrong. </div>'); redirect('webapp/people/view/'.$id); } } public function trash($rt_enc_url, $id){ $dec_url = base64_decode($rt_enc_url); $old = substr($dec_url, 0, strrpos( $dec_url, '/')); $name = substr($dec_url, strrpos($dec_url, '/') + 1); $new = $old.'/recycle/'.$name; if(unlink($dec_url)){ //if(rename($dec_url, $new)){ $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> File has been Deleted. </div>'); redirect('webapp/people/view/'.$id); }else{ $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> Something went wrong. </div>'); redirect('webapp/people/view/'.$id); } } public function recover($rt_enc_url, $rt_enc_url2, $id){ $old = base64_decode($rt_enc_url); $new = base64_decode($rt_enc_url2); $new_name = "rec_".$lastWord = substr($new, strrpos($new, '/') + 1); $new = substr($new, 0, strrpos( $new, '/')); $new = $new.'/'.$new_name; if(rename($old, $new)){ $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> File has been Recovered. </div>'); redirect('webapp/people/view/'.$id); }else{ $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> Something went wrong. </div>'); redirect('webapp/people/view/'.$id); } } public function profile(){ $userdata = $this->session->userdata('reg_info'); $rid = $userdata[0]['rid']; $where = array('rid' => $rid); $userdata['data'] = $this->model->DetailData('tbl_registration', $where); //echo "<pre>"; print_r($userdata); die; $this->load->view('webapp/profile', $userdata); } public function changepass(){ $userdata = $this->session->userdata('reg_info'); $users['data'] = $this->session->userdata('reg_info'); $rid = $userdata[0]['rid']; $pass = $userdata[0]['pass']; $old_pass = md5($this->input->post('old_pass')); $new_pass = $this->input->post('new_pass'); $confirm_pass = $this->input->post('confirm_pass'); $mypass = md5($confirm_pass); if($pass != $old_pass){ $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> Wrong old password. </div>'); redirect('webapp/users/profile'); }elseif($new_pass != $confirm_pass){ $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> Both password are not matching. </div>'); redirect('webapp/users/profile'); }else{ $where = array('rid' => $rid); $upd = array('pass' => $mypass); $this->model->UpdateData('tbl_registration', $upd, $where); $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> Password has been changed, Please login to continue. </div>'); $this->session->unset_userdata('reg_info'); $base = base_url(); redirect($base); } } public function getAWS(){ $Prefix = 'main/'; $objects = getAWS($Prefix); echo '<pre>'; print_r($objects); } public function testMail(){ //echo 'hi'; $to = 'anil.patel@staroneweb.co.in'; $sub = 'test'; $msg = ' <!DOCTYPE html> <html> <head> <title>New user registation</title> </head> <body style="font-family: sans-serif;"> <div class="container" style="width:50%; margin: 0 auto; background-color: #eee; box-shadow: 1px 1px 1px 1px #a09191; margin-top: 5rem; margin-bottom: 5rem;"> <div style="color:#fff; background-image: linear-gradient(-20deg, #CF212A 0%, #003865 100%); padding: 10px; text-align: center;"> <h3>Welcome to Paperpush</h3> </div> <div style="padding: 1rem;"> <p><strong>Hello,</strong></p> <p><strong>New account has been registered. You can activate the account from Admin Panel after received payment authentication.</strong></p> <p><strong>Registration Details:</strong></p> <p><strong>Name:</strong> vishal</p> <p><strong>Email:</strong> "'.$to.'"</p> <p><strong>Phone:</strong> 9658985458</p> </div> </div> </body> </html>'; $this->model->emailsend($to, $sub, $msg); //redirect('webapp/users'); } public function testEmail(){ $to = 'anil.patel@staroneweb.co.in'; $sub = "Paper Push"; $msg = 'Paper'; $this->model->emailsend($to, $sub, $msg); } } /* End of file Users.php */
Copyright ©2021 || Defacer Indonesia