MMCT TEAM
Server IP : 103.53.40.154  /  Your IP : 3.138.32.53
Web Server : Apache
System : Linux md-in-35.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : ppcad7no ( 715)
PHP Version : 8.2.25
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0750) :  /home2/ppcad7no/adisgauges.com/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/ppcad7no/adisgauges.com/checkout.php
<?php include("site-header.php");?>




<?php
 session_start();
 if($_SESSION['login_id']=="" && empty($_SESSION['login_id']))
 {?>
   <script>
        swal({title: "Please login first !", text: "",showConfirmButton: true, allowEscapeKey : false, allowOutsideClick: false, type: "warning"},
   function(){ 
     window.location.href="<?=$site_url?>/login.html?t=Yes";
   }
);
   </script>
    
 <?}?>
<?php

$alert_msg="";
 if(isset($_POST['Submit_details']))
 {  @extract($_REQUEST);

/*echo $comment;
echo $ship_name;
echo $ship_email;
echo $ship_company;
echo $ship_contact;
echo $ship_address;
echo $ship_landmark;
echo $ship_country;
echo $ship_state;
echo $ship_city;
echo $ship_post_code;
echo $same_billing_address;

echo $billing_name;
echo $billing_email;
echo $billing_company;
echo $billing_contact;
echo $billing_address;
echo $billing_landmark;
echo $billing_country;
echo $billing_state;
echo $billing_city;
echo $billing_post_code;
*/
$sql_details="";
if($same_billing_address=="Yes")
{
db_query("update tbl_registration set reg_billing_address_same='Yes' where reg_id='$_SESSION[login_id]'");
$sql_details="update tbl_registration set
reg_shipping_name='$ship_name',
reg_shipping_email='$ship_email',
reg_shipping_company='$ship_company',
reg_shipping_mobile_no='$ship_contact',
reg_shipping_address='$ship_address',
reg_shipping_landmark='$ship_landmark',
reg_shipping_country='$ship_country',
reg_shipping_state='$ship_state',
reg_shipping_city='$ship_city',
reg_shipping_zip_code='$ship_post_code',
reg_billing_name='',
reg_billing_email='',
reg_billing_company='',
reg_billing_mobile_no='',
reg_billing_address='',
reg_billing_landmark='',
reg_billing_country='',
reg_billing_state='',
reg_billing_city='',
reg_billing_zip_code=''
where reg_id='$_SESSION[login_id]' ";


}
else
{
db_query("update tbl_registration set reg_billing_address_same='No' where reg_id='$_SESSION[login_id]'");
$sql_details="update tbl_registration set
reg_shipping_name='$ship_name',
reg_shipping_email='$ship_email',
reg_shipping_company='$ship_company',
reg_shipping_mobile_no='$ship_contact',
reg_shipping_address='$ship_address',
reg_shipping_landmark='$ship_landmark',
reg_shipping_country='$ship_country',
reg_shipping_state='$ship_state',
reg_shipping_city='$ship_city',
reg_shipping_zip_code='$ship_post_code',
reg_billing_name='$billing_name',
reg_billing_email='$billing_email',
reg_billing_company='$billing_company',
reg_billing_mobile_no='$billing_contact',
reg_billing_address='$billing_address',
reg_billing_landmark='$billing_landmark',
reg_billing_country='$billing_country',
reg_billing_state='$billing_state',
reg_billing_city='$billing_city',
reg_billing_zip_code='$billing_post_code'
where reg_id='$_SESSION[login_id]' ";


}


if(db_query($sql_details))
{
    $alert_msg="done";
    
   /* if($payment_method=="COD")
    {*/
    /*$_SESSION['payment_method']="COD";
    $_SESSION['comment']=$comment;
    $_SESSION['payable_amount']=$payable_amount;
    ?>
      <script>
    window.location.href="create_order.php";
  </script>  
  <?php */
   /* }else{*/
        
    
    $_SESSION['payment_method']="Online_PayuMoney";
    $_SESSION['comment']=$comment;
    $_SESSION['payable_amount']=$payable_amount;
    $_SESSION['coupon_amount']=$coupon_amount;
    
    
     $_SESSION['firstname']=db_scalar("select reg_name from tbl_registration  where reg_id='$_SESSION[login_id]' ");
     $_SESSION['email']=db_scalar("select reg_email from tbl_registration  where reg_id='$_SESSION[login_id]' ");
     $_SESSION['phone']=db_scalar("select reg_mobile_no from tbl_registration  where reg_id='$_SESSION[login_id]' ");
     $_SESSION['website_url']=$site_url;
     $_SESSION['company_namee']=$compDATA['admin_company_name'];
    
    ?>
  <script>
     // alert("Thank you! your order has been placed.");
   // window.location.href="create_order.php";
       window.location.href="PayUMoney_form.php";
  </script>  
    <?
/*}
    
    */
    
    
        
        
    }
else
{
   
    $alert_msg="error";
}


}

