whoami7 - Manager
:
/
proc
/
self
/
root
/
home
/
papecmvm
/
www
/
application
/
controllers
/
admin
/
Upload File:
files >> //proc/self/root/home/papecmvm/www/application/controllers/admin/Portfoliocategory.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); error_reporting(0); class Portfoliocategory extends CI_Controller { function __construct() { parent::__construct(); $this->load->model('alldata', "model"); $session_data=$this->session->all_userdata(); if(count($session_data)==5) { redirect('admin/starlogin'); } } public function index() { $data['view']=$this->model->getDatamodel('tbl_portfolio_category'); $this->load->view("portfolio/portfolio_cat",$data); } //------ START: INSERT FUNCTION ------------------------------ public function add_portfoliocategory(){ if($this->input->post('save')=='save'){ $rand=rand(1000,9999); $title=$this->input->post('portfolio_cat_name'); $pagecode =str_replace(' ', '-', $title).rand(999,9999); $insertdata= array( 'portfolio_cat_name'=>$this->input->post('portfolio_cat_name'), 'portfolio_code'=>$pagecode, ); $this->form_validation->set_rules('portfolio_cat_name', 'portfolio_cat_name', 'required|xss_clean|regex_match[/^[^\`\~\@\#\$\%\^\*\[\]\{\}\;:<>=+"]+$/]'); if ($this->form_validation->run() == TRUE) { $this->model->insertData('tbl_portfolio_category',$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> Insert data successfully . </div>'); */ redirect('admin/portfoliocategory'); }else{ $this->load->view("portfolio/portfolio_cat_add"); } } //------ END: INSERT FUNCTION ------------------------------ //------ START: EDIT FUNCTION ------------------------------ public function edit_portfoliocategory($encrypted_string){ $id = $this->model->decryptdata($encrypted_string); $where=array('portfolio_cat_id'=>$id); if($this->input->post('save')=='save'){ $rand=rand(1000,9999); $title=$this->input->post('portfolio_cat_name'); $pagecode =str_replace(' ', '-', $title).rand(999,9999); $Updatedata=array( 'portfolio_cat_name'=>$this->input->post('portfolio_cat_name'), 'portfolio_code'=>$pagecode, ); $this->form_validation->set_rules('portfolio_cat_name', 'portfolio_cat_name', 'required|xss_clean|regex_match[/^[^\`\~\@\#\$\%\^\*\[\]\{\}\;:<>=+"]+$/]'); if ($this->form_validation->run() == TRUE) { $this->model->UpdateData('tbl_portfolio_category',$Updatedata,$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> Update data successfully . </div>'); */ redirect('admin/portfoliocategory'); }else{ $data['view']=$this->model->DetailData('tbl_portfolio_category',$where); $this->load->view("portfolio/portfolio_cat_add",$data); } } //------ END: EDIT FUNCTION ------------------------------ //------ START: DELETE FUNCTION ------------------------------ public function delete_portfoliocategory(){ $ids = explode('&',$this->input->post('ck')); $n=count($ids); for($i=0;$i<$n;$i++) { $id=explode('=',$ids[$i]); $where=array('portfolio_cat_id'=>$id[1]); $getimages=$this->model->DetailData('tbl_portfolio',$where); for($j=0;$j<count($getimages);$j++) { //echo $getimages[$j]['portfolio_image_path']."<br/>"; unlink("portfolio_images/".$getimages[$j]['portfolio_image_path']); } $this->model->DeleteData('tbl_portfolio_category',$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> Delete data successfully . </div>'); */ redirect('admin/portfoliocategory'); } //------ END: DELETE FUNCTION ------------------------------- } /* End of file services.php */
Copyright ©2021 || Defacer Indonesia