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/thanhtraspa.vn/app/Http/Controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/thanhtraspa.vn/app/Http/Controllers/DatlichController.php
<?php

namespace App\Http\Controllers;
use Illuminate\Http\Request;
use DB;
use File;
use App\Models\City;
use App\Models\Province;
use App\Models\Wards;
use App\Models\Feeship;
use App\Models\Shipping;
use App\Models\Order;
use App\Models\OrderDetails;
use App\Models\Slider;
use App\Models\CatePost;
use App\Models\Product;
use App\Models\Attr;
use App\Models\Gallery;
use App\Models\Category;
use App\Models\Datlich;
use App\Mail\DatLichMail;
use Illuminate\Support\Facades\Mail;

use Illuminate\Foundation\Bus\DispatchesJobs;
use App\Http\Requests;
use Session;
use Illuminate\Support\Facades\Redirect; 
use App\Http\Controllers\Controller;
use Cart;
session_start();
use Auth;
use Illuminate\Session\Middleware\StartSession;

class DatlichController extends Controller
{
    public function AuthLogin() {
        $admin_id=session::get('admin_id');
        if($admin_id){
            return Redirect::to('dashboard');
        }
        else{
        return Redirect::to('admin')->send();
        }
    }
  
    public function save_datlich (Request $request)
    {
        // 1. Validate the incoming request data
        $validatedData = $request->validate([
            'datlich_name' => 'required|string|max:255',
            'datlich_email' => 'nullable|email|max:255', // Add email validation if you plan to use it
            'datlich_phone' => [
                'required',
                'string',
                'min:9', // Minimum length for Vietnamese numbers (e.g., 901234567)
                'max:15', // Adjust max length as needed (e.g., +84912345678)
                // Regex for Vietnamese phone numbers:
                // Allows for optional +84 or 84 prefix, followed by 3, 5, 7, 8, 9,
                // and then 8 digits.
                'regex:/^((\+|)84|0)(3|5|7|8|9)+([0-9]{8})$/'
            ],
            'datlich_notes' => 'nullable|string|max:1000',
        ]);

        // 2. Prepare data for saving (you can directly use $validatedData)
        // If you still prefer using request()->except(['_token']), make sure it aligns with $validatedData
        // $data = $request->all(); // This is often redundant if you use $validatedData
        // $data = request()->except(['_token']); // This can also be removed if you use $validatedData directly
                                                // or selectively assign from $validatedData

        $datlich = new Datlich();
        $datlich->datlich_name = $validatedData['datlich_name'];
        $datlich->datlich_phone = $validatedData['datlich_phone'];
        $datlich->datlich_notes = $validatedData['datlich_notes'] ?? ''; // Use null coalescing for nullable fields
        $datlich->datlich_status = 0; // Assuming default status is 0
        $datlich->save();

        try {
            // 3. Define recipient emails (multiple recipients)
            $recipientEmails = [
                'nguyenthanhabm@gmail.com',
                'nguyendinhhoaicam@gmail.com', // Add the second email address here
                // You can add more emails to this array as needed
            ];

            // 4. Send the email to multiple recipients
            Mail::to($recipientEmails)->send(new DatLichMail($datlich)); // Pass the saved $datlich object

            Session::put('message', 'Đặt Lịch Thành Công');
            return redirect()->back()->with('message', 'Đặt lịch Thành Công');

        } catch (\Exception $e) {
            // 5. Log the error if email sending fails
            \Log::error('Error sending Dat Lich email: ' . $e->getMessage());
            Session::put('error', 'Có lỗi xảy ra khi gửi email xác nhận đặt lịch. Vui lòng thử lại sau.');
            return redirect()->back()->with('error', 'Đặt lịch thành công nhưng có lỗi khi gửi email xác nhận. Vui lòng kiểm tra lại.');
        }
    }

 public function view_datlich(Request $request)
    {
         $this->AuthLogin(); 
        $datlich= Datlich::orderby('created_at', 'DESC')->get(); 

        return view('admin.datlich.view_datlich')->with(compact('datlich'));
    }


public function update_datlich(Request $request){

        $data=$request->all();
        $datlich= Datlich::find($data['datlich_id']);
        $datlich->Datlich_status=$data['datlich_status'];
        $datlich->save();
        // $order_product_id = $data['order_product_id'];
        // $quantity = $data['quantity'];

            }


public function confirm_datlich (Request $request){
        $data = $request->all();    
        $data = request()->except(['_token']);
        $datlich=new Datlich();
        $datlich->datlich_name=$data['datlich_name'];
        $datlich->datlich_phone=$data['datlich_phone'];
        $datlich->datlich_notes=$data['datlich_notes'];
        $datlich->timestamps=true;
        $datlich->save();
    }
     
    public function delete_datlich($datlich_id){
        $this->AuthLogin();
        $datlich = Datlich::find($datlich_id);
        
        
        $datlich->delete();
        Session::put('message','Xóa thành công');
        return redirect()->back();
    }

        
}

    

Youez - 2016 - github.com/yon3zu
LinuXploit