?>

 <style>
#error_style_ship{
    color:white; 
    font-size:13px;
    font-family:arial;
    background-color:#c32323;
    border-radius:7px; 
    box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
    box-sizing: border-box;
    padding:7px;
}

.error_name_ship{
       display:none;
}
.error_email_ship{
       display:none;
}
.error_company_ship{
       display:none;
}
.error_contact_ship{
       display:none;
}
.error_address_ship{
       display:none;
}
.error_country_ship{
       display:none;
}
.error_state_ship{
       display:none;
}

.error_city_ship{
       display:none;
}
.error_post_code_ship{
       display:none;
}

/*////////// BILLING ERROR STYLE ///////////////*/

.error_name_billing{
       display:none;
}
.error_email_billing{
       display:none;
}
.error_company_billing{
       display:none;
}
.error_contact_billing{
       display:none;
}
.error_address_billing{
       display:none;
}
.error_country_billing{
       display:none;
}
.error_state_billing{
       display:none;
}

.error_city_billing{
       display:none;
}
.error_post_code_billing{
       display:none;
}
</style>


  <div class="page-content">
    <div class="dlab-bnr-inr overlay-black-middle" style="background:url(<?=$site_url?>/images/inner-banner.jpg) no-repeat center; background-size:cover;">
      <div class="container">
        <div class="dlab-bnr-inr-entry">
          <h1 class="text-white">Checkout</h1>
          <ul class="list-inline">
            <li><a href="<?=$site_url?>/index.html">Home</a></li>
            <li>|</li>
            <li>Checkout</li>
          </ul>
        </div>
      </div>
    </div>
<div class="section-full bg-gray content-inner-1" >
   

 <?php
$account_sql=db_query("select * from tbl_registration where 1 and reg_status='Active' and reg_id='$_SESSION[login_id]'");
$account_data=mysql_fetch_array($account_sql);
?>


