System: Windows NT WINDOWS18 10.0 build 17763 (Windows Server 2016) AMD64 | User: IWPD_3544(appclien)

Path: D:\Inetpub\vhosts\appclients.in\fruits-vegitables.nmvm.org

[Back to List]
<?php
include "includes/main-action.php";
if(!isset($_SESSION['cart']) || empty($_SESSION['cart'])){
header('location:index.php');
}
$obj=new admin_main();
$sel_cs=$obj->select_all("menu","order by menu_id");
$sel_banner_top=$obj->select_all("adv_tbl1","order by adv_id desc limit 1");
$sel_banner_right=$obj->select_all("adv_tbl3","order by adv_id desc limit 2");
$sel_slider=$obj->select_all("adv_tbl2","order by adv_id desc");
//select customer details
$sel_customer_dtl=$obj->select_all("register","where reg_id='$_SESSION[user_id]'");
$customerDetails=mysqli_fetch_array($sel_customer_dtl); 
extract($customerDetails);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Basic page needs
    ============================================ -->
<title><?php include('title.php')?> | Order as Guest User</title>
<meta charset="utf-8">
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta name="author" content="">
<meta name="robots" content="index, follow" />
<!-- Mobile specific metas
    ============================================ -->
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<!-- Favicon
    ============================================ -->
<link rel="shortcut icon" type="image/png" href="<?php echo $url?>image/icon/favicon.png"/>
<!-- Libs CSS
    ============================================ -->
<link rel="stylesheet" href="<?php echo $url?>css/bootstrap/css/bootstrap.min.css">
<link href="<?php echo $url?>css/font-awesome/css/font-awesome.min.css" rel="stylesheet">
<link href="<?php echo $url?>js/datetimepicker/bootstrap-datetimepicker.min.css" rel="stylesheet">
<link href="<?php echo $url?>js/owl-carousel/owl.carousel.css" rel="stylesheet">
<link href="<?php echo $url?>css/themecss/lib.css" rel="stylesheet">
<link href="<?php echo $url?>js/jquery-ui/jquery-ui.min.css" rel="stylesheet">
<link href="<?php echo $url?>js/minicolors/miniColors.css" rel="stylesheet">
<!-- Theme CSS
    ============================================ -->
<link href="<?php echo $url?>css/themecss/so_searchpro.css" rel="stylesheet">
<link href="<?php echo $url?>css/themecss/so_megamenu.css" rel="stylesheet">
<link href="<?php echo $url?>css/themecss/so-categories.css" rel="stylesheet">
<link href="<?php echo $url?>css/themecss/so-listing-tabs.css" rel="stylesheet">
<link href="<?php echo $url?>css/themecss/so-category-slider.css" rel="stylesheet">
<link href="<?php echo $url?>css/themecss/so-newletter-popup.css" rel="stylesheet">
<link href="<?php echo $url?>css/footer/footer2.css" rel="stylesheet">
<link href="<?php echo $url?>css/header/header2.css" rel="stylesheet">
<link id="color_scheme" href="<?php echo $url?>css/home2.css" rel="stylesheet">
<link href="<?php echo $url?>css/responsive.css" rel="stylesheet">
<!-- Google web fonts
    ============================================ -->
<link href='https://fonts.googleapis.com/css?family=Poppins:300,400,500,600,700' rel='stylesheet' type='text/css'>
<style type="text/css">
         body{font-family:'Poppins', sans-serif}
		 table td{padding:5px}
</style>
<link rel="stylesheet" href="<?php echo $url?>https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
<script src="<?php echo $url?>https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="<?php echo $url?>https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
	
