whoami7 - Manager
:
/
proc
/
self
/
root
/
home
/
papecmvm
/
www
/
application
/
controllers
/
admin
/
Upload File:
files >> //proc/self/root/home/papecmvm/www/application/controllers/admin/Bannersmanagement.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); ob_start(); error_reporting(0); class Bannersmanagement extends CI_Controller { function __construct() { parent::__construct(); $this->load->model('alldata','model'); } public function index() { // $data['view']=$this->model->getDatamodel('tblbanners'); $this->db->select('*'); $this->db->from('tblbanners'); $this->db->join('tblusers', 'tblbanners.b_user_id = tblusers.uid','left'); $data['view'] = $this->db->get()->result_array(); $this->load->view("banners/banner_view",$data); } public function addbanner() { if($this->input->post('save')=='save') { $names= implode('|', $this->input->post('imageview')); $session_data=$this->session->all_userdata(); $insertdata=array('banner_title'=>$this->input->post('banner'), 'banner_images'=>$names, 'b_user_id'=>$session_data['userinfo'][0]['uid'] ); $this->form_validation->set_rules('banner', 'banner', 'required|xss_clean|regex_match[/[^\`\~\@\#\$\%\^\*\[\]\{\}\;:<>=+"]+$/]'); if ($this->form_validation->run() == TRUE) { $this->model->insertData('tblbanners',$insertdata); } /* $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> Banner Data successfully Insert. </div>'); */ redirect('admin/bannersmanagement'); } else { $names = array('.png', '.jpg', '.gif','.jpeg'); $this->db->where_in('filetype', $names); $data['image']=$this->db->get('tblmedia')->result_array(); $this->load->view("banners/banner_add",$data); } } public function editBannerData($encrypted_string) { $id = $this->model->decryptdata($encrypted_string); $where=array('banner_id'=>$id); if($this->input->post('save')=='save') { $names= implode('|', $this->input->post('imageview')); $session_data=$this->session->all_userdata(); $updatedata=array('banner_title'=>$this->input->post('banner'), 'banner_images'=>$names, 'b_user_id'=>$session_data['userinfo'][0]['uid'], 'modified_time'=>date('Y-m-d h:m:s') ); $this->form_validation->set_rules('banner', 'banner', 'required|xss_clean|regex_match[/[^\`\~\@\#\$\%\^\*\[\]\{\}\;:<>=+"]+$/]'); if ($this->form_validation->run() == TRUE) { $this->model->UpdateData('tblbanners',$updatedata,$where); } redirect('admin/bannersmanagement'); } else { $names = array('.png', '.jpg', '.gif','.jpeg'); $this->db->where_in('filetype', $names); $data['image']=$this->db->get('tblmedia')->result_array(); $data['view']=$this->model->DetailData('tblbanners',$where); $this->load->view("banners/banner_edit",$data); } } public function deleteBannerData($ids,$banner,$imagename) { $id = $this->model->decryptdata($ids); $where=array('banner_id'=>$id); $getbanner=$this->model->DetailData('tblbanners',$where); $imagedel=$banner.'/'.$imagename; $images=explode('|',$getbanner[0]['banner_images']); $updateimages=array(); for($i=0;$i<count($images);$i++) { if($images[$i]!=$imagedel) { $updateimages[$i]=$images[$i]; } else { unlink($images[$i]); } } $names= implode('|', $updateimages); $updatedata=array('banner_images'=>$names); $this->model->UpdateData('tblbanners',$updatedata,$where); $this->editBannerData($ids); } public function deletesliderselected() { $ids=explode('&',$this->input->post('ck')); for ($i=0; $i < count($ids); $i++) { $id=explode('=',$ids[$i]); $where=array('banner_id'=>$id[1]); $getbanner=$this->model->DetailData('tblbanners',$where); $images=explode('|',$getbanner[0]['banner_images']); for($k=0;$k<count($images);$k++) { unlink($images[$k]); } $this->model->deleteData('tblbanners',$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> Slider Data successfully Delete. </div>'); */ redirect('admin/bannersmanagement'); } }
Copyright ©2021 || Defacer Indonesia