403Webshell
Server IP : 94.136.191.34  /  Your IP : 216.73.216.25
Web Server : Apache
System : Linux hostpanel.netbiz.in 5.15.0-130-generic #140-Ubuntu SMP Wed Dec 18 17:59:53 UTC 2024 x86_64
User : omkar.com_6nnuz6y629h ( 10087)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system,proc_open,popen
MySQL : OFF |  cURL : ON |  WGET : OFF |  Perl : OFF |  Python : OFF |  Sudo : OFF |  Pkexec : OFF
Directory :  /var/www/vhosts/omkar.com/httpdocs/application/models/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /var/www/vhosts/omkar.com/httpdocs/application/models/Amenities_model.php
<?php

class Amenities_model extends CI_Model {

	public function __construct() {
        parent::__construct();
    }

    public function show_list(){
    	$this->db->order_by("id","desc");
		$query = $this->db->get('projects')->result_array();
		return $query;
    }

    public function checkDuplicate($client_name){
    	$name =  strtolower($client_name);
    	$this->db->where('name', $name);
    	$query = $this->db->get('projects')->row_array();
    	return $query['id'];
    }
     
    public function add_project($data,$files){

    	$query = $this->db->insert('amenities', $data);
    	$insert_id = $this->db->insert_id();
    	if(isset($insert_id)){
			$newfilename = '';
			$allowedExts = array("gif", "jpeg", "jpg", "png");

			foreach($_FILES["images"]["tmp_name"] as $key=>$tmp_name){

			$temp= explode(".", $_FILES["images"]["name"][$key]);

			$extension = $temp[1];	

				if ((($_FILES["images"]["type"][$key] == "image/gif")
				|| ($_FILES["images"]["type"][$key] == "image/jpeg")
				|| ($_FILES["images"]["type"][$key] == "image/jpg")
				|| ($_FILES["images"]["type"][$key] == "image/pjpeg")
				|| ($_FILES["images"]["type"][$key] == "image/x-png")
				|| ($_FILES["images"]["type"][$key] == "image/png"))
				&& ($_FILES["images"]["size"][$key] < 2000000)
				&& in_array($extension, $allowedExts)) 
				{

					$path = $_SERVER['DOCUMENT_ROOT']."/uploads/amenities/";	
					$newfilename = time().rand().".".$extension;

					if(move_uploaded_file($_FILES["images"]["tmp_name"][$key], $path . $newfilename)){
						$data = array(
							'id'=>$insert_id,
							'name'=>$newfilename,
							'created_on' => date('Y-m-d H:i:s'));
						$query = $this->db->insert('amenities', $data);
					}					
					
				}else{
					echo "some error occured";
				}
			}
		}
		//return $insert_id;
    }
    public function getSingle($id){
    	$this->db->where('id', $id);
		$query = $this->db->get('projects')->row_array();
		return $query;
    }

    public function updated($id,$data,$files){

		if(!empty($files)){
			$newfilename = '';
			$allowedExts = array("gif", "jpeg", "jpg", "png");

			foreach($_FILES["images"]["tmp_name"] as $key=>$tmp_name){

			$temp= explode(".", $_FILES["images"]["name"][$key]);

			$extension = $temp[1];	

				if ((($_FILES["images"]["type"][$key] == "image/gif")
				|| ($_FILES["images"]["type"][$key] == "image/jpeg")
				|| ($_FILES["images"]["type"][$key] == "image/jpg")
				|| ($_FILES["images"]["type"][$key] == "image/pjpeg")
				|| ($_FILES["images"]["type"][$key] == "image/x-png")
				|| ($_FILES["images"]["type"][$key] == "image/png"))
				&& ($_FILES["images"]["size"][$key] < 2000000)
				&& in_array($extension, $allowedExts)) 
				{

					$path = $_SERVER['DOCUMENT_ROOT']."/uploads/banners/";	
					$newfilename = time().rand().".".$extension;

					if(move_uploaded_file($_FILES["images"]["tmp_name"][$key], $path . $newfilename)){
						$data_image = array(
							'project_id'=>$id,
							'name'=>$newfilename,
							'created_on' => date('Y-m-d H:i:s'));
						$query = $this->db->insert('banners', $data_image);
					}					
					
				}else{
					echo "some error occured";
				}
			}
		}

		$this->db->where('id',$id);
		$this->db->update('projects', $data);
		$afftectedRows = $this->db->affected_rows();
		return $afftectedRows;
		
    }
    
    public function getSingleImage($id){
    	$this->db->where('id', $id);
		$query = $this->db->get('banners')->row_array();
		return $query;
    }

    public function delete($id){
		$this->db->where('project_id', $id);
		$query = $this->db->get('banners')->result_array();
		$path = $_SERVER['DOCUMENT_ROOT']."/uploads/banners/";
		foreach ($query as $row) {
			unlink($path.$row['name']);	
			$this->db->where('id',$row['id']);
			$this->db->delete('banners');
		}

		$this->db->where('id', $id);
		$this->db->delete('projects');
		return $query;
    }

    public function image_update($id,$files){

		if(!empty($files)){
		$newfilename = '';
		$allowedExts = array("gif", "jpeg", "jpg", "png");

			//foreach($_FILES["images"]["tmp_name"] as $key=>$tmp_name){

			$temp= explode(".", $_FILES["images"]["name"]);

			$extension = $temp[1];	

				if ((($_FILES["images"]["type"] == "image/gif")
				|| ($_FILES["images"]["type"] == "image/jpeg")
				|| ($_FILES["images"]["type"] == "image/jpg")
				|| ($_FILES["images"]["type"] == "image/pjpeg")
				|| ($_FILES["images"]["type"] == "image/x-png")
				|| ($_FILES["images"]["type"] == "image/png"))
				&& ($_FILES["images"]["size"] < 2000000)
				&& in_array($extension, $allowedExts)) 
				{

				$path = $_SERVER['DOCUMENT_ROOT']."/uploads/banners/";	
				$newfilename = time().rand().".".$extension;

					if(move_uploaded_file($_FILES["images"]["tmp_name"], $path . $newfilename)){
						$data_image = array('name'=>$newfilename);
						$this->db->where('id',$id);
						$query = $this->db->update('banners', $data_image);
					}					

				}else{
					echo "some error occured";
				}
			//}

			$this->db->where('id', $id);
			$query = $this->db->get('banners')->row_array();

			return $query;
		}

    }

    public function deleteSingleImage($id){
		$this->db->where('id', $id);
		$query = $this->db->get('banners')->row_array();
    	$path = $_SERVER['DOCUMENT_ROOT']."/uploads/banners/";
    	unlink($path.$query['name']);	
		$this->db->where('id', $id);
		$this->db->delete('banners');
		return $query;
     }


}

Youez - 2016 - github.com/yon3zu
LinuXploit