</head>
<body class="common-home res layout-2">
<div id="wrapper" class="wrapper-fluid banners-effect-7">
<!-- Header Container  -->
<?php include "includes/topbar.php";?>
<!-- //Header Top -->
<!-- Header center -->
<?php include "includes/searchbar.php";?>
<!-- //Header center -->
<!-- Header Bottom -->
<?php include "includes/navbar.php";?>
</header>
<!-- //Header Container  -->
<!-- //Header Container  -->
<!-- Main Container  -->
<div class="main-container container">
  <ul class="breadcrumb">
    <li><a href="<?php echo $url?>"><i class="fa fa-home"></i></a></li>
    <li><a href="<?php echo $url?> ">Proceed Now</a></li>
  </ul>
  <div class="row">
    <div id="content" class="col-sm-12">
      <div class="page-login">
        <div class="account-border">
          <div class="row">
            <div class="col-sm-6 new-customer">
              <div class="well">
                <div class="panel panel-default">
                  <div class="panel-heading">
                    <h4 class="panel-title"><i class="fa fa-user"></i> Delivery/Shipping Address </h4>
                  </div>
                  <div class="panel-body">
                    <form method="post">
                      <fieldset id="account">
                      <div class="col-sm-6" style="padding-left:0px">
                        <div class="form-group required">
                          <label for="input-payment-firstname" class="control-label">Name</label>
                         <input type="text" class="form-control" id="input-payment-firstname" placeholder="Name" name="firstname" value="<?php if(!empty($clname))echo $cfname." ".$clname; else echo $clname?>" required>
                        </div>
                      </div>
                      <div class="col-sm-6" style="padding-left:0px">
                        <div class="form-group required">
                          <label for="input-payment-email" class="control-label">E-Mail</label>
                          <input type="mail" class="form-control" id="input-payment-email" placeholder="E-Mail" name="email" value="<?php echo $cemail?>" required>
                        </div>
                      </div>
                      <div class="col-sm-6" style="padding-left:0px;">
                        <div class="form-group required">
                          <label for="input-payment-telephone" class="control-label">Mobile No</label>
                          <input type="number" class="form-control" id="input-payment-telephone" pattern="[1-9]{1}[0-9]{9}" title="Invalid Mobile no" maxlength="10" placeholder="Mobile No" name="phone" value="<?php echo $ctel?>" required>
                        </div>
                      </div>
                      <div class="col-sm-6" style="padding-left:0px">
                        <div class="form-group required">
                          <label for="input-city" class="control-label">City</label>
                          <input type="text" class="form-control" id="input-payment-email" placeholder="City" name="city" value="<?php echo $ccity?>" required>
                        </div>
                      </div>
                      <div class="col-sm-6" style="padding-left:0px;">
                        <div class="form-group required">
                          <label for="input-payment-telephone" class="control-label">State</label>
                          <input type="text" class="form-control" id="input-payment-telephone" placeholder="State" name="state" value="<?php echo $cstate?>" required>
                        </div>
                      </div>
                      <div class="col-sm-6" style="padding-left:0px">
                        <div class="form-group required">
                          <label for="input-city" class="control-label">Pin Code</label>
                          <input type="number" class="form-control" id="input-payment-email" placeholder="Pin Code" name="zipcode" value="<?php echo $cpincode ?>" required>
                        </div>
                      </div>
                      <div class="form-group required">
                        <label for="input-full-address" class="control-label">Full Address</label>
                        <textarea class="form-control" id="input-payment-fax" placeholder="Full Address" name="address1" required><?php if(!empty($cadd2))echo $cadd1." ".$cadd2;else echo $cadd1;   ?></textarea>
                      </div>
					  <div class="form-group required">
                        <label for="input-full-address" class="control-label">Pay By</label>
                        <select class="form-control" name="paymentMethod" required>
						<option value="">Select Payment Method</option>
						<option>COD</option>
						<option>Online</option>
						</select>
                      </div>
                      <div class="bottom-form">
                        <input type="submit" name="proceedAsGuest" value="Proceed" class="btn btn-default pull-right">
                      </div>
                      </fieldset>
                    </form>
                  </div>
                </div>
              </div>
            </div>
            <div class="col-sm-6 customer-login">
              <div class="well">
                <h2><i class="fa fa-file-text-o" aria-hidden="true"></i> Order Summary</h2>
			<table cellspacing="10" cellpadding="10">
			<?php
			$max=count($_SESSION['cart']);
			$total_amt=0; $tot_shipping_charge=0;
		    for($i=0;$i<$max;$i++){
			$pid=$_SESSION['cart'][$i]['productid'];
			$q=$_SESSION['cart'][$i]['qty'];
			$s=$_SESSION['cart'][$i]['psize'];
			$c=$_SESSION['cart'][$i]['pcolor'];
			$img=$_SESSION['cart'][$i]['img_name'];
			//$imgID=$_SESSION['cart'][$i]['imgID'];
			//$price=get_price($pid);
			$prc_exp = explode("*M*",$c);
		    $price = $prc_exp[0]; 
		
			$sql_Q=mysqli_query($con,"select * from product where id='$pid'");
			$rtt = mysqli_fetch_array($sql_Q);
			$path=json_decode($rtt['img']);
			$total_amt=$total_amt+$price*$q+$rtt['D_shipping'];
			$tot_shipping_charge=$tot_shipping_charge+$rtt['D_shipping'];
			?>
			
			<tr><td><a href="<?php echo $url?>product.php?pid=<?php echo $pid?>">
			<img width="70px" src="<?php echo $url?>image/product/<?php echo $path[0]; ?>" alt="<?php echo $rtt['name'] ?>" title="<?php echo $rtt['name'] ?>" class="img-thumbnail" /></a></td><td><?php echo $rtt['name'] ?><br>
					<?php if(!empty($s))echo $s; ?></td></tr>
			<tr><td>Unit price :</td><td><?php echo number_format($price)." <i class='fa fa-rupee'></i>" ?></td></tr>
			<tr><td>Total price :</td><td><?php echo $q."*".$price." = "; echo number_format($price*$q)." <i class='fa fa-rupee'></i>" ?></td></tr>
			<tr><td colspan="2" style="padding: 0;"><img src="<?php echo $url?>dot.png" style="background-repeat: repeat;background-size: cover;width: 100%;height: 5px;"></td></tr>
		     <?php }?>	
			 <tr><td>Shipping Price :</td><td><?php echo number_format($tot_shipping_charge)." <i class='fa fa-rupee'></i>" ?></td></tr>
			 <tr><td>Payable Amount :</td><td><?php echo $total_amt." <i class='fa fa-rupee'></i>"?></td></tr>		
			</table>
			<?php
			
 if(isset($_POST['proceedAsGuest'])){
 require('phpmailer/class.phpmailer.php');
			$_SESSION['amount']=$total_amt;
			$_SESSION['firstname']=$_POST['firstname'];
			$name=$_POST['firstname'];
			$_SESSION['email']=$_POST['email'];
			$email=$_POST['email'];
			$_SESSION['phone']=$_POST['phone'];
			$mobileno=$_POST['phone'];
			$_SESSION['productinfo']="e-shopping product";
			$_SESSION['address1']=$_POST['address1'];
			$address=$_POST['address1'];
			$_SESSION['city']=$_POST['city'];
			$city=$_POST['city'];
			$_SESSION['state']=$_POST['state'];
			$state=$_POST['state'];
			$_SESSION['zipcode']=$_POST['zipcode'];
			$pincode=$_POST['zipcode'];
		//count no order products	
		$orderCount = mysqli_query($con,"select * from cart");
		$_SESSION['totCount'] = mysqli_num_rows($orderCount)+1000;
			
		if($_POST['paymentMethod']=="COD"){
			    //insert order details 
				 $orderID="GN".$_SESSION['totCount'];
			     $orderDate = strtotime(date('d-m-Y'));
				 $user_id=date('dmyhis');
				$generalField= "reg_id='$user_id',order_date='$orderDate',code_id='$orderID',bll_name='$_POST[firstname]',bll_email='$_POST[email]',bll_mob='$_POST[phone]',	bll_addr='$_POST[address1]',bll_city='$_POST[city]',bll_pin='$_POST[zipcode]',bll_state='$_POST[state]',bll_country='India',orderBy='guestuser'";
				
		 $tableRow='';$finalAmt=0;		
		 for($i=0;$i<$max;$i++){
			$pid=$_SESSION['cart'][$i]['productid'];
			$q=$_SESSION['cart'][$i]['qty'];
			$s=$_SESSION['cart'][$i]['psize'];
			$c=$_SESSION['cart'][$i]['pcolor'];
			
				//select product details
				$slProduct=mysqli_query($con,"select * from product where id='$pid'") or die(mysqli_error());
				$productData=mysqli_fetch_array($slProduct);
				$productName=$productData['name'];
				$priceIS=$price;
				$eximg=json_decode($productData['img']);
				$venID=$productData['reg_id'];
				$shippingCharge=$productData['D_shipping'];
				$totAmountIs=($q*$priceIS)+$shippingCharge;
				$finalAmt=$finalAmt+$totAmountIs+$shippingCharge;
				$imageName='<img src="https://rkoyal.com/image/product/'.$eximg[0].'" style="height:100px"';
				
				$prc_exp = explode("*M*",$c);
		        $price = $prc_exp[0]; 
				
				//insert into cart
				$insertOrder=mysqli_query($con,"insert into cart set product_id='$pid',quantity='$q',Size='$s',Color='$c',vendor_ID='$venID',$generalField") or die(mysqli_error());
				
				
				//update stock from product table
				$restStock=$productData['stock']-$q;
				mysqli_query($con,"UPDATE product set stock='$restStock' where id='$pid'") or die(mysqli_error($con));
				
			    if(empty($tableRow)){
				$tableRow='<tr>
				<td>'.($i+1).'</td>
				<td>'.$imageName.'</td>
				<td>P'.$pid.'</td>
				<td>'.$productName." - ".$s.'</td>
				<td>'.$priceIS.'</td>
				<td>'.$q.'</td>
				<td>'.$shippingCharge.'</td>
				<td>'.$totAmountIs.'</td>
			  </tr>';
			  }else{
			    $tableRow='<tr>
				<td>'.($i+1).'</td>
				<td>'.$imageName.'</td>
				<td>P'.$pid.'</td>
				<td>'.$productName." - ".$s.'</td>
				<td>'.$priceIS.'</td>
				<td>'.$q.'</td>
				<td>'.$shippingCharge.'</td>
				<td>'.$totAmountIs.'</td>
			  </tr>';
			  }
			  
			}	
	
	$message = "Hi! $name,<br><br><p>Your Order Details:-</p><br>";
	
	$message .= '<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0" class="table">
  <tr><td colspan="10" style="background-color:#ff5c01; color:#FFFFFF; padding: 5px;"><b>Order ID : '.$orderID.'</b></td></tr>
  <tr>
    <th scope="col">S. No.</th>
	<th scope="col">Image</th>
    <th scope="col">PID</th>
    <th scope="col">Product Name</th>
	<th scope="col">Price</th>
    <th scope="col">Qty</th>
	<th scope="col">Shipping Charge</th>
	<th scope="col">Total Price</th>
  </tr>';
    $message.=$tableRow;
  
    $message .='<tr>
    <td colspan="10" style="text-align:right;padding-right: 113px;">Final Amount: '.$finalAmt.'</td>
  </tr>
</table>';

	$message .= "<p>Thanks for showing interest with us.</p><br>
	<br><strong>Thanks & Regards,<br>Support Team<br>www.rkoyal.com</strong><br>";
	
	$message1='A new order '.$orderID.' from  rkoyal.com<br><br>';
	$message1 .= '<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0" class="table">
<tr><td colspan="10" style="background-color:#ff5c01; color:#FFFFFF; padding: 5px;"><b>Order ID : '.$orderID.'</b></td></tr>
  <tr>
    <th scope="col">S. No.</th>
	<th scope="col">Image</th>
    <th scope="col">PID</th>
    <th scope="col">Product Name</th>
	<th scope="col">Price</th>
    <th scope="col">Quantity</th>
	<th scope="col">Shipping Charge</th>
	<th scope="col">Total Price</th>
  </tr>';
    $message1.=$tableRow;
    $message1 .='<tr>
    <td colspan="10" style="text-align:right;padding-right: 113px;">Final Amount: '.$finalAmt.'</td>
  </tr>
</table>';
    $message1.='<br>Customer Details:-<br><br>Name: '.$name."<br>Email ID: ".$email."<br>Mobile No: ".$mobileno."<br>Address: ".$address."<br>City: ".$city."<br>State: ".$state."<br>PIN Code: ".$pincode;
 //echo $message1;

$mail = new PHPMailer;
$mail->IsSMTP();                                      // Set mailer to use SMTP
$mail->Host = "rkoyal.com";                 // Specify main and backup server
//$mail->Host = "Give IP Address";                 // If the above does not work.
$mail->Port = 25;                                    // Set the SMTP port
$mail->SMTPAuth = true;                               // Enable SMTP authentication
$mail->Username = "order@rkoyal.com";                // SMTP username
$mail->Password = "admin@@987";                  // SMTP password
//$mail->SMTPSecure = "ssl";                            // Enable encryption, 'ssl' also accepted

$mail->From = 'order@rkoyal.com';

$mail->FromName = 'rkoyal';
$mail->AddAddress($email);  // Add a recipient

$mail->IsHTML(true); 
	
   //send mail to customer 
	$sendmail_customer = $mail->AddAddress($email,$name);
	$mail->Subject = "Order details on rkoyal.com"; 
	$mail->Body = $message;     
	$mail->Send(); 
	$mail->ClearAddresses(); 		
	
   //send mail to admin
	$sendmail_admin = $mail->AddAddress("order@rkoyal.com","rkoyal"); 
	$mail->Subject = "A new order from rkoyal.com";
	$mail->Body = $message1; 
	$mail->Send(); 
	
	unset($_SESSION['cart']);
		
		  echo "<script>alert('Your order has been submitted successfully!')</script>";
		  echo "<script>window.location='https://rkoyal.com/clear-cart.php'</script>";
	}else{
		 echo "<script>window.location='https://rkoyal.com/payment/pay.php'</script>";
		 }
		}
		
			?>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