<div class="container wrapper">
               
            <div class="row cart-body">
                <form class="form-horizontal" action="" method="post" enctype="multipart/form-data" onsubmit="return checkValidationShipping();">
               
                <div class="col-lg-6 col-md-6 col-sm-6 col-xs-12 ">
                    <!--SHIPPING METHOD-->
                    <div class="panel panel-info">
                       
                        <div class="panel-body">
                            <div class="form-group">
                                <div class="col-md-12">
                                    <h4>Shipping Details</h4>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-md-12"><strong>Full Name *</strong></div>
                                <div class="col-md-12">
                                    <input class="form-control" type="text" placeholder="Enter name" name="ship_name" id="ship_name" onkeyup="errNameShip();" <?php if($account_data['reg_shipping_name']!=""){?> value="<?=$account_data['reg_shipping_name']?>" <?}else{?> value="<?=$account_data['reg_name']?>" <?}?> />
                                </div>
                            </div>
                             <p id="error_style_ship" class="error_name_ship" style="margin-top:10px; width:260px;"></p>
                             
                            <div class="form-group">
                                <div class="col-md-12"><strong>Company Name (Optional)</strong></div>
                                <div class="col-md-12">
                                    <input class="form-control" type="text" placeholder="Enter company name" name="ship_company" id="ship_company" onkeyup="errCompanyShip();" value="<?=$account_data['reg_shipping_company']?>" />
                                </div>
                              
                            </div>
                             <p id="error_style_ship" class="error_company_ship" style="margin-top:10px; width:260px;"></p>
                             
                             
                            
                            <div class="form-group">
                                <div class="col-md-6 col-xs-12">
                                    <strong>Phone *</strong>
                                    <input  class="form-control" type="text" placeholder="Enter phone number" maxlength="10" name="ship_contact" id="ship_contact" onkeyup="errContactShip();" <?php if($account_data['reg_shipping_mobile_no']!=""){?> value="<?=$account_data['reg_shipping_mobile_no']?>" <?}else{?> value="<?=$account_data['reg_mobile_no']?>" <?}?> />
                                </div>
                                 
                                <div class="span1"></div>
                                
                                
                                 
                               
                                <div class="col-md-6 col-xs-12">
                                    <strong>Email *</strong>
                                    <input class="form-control" type="text" placeholder="Enter email" name="ship_email" id="ship_email" onkeyup="errEmailShip();" <?php if($account_data['reg_shipping_email']!=""){?> value="<?=$account_data['reg_shipping_email']?>" <?}else{?> value="<?=$account_data['reg_email']?>" <?}?>/>
                                </div>
                               
                            </div>
                            
                             <p id="error_style_ship" class="error_contact_ship" style="margin-top:10px; width:260px;"></p>
                            
                              <p id="error_style_ship" class="error_email_ship" style="margin-top:10px; width:260px;"></p>
                              
                            <div class="form-group">
                                <div class="col-md-12"><strong>Address *</strong></div>
                                <div class="col-md-12">
                                    <input class="form-control" type="text" placeholder="Enter street address" name="ship_address" id="ship_address" onkeyup="errAddressShip();" <?php if($account_data['reg_shipping_address']!=""){?> value="<?=$account_data['reg_shipping_address']?>" <?}else{?> value="<?=$account_data['reg_address']?>" <?}?>/>
                                </div>
                                  
                            </div>
                            <p id="error_style_ship" class="error_address_ship" style="margin-top:10px; width:260px;"></p>
                            
                            
                             <div class="form-group">
                                <div class="col-md-12"><strong>Landmark (Optional)</strong></div>
                                <div class="col-md-12">
                                    <input class="form-control" type="text" placeholder="Apartment, landmark, unit etc. (optional)" name="ship_landmark" id="ship_landmark" value="<?=$account_data['reg_shipping_landmark']?>" />
                                </div>
                            </div>
                            
                            
                            <div class="form-group">
                                <div class="col-md-6 col-xs-12">
                                    <strong>Country *</strong>
                                    <input  class="form-control" type="text" placeholder="Enter country name" name="ship_country" id="ship_country" onchange="fetch_shipping_charge(this.value)" onkeyup="errCountryShip();" <?php if($account_data['reg_shipping_country']!=""){ $_SESSION['temp_country_name']=$account_data['reg_shipping_country']; ?> value="<?=$account_data['reg_shipping_country']?>" <?}else{  $_SESSION['temp_country_name']=$account_data['reg_country']; ?> value="<?=$account_data['reg_country']?>" <?}?> />
                                </div>
                                  
                                <div class="span1"></div>
                               
                                <div class="col-md-6 col-xs-12">
                                    <strong>State *</strong>
                                    <input class="form-control" type="text" placeholder="Enter state name" name="ship_state" id="ship_state" onkeyup="errStateShip();" <?php if($account_data['reg_shipping_state']!=""){?> value="<?=$account_data['reg_shipping_state']?>" <?}else{?> value="<?=$account_data['reg_state']?>" <?}?>/>
                                </div>
                              
                            </div>
                             <p id="error_style_ship" class="error_country_ship" style="width:260px;"></p>
                             <p id="error_style_ship" class="error_state_ship" style="margin-top:10px; width:260px;"></p>
                             
                             
                            
                            <div class="form-group">
                                <div class="col-md-6 col-xs-12">
                                    <strong>City *</strong>
                                    <input  class="form-control" type="text" placeholder="Town / City" name="ship_city" id="ship_city" onkeyup="errCityShip();" <?php if($account_data['reg_shipping_city']!=""){?> value="<?=$account_data['reg_shipping_city']?>"  <?}else{?> value="<?=$account_data['reg_city']?>" <?}?> />
                                </div>
                               
                                <div class="span1"></div>
                               
                                <div class="col-md-6 col-xs-12">
                                    <strong>Postcode / Zip *</strong>
                                    <input class="form-control" type="text" placeholder="Postcode / Zip" name="ship_post_code" id="ship_post_code" onkeyup="errPostCodeShip();" <?php if($account_data['reg_shipping_zip_code']!=""){?> value="<?=$account_data['reg_shipping_zip_code']?>" <?}else{?> value="<?=$account_data['reg_zip_code']?>" <?}?> />
                                </div>
                                
                            </div>
                            
                            <p id="error_style_ship" class="error_city_ship" style="margin-top:10px; width:260px;"></p>
                             <p id="error_style_ship" class="error_post_code_ship" style="margin-top:10px; width:260px;"></p>
                          
                            
                            
                        </div>
                    </div>
                    <!--SHIPPING METHOD END-->
                  
                </div>
                
                
                 <div class="col-lg-6 col-md-6 col-sm-6 col-xs-12 ">
                    <!--REVIEW ORDER-->
                    <div class="panel panel-info">
                        
                        <div class="panel-body">
