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

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/chongthamdls.vn/app/Http/Controllers/CheckoutController.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\Contact;
use App\Models\CatePost2;
use App\Models\Post;

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 CheckoutController extends Controller
{

    public function login_checkout(request $request){

        //seo
    $meta_desc="đăng nhập để mua hàng ";
    $meta_keywords="đăng nhập shopbanhang";
    $meta_title="đăng nhập để mua hàng ";
    $url_canonical= $request->url();
        //endseo

    $cate_product=DB::table('tbl_category_product')->orderby('category_id','desc')->get();
    $brand_product=DB::table('tbl_brand')->orderby('brand_id','desc')->get();
    return view('pages.checkout.login_checkout')->with(compact('cate_product','brand_product','meta_keywords','meta_desc','meta_title','url_canonical')); 

    }
    
    //khách hàng đăng ký tài khoản mới 
    public function add_customer(Request $Request) {
        $data=array();
        $data['customer_name']=$Request->customer_name;
        $data['customer_email']=$Request->customer_email;
        $data['customer_password']=MD5($Request->customer_password);
        $data['customer_phone']=$Request->customer_phone;

        $customer_id = DB::table('tbl_customers')->insertGetId($data);
        Session::put('customer_id',$customer_id);
        Session::put('customer_name',$Request->customer_name);
        return Redirect::to('/checkout');
    
    }
    // trang thông tin khách đặt hàng 
    public function checkout(Request $Request) {
    $category_post = CatePost::orderBy('cate_post_id','DESC')->get();
    $categorypost = CatePost2::orderBy('categorypost_id','DESC')->get();
    $meta_desc="Thông tin đặt hàng";
    $meta_keywords="Thông tin đặt hàng";
    $meta_title="Thông tin đặt hàng ";
    $url_canonical= $Request->url();   
    $slide =Slider::orderby('slider_id','desc')->get(); 
    $cate_product=Category::where('category_status','1')->orderby('category_id','desc')->with('cate')->get();
    $all_product=DB::table('tbl_product')->where('product_status','1')->orderby('product_id','desc')->get();
    $brand_product=DB::table('tbl_brand')->orderby('brand_id','desc')->get();
    $all_attr=Attr::with('product')->get(); 
    $contact = Contact::where('info_id',1)->get();
    $all_post=Post::orderby('post_id','desc')->get();
    // $slide=Slider::orderby('slider_id','desc')->get();
    return view('pages.checkout.show_checkout')->with(compact('cate_product','brand_product','meta_keywords','meta_desc','meta_title','url_canonical','all_product','slide','category_post','all_attr','contact','all_post','categorypost')); 
    }
    //lưu thông tin khách hàng dặt hàng 
    public function save_checkout_costumer(Request $Request) {

        // Model
        $data=$Request->all();
        $shipping=new Shipping();
        $shipping->shipping_name=$data['shipping_name']; 
        $shipping->shipping_email=$data['shipping_email'];
        $shipping->shipping_notes=$data['shipping_notes'];
        $shipping->shipping_phone=$data['shipping_phone'];
        $shipping->shipping_address=$data['shipping_address'];
        $shipping->save(); 
        Session::put('shipping_id',$shipping->shipping_id);
        

        // $data=array();
        // $data['shipping_name']=$Request->shipping_name;
        // $data['shipping_email']=$Request->shipping_email;
        // $data['shipping_notes']=$Request->shipping_notes;
        // $data['shipping_phone']=$Request->shipping_phone;
        // $data['shipping_address']=$Request->shipping_address;
        //$shipping_id = DB::table('tbl_shipping')->insertGetId($data);
        //Session::get('shipping_id',$shipping_id);
       

        return Redirect::to('/payment');

    }
     //thanh toán 
     public function payment(Request $Request) {

     $meta_desc="mo ta san pham";
    $meta_keywords="san pham quan ao";
    $meta_title="quan ao thoi trang ";
    $url_canonical= $Request->url();   
    $cate_product=DB::table('tbl_category_product')->orderby('category_id','desc')->get();
    $brand_product=DB::table('tbl_brand')->orderby('brand_id','desc')->get();
       return view('pages.checkout.payment')->with(compact('cate_product','brand_product','meta_keywords','meta_desc','meta_title','url_canonical')); 
     }

     //Đặt hàng
    public function order_place(Request $Request){

    $meta_desc="thong tin dat  hang ";
    $meta_keywords="sthong tin dat  hang";
    $meta_title="thong tin dat  hang ";
    $url_canonical= $Request->url();  


    // insert payment  method 

    $data=array();
        $data['payment_method']=$Request->payment_option;
        $data['payment_status']='Đang chờ xử lý';
        $payment_id = DB::table('tbl_payment')->insertGetId($data);

    // insert order 
    $order_data=array();
        $order_data['customer_id']=Session::get('customer_id');
        if(Session::get('customer_id')==null){
        $order_data['customer_id'] =0;

        }
        $order_data['shipping_id']=Session::get('shipping_id');
        $order_data['payment_id']=$payment_id;
        $order_data['order_total']=Cart::total();
        $order_data['order_status']='Đang chờ xử lý';
        $order_id = DB::table('tbl_order')->insertGetId($order_data);

     //inser order details 
     
     //$order_d_data=array();
     $content=Cart::content();
     foreach($content as $v_content)
        {
        $order_d_data['order_id']=$order_id;
        $order_d_data['product_id']=$v_content->id;
        $order_d_data['product_name']=$v_content->name;
        $order_d_data['product_price']=$v_content->price;
        $order_d_data['product_sales_quantity']=$v_content->qty;
        DB::table('tbl_order_details')->insertGetId($order_d_data);
        }

    if ($data['payment_method']==1){
        echo 'thanh toan thẻ';  
    }elseif($data['payment_method']==2){
     cart::destroy(); 
     $cate_product=DB::table('tbl_category_product')->orderby('category_id','desc')->get();
    $brand_product=DB::table('tbl_brand')->orderby('brand_id','desc')->get();  
     return view('pages.checkout.handcash')->with(compact('cate_product','brand_product','meta_keywords','meta_desc','meta_title','url_canonical'));  ;   
    }else{
        echo 'thanh toan Momo';          
        }


    }
     
     // Đăng xuất tài khoản 
     public function logout_checkout(){
        
       session::flush();
      return Redirect::to('/login-checkout');

    }
    // Đăng nhập tài khoản 
    public function login_customer(Request $Request){
        $email = $Request->email_account;
        $password = md5($Request->password_account);


        $result =  DB::table('tbl_customers')->where('customer_email',$email)->where('customer_password',$password)->first();
        if($result){
         Session::put('customer_id',$result->customer_id);
            return Redirect::to('/checkout');
        }
        else{
            return Redirect::to('/login-checkout');
        }
    }

   // chọn xã phường/quận huyện/Thành phố 
    public function selete_delivery_home(Request $request)

   {
      $data=$request->all();

     if($data['action']){
            $output='';
         if($data['action']=="city"){

       $selete_province =Province::where('matp',$data['ma_id'])->orderby('maqh','ASC')->get();
        $output.='<option>--Chọn Quận Huyện--</option>';


                 foreach($selete_province as $key => $province){
                 $output.='<option value ="'.$province->maqh.'">'.$province->name_quanhuyen.'</option>';
                 }

               }
              
               else {$selete_wards =Wards::where('maqh',$data['ma_id'])->orderby('xaid', 'ASC')->get();

               $output.='<option>---Chọn Xã Phường---</option>';
                  foreach($selete_wards as $key => $wards){
                 $output.='<option value="'.$wards->xaid.'"> '.$wards->name_xaphuong.'</option>';
                 }

           }
       }
     echo $output;
    }
public function  calculate_fee(Request $request)

   {
      $data=$request->all();
      if($data['matp']){
     $feeship=Feeship::where('fee_matp',$data['matp'])->where('fee_maqh',$data['maqh'])->where('fee_xid',$data['xaid'])->get();
     if($feeship){
      $count_feeship=$feeship->count(); 
      if($count_feeship>0){
        foreach($feeship as $key=> $fee ){
        session::put('fee', $fee->fee_feeship);
        session::save();        
      }    

     }
     
        session::put('fee',50000);
        session::save();
     }

    }
}

    public function confirm_order (Request $request){
        $data = $request->all();    
        $shipping=new Shipping();
        $shipping->shipping_name=$data['shipping_name'];
        $shipping->shipping_email=$data['shipping_email'];
        $shipping->shipping_address=$data['shipping_address'];
        $shipping->shipping_phone=$data['shipping_phone'];
        $shipping->shipping_notes=$data['shipping_notes'];
        $shipping->shipping_method=$data['shipping_method'];
        $shipping->save();
        $shipping_id =$shipping->shipping_id;
        
        $order =new Order();
        date_default_timezone_set('asia/ho_chi_minh');
        $checkout_code = substr(md5(microtime()),rand(0,26),5);
        $order->customer_id=session::get('customer_id');
        if(Session::get('customer_id')==null){
        $order->customer_id =0;

        }
        $order->shipping_id=$shipping_id;
        $order->order_status=1;
        $order->order_code= $checkout_code;
        $order->save();

        if (session::get('cart')){
        foreach(session::get('cart') as $key =>$cart){
        $order_details=new OrderDetails();
        $order_details->order_code=$checkout_code;
        $order_details->product_id =$cart['product_id'];
        $order_details->product_name =$cart['product_name'];
        $order_details->product_sku =$cart['product_sku'];
        $order_details->product_sales_quantity =$cart['product_qty'];
        $order_details->product_price =$cart['product_price'];
        $order_details->product_coupon =NULL;
        $order_details->product_feeship =NULL;
        $order_details->timestamps = false;
        
        $order_details->save();
        }
        }
        session::forget('coupon');
        session::forget('fee');
        session::forget('cart');

    }


}
    

Youez - 2016 - github.com/yon3zu
LinuXploit