<br/>
<br/>
<!-- //Main Container -->
<!-- Footer Container -->
<?php include "includes/footer.php" ?>
<!-- Include Libs & Plugins
	============================================ -->
<!-- Placed at the end of the document so the pages load faster -->
<script type="text/javascript" src="<?php echo $url?>js/jquery-2.2.4.min.js"></script>
<script type="text/javascript" src="<?php echo $url?>js/bootstrap.min.js"></script>
<script type="text/javascript" src="<?php echo $url?>js/owl-carousel/owl.carousel.js"></script>
<script type="text/javascript" src="<?php echo $url?>js/slick-slider/slick.js"></script>
<script type="text/javascript" src="<?php echo $url?>js/themejs/libs.js"></script>
<script type="text/javascript" src="<?php echo $url?>js/unveil/jquery.unveil.js"></script>
<script type="text/javascript" src="<?php echo $url?>js/countdown/jquery.countdown.min.js"></script>
<script type="text/javascript" src="<?php echo $url?>js/dcjqaccordion/jquery.dcjqaccordion.2.8.min.js"></script>
<script type="text/javascript" src="<?php echo $url?>js/datetimepicker/moment.js"></script>
<script type="text/javascript" src="<?php echo $url?>js/datetimepicker/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="<?php echo $url?>js/jquery-ui/jquery-ui.min.js"></script>
<!-- Theme files
	============================================ -->
<script type="text/javascript" src="<?php echo $url?>js/themejs/homepage.js"></script>
<script type="text/javascript" src="<?php echo $url?>js/themejs/so_megamenu.js"></script>
<script type="text/javascript" src="<?php echo $url?>js/themejs/addtocart.js"></script>
<script type="text/javascript" src="<?php echo $url?>js/themejs/application.js"></script>
<!-- 		 -->
</body>
</html>