<?php 
$sub_total_cart=0;
$tax_cart=0;
$total_cart=0;
$i=0;
$cart_sql=db_query("select * from tbl_basket where bskt_session_id='$_SESSION[cart_session_id]'");
while($cart_res=mysql_fetch_array($cart_sql))
{
$i++;
$sub_total_cart=$sub_total_cart+$cart_res['bskt_prd_subtotal'];



?>
                            <div class="form-group">
                                <div class="col-sm-3 col-xs-3">
                                    <img class="img-responsive" src="<?=$site_url?>/uploaded_files/<?=$cart_res['bskt_prd_image_name']?>" />
                                </div>
                                <div class="col-sm-6 col-xs-6">
                                    <div class="col-xs-12"><?=$cart_res['bskt_prd_name']?></div>
                                    <div class="col-xs-12"><small>Quantity:<span><?=$cart_res['bskt_prd_qnty']?></span></small></div>
                                </div>
                                <div class="col-sm-3 col-xs-3 text-right">
                                    <h6><span class="fa fa-usd"></span> <?=$cart_res['bskt_prd_subtotal']?></h6>
                                </div>
                            </div>
                            <div class="form-group"><hr /></div>
<?}?>
                            
                            
                         
                            <div class="form-group">
                                <div class="col-xs-12">
                                    <strong>Subtotal</strong>
                                    <div class="pull-right"><i class="fa fa-usd"></i> <span><?=$sub_total_cart?></span></div>
                                </div>
<?php
$shipp_qty=db_scalar("select sum(bskt_prd_qnty) from tbl_basket where bskt_session_id='$_SESSION[cart_session_id]'");


$sh_charge=db_scalar("select shipping_charges_amount from tbl_shipping_charges where shipping_charges_country_name='$_SESSION[temp_country_name]' ");
if($sh_charge=="")
{
    $sh_charge=$compDATA['admin_default_shipping_charges'];
}
$sh_charge=$sh_charge*$shipp_qty;

?>
                                <div class="col-xs-12">
                                    <small>Shipping Charges</small>
                                    <div class="pull-right"><span><i class="fa fa-usd"></i> <?=$sh_charge?></span></div>
                                </div>
                            </div>
                            
                            <?php
$total_cart=$sh_charge+$sub_total_cart;
// $_SESSION['payable_amount']=$total_cart;
$_SESSION['shipping_charges']=$sh_charge;

$_SESSION['tax']=$tax_cart;
$_SESSION['sub_total']=$sub_total_cart;
                            ?>
                         
                            <div class="form-group">
                                <div class="col-xs-12">
                                    <strong>Order Total</strong>
                                    <div class="pull-right"><i class="fa fa-usd"></i> <span><?=$total_cart?></span></div>
                                       <input type="hidden" name="payable_amount" value="<?=$total_cart?>">
                                       <input type="hidden" name="same_billing_address" value="Yes">
                                       
                                </div>
                                
                                
                                 
                            </div>
                            
                            <div class="form-group"><hr /></div>
                            <div class="form-group">
                                <div class="col-xs-12">
                                   
                                    <div class="pull-right">
                                     <button type="submit" class="btn btn-primary btn-submit-fix" name="Submit_details" id="Submit_details">Place Order</button>
                                     </div>
                                </div>
                                

                            </div>
                            
                        </div>
                    </div>
                    <!--REVIEW ORDER END-->
                </div>
                
                </form>
            </div>
            <div class="row cart-footer">
        
            </div>
    </div>


    </div>
    <?php include("site-footer.php");?>
  </div>
</div>


<script>


function fetch_shipping_charge(country_name)
{
   
        $.ajax({
            url:"fetch_shipping_charge.php",
            type:"POST",
            data:{country_name:country_name},
            success:function(data){

              location.reload();
            }
        });
        
}

  function trimfield(str) 
        { 
            return str.replace(/^\s+|\s+$/g,''); 
        }
    

    function checkValidationShipping(){
     
      var ship_name=document.getElementById("ship_name");
      var ship_email=document.getElementById("ship_email");
      var ship_company=document.getElementById("ship_company");
      var ship_contact=document.getElementById("ship_contact");
      var ship_address=document.getElementById("ship_address");
      var ship_country=document.getElementById("ship_country");
      var ship_state=document.getElementById("ship_state");
       var ship_city=document.getElementById("ship_city");
      var ship_post_code=document.getElementById("ship_post_code");




       if(ship_name.value==""){
            $('#ship_name').css({"border-color":"red"});
            ship_name.focus();
            $('.error_name_ship').fadeIn('slow');
             $(".error_name_ship").html("Please enter your name !");
            return false;
        }

        if(ship_name.value.length<=3){
             $('#ship_name').css({"border-color":"red"});
            ship_name.focus();
            $(".error_name_ship").html("Name should be greater than 3 alphabet !");
            $('.error_name_ship').fadeIn('slow');
            return false;
        }

        if (/[0-9]/g.test(ship_name.value)) {
            $('#ship_name').css({"border-color":"red"});
                ship_name.focus();
         $(".error_name_ship").html("Use alphabet only !");
            $('.error_name_ship').fadeIn('slow');
                return false;
        }

  if (!/[A-Za-z\s]/g.test(ship_company.value) && ship_company.value!="") {
            $('#ship_company').css({"border-color":"red"});
                ship_company.focus();
        $(".error_company_ship").html("Value should not be numeric !");
        $('.error_company_ship').fadeIn('slow');
                return false;
        }
        
         if(ship_contact.value==""){
             $('#ship_contact').css({"border-color":"red"});
            ship_contact.focus();
            $(".error_contact_ship").html("Please enter contact number !");
            $('.error_contact_ship').fadeIn('slow');
            return false;
        }

        if(isNaN(ship_contact.value)){
             $('#ship_contact').css({"border-color":"red"});
            ship_contact.focus();
             $(".error_contact_ship").html("Please enter numeric value only !");
            $('.error_contact_ship').fadeIn('slow');
            return false;
        }

        if(ship_contact.value.length<10 || ship_contact.value.length>10){
             $('#ship_contact').css({"border-color":"red"});
            ship_contact.focus();
            $(".error_contact_ship").html("Contact number should be 10 digit long !");
            $('.error_contact_ship').fadeIn('slow');
            return false;
        }

            if(ship_email.value==""){
             $('#ship_email').css({"border-color":"red"});
            ship_email.focus();
             $(".error_email_ship").html("Please enter your email !");
            $('.error_email_ship').fadeIn('slow');
            return false;            
        }
        if(!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(ship_email.value)){
             $('#ship_email').css({"border-color":"red"});
            ship_email.focus();
             $(".error_email_ship").html("Please enter valid email address !");
            $('.error_email_ship').fadeIn('slow');
            return false;
        }

      

         

             if(ship_address.value==""){
             $('#ship_address').css({"border-color":"red"});
            ship_address.focus();
            $(".error_address_ship").html("Please enter address !");
            $('.error_address_ship').fadeIn('slow');
            return false;
        }

            if(ship_country.value==""){
             $('#ship_country').css({"border-color":"red"});
            ship_country.focus();
            $(".error_country_ship").html("Please enter country name !");
            $('.error_country_ship').fadeIn('slow');
            return false;
        }
       

        

           if(ship_state.value==""){
             $('#ship_state').css({"border-color":"red"});
            ship_state.focus();
            $(".error_state_ship").html("Please enter state name ");
            $('.error_state_ship').fadeIn('slow');
            return false;
        }


           if(ship_city.value==""){
             $('#ship_city').css({"border-color":"red"});
            ship_city.focus();
            $(".error_city_ship").html("Please enter city !");
            $('.error_city_ship').fadeIn('slow');
            return false;
        }

            if(ship_post_code.value==""){
             $('#ship_post_code').css({"border-color":"red"});
            ship_post_code.focus();
            $(".error_post_code_ship").html("Please postcode !");
            $('.error_post_code_ship').fadeIn('slow');
            return false;
        }



      }


         function errNameShip(){
        $('#ship_name').css({"border-color":"#A89842"});
        $('.error_name_ship').css({"display":"none"});
    }
    
   function errEmailShip(){
        $('#ship_email').css({"border-color":"#A89842"});
        $('.error_email_ship').css({"display":"none"});
    }
       function errCompanyShip(){
        $('#ship_company').css({"border-color":"#A89842"});
        $('.error_company_ship').css({"display":"none"});
    }
       function errContactShip(){
        $('#ship_contact').css({"border-color":"#A89842"});
        $('.error_contact_ship').css({"display":"none"});
    }
       function errAddressShip(){
        $('#ship_address').css({"border-color":"#A89842"});
        $('.error_address_ship').css({"display":"none"});
    }
    
     function errCountryShip(){
        $('#ship_country').css({"border-color":"#A89842"});
        $('.error_country_ship').css({"display":"none"});
    }
    
       function errStateShip(){
       $('#ship_state').css({"border-color":"#A89842"});
        $('.error_state_ship').css({"display":"none"});
    }
    
    
       function errCityShip(){
        $('#ship_city').css({"border-color":"#A89842"});
        $('.error_city_ship').css({"display":"none"});
    }
       function errPostCodeShip(){
        $('#ship_post_code').css({"border-color":"#A89842"});
        $('.error_post_code_ship').css({"display":"none"});
    }

   
   



</script>


<script src="<?=$site_url?>/js/jquery.min.js"></script> 
<script src="<?=$site_url?>/js/bootstrap.min.js"></script> 
<script src="<?=$site_url?>/js/bootstrap-select.min.js"></script> 
<script src="<?=$site_url?>/js/jquery.bootstrap-touchspin.js"></script> 
<script src="<?=$site_url?>/js/magnific-popup.js"></script> 
<script src="<?=$site_url?>/js/waypoints-min.js"></script> 
<script src="<?=$site_url?>/js/imagesloaded.js"></script> 
<script src="<?=$site_url?>/js/masonry-3.1.4.js"></script> 
<script src="<?=$site_url?>/js/masonry.filter.js"></script> 
<script src="<?=$site_url?>/js/owl.carousel.js"></script> 
<script src="<?=$site_url?>/js/custom.js"></script> 
<script src="<?=$site_url?>/js/dz.carousel.js"></script> 
<script src="<?=$site_url?>/js/switcher.min.js"></script>
</body>
</html>

MMCT - 2023