Revonzy Mini Shell

Revonzy Mini Shell

Şuanki Dizin: /home/wwwdreamtechnolo/public_html/sattvicyug.com/
Dosya Yükle :
Şuanki Dosya : /home/wwwdreamtechnolo/public_html/sattvicyug.com/checkout-complete.php

<?php
	ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

	require_once("lib/functions.php");
	$db = new login_function();
	$current_session = session_id(); 
	
	$order_total_amount 	= 	$db->fetch_total_price_by_session_id($current_session);
	$total_amount = $order_total_amount;
		        
	/**********************Charges Calculate*************************************/
	$delivery_charges   =   20;
    $delivery_charges_text   =   "";
    $min_order_amount   =   100;
    $total_of_selling = $total_amount;
    if($total_of_selling >= $min_order_amount)
    {
        if($total_of_selling >= 500)
        {
            $delivery_charges = 0;
        }
        
        //Add delivery charges in selling bill
        $final_total    =   $total_of_selling + $delivery_charges;
        
        $total_amount = $final_total;
    }
    else
    {
        header("Location:cart.php");
    }
    /***********************************************************/
    
    if($total_amount == 0)
	{
		header("Location:cart.php");
	}
	
	$admin_email    =   "sattvic@gmail.com";
	// $email          =   "";
	$full_name="";
	$address1="";
	$user_email="";
	
	if (isset($_GET['mobile_nu'])) {
    $contact_no1 = $_GET['mobile_nu'];
    
	} else {
	    $contact_no1 = ''; 
	}

	$details = $db->fetch_user_data_by_email_id($contact_no1);
	// print_r($details);
	if(!empty($details))
	{
		$id 		= $details[0];
		$full_name	= $details[1];
		$address1 	= $details[2];
		$contact_no	= $details[3];
		$user_email	= $details[4];
		$pin		= $details[5];
		$latitude	= $details[6];
		$longitude	= $details[7];
	}

	$flag 				= 0;
	$success_msg 		= 0;
	$email_id_error 	= ""; 
	$fetch_total_amount = 0;
	$contact_no_error ="";
	$contact_no = "";

	$_SESSION['show_total_amount']=$total_amount;

	if(isset($_POST['checkout_btn']))
	{
		//$total_amount	= $_POST['total_amount'];
		$full_name 		= $_POST['full_name'];
		$address 		= $_POST['address'];
		$contact_no 	= $_POST['contact_no'];
		$user_email 	= "";
		$password="123";
		$confirm_password="123";
		$gender="";
		$dob="";
		$wife_name="";
		$wife_dob="";
		$anniversary_date="";
		$child_name="";
		$child_dob="";
		$status="";
		$pin 		= $_POST['pin'];
		$latitude 	= $_POST['latitude'];
		$longitude 	= $_POST['longitude'];


		if(!is_numeric($contact_no))
		{
			$contact_no_error = "Please enter numeric value";
			$flag = 1;
		}
		else if(strlen($contact_no)<10 OR strlen($contact_no)>10)
		{
			$contact_no_error	=	"Please enter valid 10 digit contact no";
			$flag				=	1;
		}
	
		if($flag == 0)
		{
			$transaction_id = $db->add_record_to_checkout($full_name, $address, $contact_no, $user_email, $total_amount,$latitude,$longitude);
			  
			$iexist = $db->get_exist_code_for_update($contact_no);

			if ($iexist == "") 
			{
			    if (!$db->add_user($full_name, $address, $contact_no, $user_email, $password, $confirm_password, $gender, $dob, $wife_name, $wife_dob, $anniversary_date, $child_name, $child_dob,$pin,$latitude,$longitude)) {
			        echo "<script>alert('insert')</script>";
			        
			        
			    $whatsapp_message = "*Sattvicyug* \n\n*Dear $full_name* \n\n"
                . "Thank you for Choose Us.\n\n"
                . "Welcome Message. \n"
                . "*Link:* https://sattvicyug.com/index.php \n\n"
                . "*Contact*\n"
                . "*Sattvicyug*\n"
                . "*Phone Number*  :  7447847000 \n"
                . "*Address*       :  solapur \n";
    
                $url = "http://web.cloudwhatsapp.com/wapp/api/send?apikey=bbf183d4fb3d4be7a8cdfd951fda6be1&mobile=$contact_no&msg=" . urlencode($whatsapp_message);
                
                $response = file_get_contents($url);
                
                // echo $response; 

			    }
			} else {
			    if (!$db->user_update_details($full_name, $address, $contact_no, $user_email,$pin,$latitude,$longitude)) {
			        
			        echo "<script>alert('insert exist')</script>";
			            $whatsapp_message = "*Sattvicyug* \n\n*Dear $full_name* \n\n"
                        . "Thank you for Choose Us.\n\n"
                        . "Welcome Message. \n"
                        . "*Link:* https://sattvicyug.com/index.php \n\n"
                        . "*Contact*\n"
                        . "*Sattvicyug*\n"
                        . "*Phone Number*  :  7447847000 \n"
                        . "*Address*       :  solapur \n";
            
                        $url = "http://web.cloudwhatsapp.com/wapp/api/send?apikey=bbf183d4fb3d4be7a8cdfd951fda6be1&mobile=$contact_no&msg=" . urlencode($whatsapp_message);
                        
                        $response = file_get_contents($url);
                        
                        // echo $response; 
			    }
			}



			$product_id = $db->fetch_all_temp_cart_data($current_session);
			if(!empty($product_id))
			{
				$counter = 0;
				foreach($product_id as $record)
				{
					$t_id		=	$product_id[$counter][0];
					$s_id		=	$product_id[$counter][1];
					$p_id		=	$product_id[$counter][2];
					$qty		=	$product_id[$counter][3];
					$actual_price1		=	$product_id[$counter][4];
					$date		=	$product_id[$counter][5];
					$time		=	$product_id[$counter][6];
					$selling_price1		=	$product_id[$counter][7];
					$grams		=	$product_id[$counter][8];
					$unit		=	$product_id[$counter][9];

					$cart_data 	= $db->fetch_product_for_checklist($p_id);
					if(!empty($cart_data))
					{
							$prod_id		=	$cart_data[0];
							$added_by		=	$cart_data[1];
							$product_name	=	$cart_data[2];
							$tags			=	$cart_data[3];
							$description	=	$cart_data[4];
							$actual_price	=	$cart_data[5];
							$selling_price	=	$cart_data[6];
					}
					$db->add_items_to_checkout_list($transaction_id,$added_by,$prod_id,$qty,$selling_price1,$actual_price1,$grams,$unit);

					$counter ++;
				}
				

			}
			$db->delete_product_from_temp_cart_by_product_id($current_session);	    
			unset($_SESSION['return_to_cart_reg']);
			header("Location:order-success.php");
			$success_msg = 1;
		}		
	}
?>
<?php
	require_once("header.php");	
?>

<style>
label
{
    font-family:arial;
    /*font-weight:bold !important;*/
}
    table tr td
    {
        padding-top:5px;
        padding-bottom:5px;
        font-weight:bold;
        font-size:16px;
    }
    .txt_val
    {
        font-size:14px !important;
        border:1px solid #DFDFDF;
        border-radius:4px;
        width:100%;
        font-weight:bold;
        padding:12px;
        color:#cf5ba3;
        margin-bottom:9px;
        font-family:arial;
    }
    .verifybutton
    {
        height:38px;
        width:15%;
        font-size:12px;
        margin-left:5px;
        border:none;
        background-color:#DB0D58;
        color:white;
    }
    .form_container
    {
        width:500px;
        margin:auto;
        
    }
    @media only screen and (max-width: 700px) {
      .form_container{
        width:90%;
      }
    }
</style>
<body>
    
    <br />
    
    <div class="spec" style="margin-bottom:1em;">
		<h3>Order Your Items</h3>
	
	<div class="ser-t">
		<b></b>
		<span><i></i></span>
		<b class="line"></b>
	</div>
	</div>
    
<div>
<div id="wrapper" style="background-color:#F6F6F4;">
    <form action="checkout-complete.php" method="POST" name="register_mail">
            <div class="form_container">
				<?php
					if($success_msg == 1)
					{
				?>
					<div class="alert alert-success">
						Order Placed Successfully.
					</div>
				<?php
					}
				?>
		<br />
			    <!--<label class="form_title_label">Total Amount : </label>-->
			    <!--<span style="color:green;padding:5px;border:none;font-size:17px; color:#DB0D58;"><?php echo $total_amount; ?>/-</span>-->
			    <!--<input type="hidden" class="txt_val" name="total_amount" value="<?php echo $total_amount; ?>" required readonly>-->

       <!--         <br />-->
       <!--         <br />-->

    			<label class="form_title_label">Full Name : </label><br />
    			<input type="text" placeholder="Full Name" class="txt_val" name="full_name" value="<?php echo $full_name; ?>" required></td>
			       
                <br />
                <?php
                    if($contact_no=="")
                    {
                        $contact_no = $contact_no1;
                    }
                ?>
    			<label class="form_title_label">Contact No : </label>
    			<input type="number" placeholder="Enter Contact Number" class="txt_val" name="contact_no" value="<?php echo $contact_no; ?>" required>
            
            
        		<br />

    			<label class="form_title_label">Delivery Address</label><label style="font-size:12px;">(Enter The Full And Correct Address For Proper Delivery) :</label>
    			<textarea  placeholder="Enter Shipping Address" name="address" class="txt_val" required><?php echo $address1; ?></textarea>
            
                <br />

                <label class="form_title_label">Enter City PinCode </label>
                <br />
                <input type="number" placeholder="Enter Pin Code" class="txt_val" id="pin" value="<?php echo $pin; ?>" name="pin" required style="width:60%;" maxlength="6" />
                <button type="button" id="verifyPinButton" onclick="verifyPinCode()" class="verifybutton" style="width:35%; font-size:14px;">Check Availability</button>
                
                <br />
            
                <div id="pinValidationMessage"></div>
                <div id="message" style="color: red; display: none; margin-top: 10px;"></div>

	    	    <!-- Latitude and Longitude fields hidden initially -->
                <br />
                
                <!-------Google Map Location------------>
                
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">            
    <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCJZ3pJYfmgi5rITkg8B29vbfUOpv5labY&callback=initMap" async defer></script>
    <style>
        #map {
            height: 400px;
            width: 100%;
        }
        .info {
            margin-top: 20px;
        }
    </style>
    
    <h4 style="text-align:center; line-height:25px; color:#079744; font-weight:bold;">Select Delivery Location <br /> <label style="color:orangered; font-size:14px;">Click on map to locate pointer, Move the pointer to your exact delivery location.</label></h4>
    
    <center><button onclick="getCurrentLocation()" style="background-color:white; border:1px solid #DFDFDF; padding:7px;"> <i class="fa fa-map-marker" style="font-size:16px;color:red"></i> Focus My Current Location</button></center>
    <br />
    <div id="map"></div>
    <div class="info">
            <label>Latitude: <input type="text" id="latitude" name="latitude" readonly required></label><br><br>
            <label>Longitude: <input type="text" id="longitude" name="longitude" readonly required></label><br><br>
            <!--<button type="button" onclick="saveLocation()">Submit</button>-->
        <div id="response"></div>
    </div>

    <script>
        let map;
        let marker;

        function initMap() {
            const defaultLocation = { lat: 17.6599, lng: 75.9064 }; // Default location (Solapur, India)
            map = new google.maps.Map(document.getElementById("map"), {
                zoom: 13,
                center: defaultLocation,
            });

            // Add click event to place marker
            map.addListener("click", (event) => {
                placeMarker(event.latLng);
            });
        }

        function placeMarker(location) {
            if (marker) {
                marker.setPosition(location);
            } else {
                marker = new google.maps.Marker({
                    position: location,
                    map: map,
                });
            }

            // Set latitude and longitude in input fields
            document.getElementById("latitude").value = location.lat();
            document.getElementById("longitude").value = location.lng();
        }

        function getCurrentLocation() {
            if (navigator.geolocation) {
                navigator.geolocation.getCurrentPosition(
                    (position) => {
                        const currentLocation = {
                            lat: position.coords.latitude,
                            lng: position.coords.longitude,
                        };

                        // Center map on current location and place marker
                        map.setCenter(currentLocation);
                        placeMarker(currentLocation);
                    },
                    (error) => {
                        alert("Error getting location: " + error.message);
                    }
                );
            } else {
                alert("Geolocation is not supported by this browser.");
            }
            event.preventDefault();
        }

        function saveLocation() {
            const latitude = document.getElementById("latitude").value;
            const longitude = document.getElementById("longitude").value;

            if (latitude && longitude) {
                // Send data to PHP via AJAX
                const xhr = new XMLHttpRequest();
                xhr.open("POST", "save_location.php", true);
                xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
                xhr.onreadystatechange = function () {
                    if (xhr.readyState === 4 && xhr.status === 200) {
                        document.getElementById("response").innerHTML = xhr.responseText;
                    }
                };
                xhr.send(`latitude=${latitude}&longitude=${longitude}`);
            } else {
                alert("Please select a location on the map.");
            }
        }
    </script>

                <!-------Google Map Location------------>
                
                
                <!--<label class="form_title_label">Enter Latitude </label><br />-->
                <!--<input type="number" placeholder="Enter Latitude" class="txt_val" value="<?php echo $latitude; ?>" name="latitude" style="width:220px;padding:5px;" required>-->
    
                <!--<br />-->
                <!--<br />-->
                
                <!--<label class="form_title_label">Enter Longitude </label><br />-->
                <!--<input type="number" placeholder="Enter Longitude" class="txt_val" name="longitude" style="width:220px;padding:5px;" value="<?php echo $longitude; ?>" required>-->
    
                <br />
                <br />
                
                <center><input type="submit" name="checkout_btn" onclick="check_location_fetched()" id="place_order_btn" value="Place My Order" class="btn_new" style="border:none;"></center>
	</div>
	
</form>	
</div>

 
    
<br /><br />
</center>

<hr style="border-bottom:1px solid #DFDFDF" />
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
    function check_location_fetched()
    {
        const latitude = document.getElementById("latitude").value;
        const longitude = document.getElementById("longitude").value;
// alert(latitude + "=" + longitude);
        if(latitude=="" || longitude=="")
        {
            event.preventDefault();
            alert("Please select location on google map");
        }
    }
</script>
<script>
function showCoordinates() {
    $('#latitude-row').show();
    $('#longitude-row').show();
    $('#Register').show();
}

function verifyPinCode() {
    var pin = document.getElementById("pin").value;
    var messageDiv = document.getElementById("message");

    if (pin === "") {
        messageDiv.style.display = "block";
        messageDiv.innerHTML = "Please enter the pin code first.";
         $('#latitude-row').hide();
                    $('#longitude-row').hide();
                    
                    $('#Register').hide();
                    $('#pinValidationMessage').text('').css('color', '');
        
    } else {
        messageDiv.style.display = "none";

        $.ajax({
            type: "POST",
            url: "api/fetch_pin_code.php",
            data: { pin: pin },
            success: function(response) {
                var result = JSON.parse(response);
                if (result.valid) {
                        $('#latitude-row').show();
                        $('#longitude-row').show();
                        $('#Register').show();
                    $('#pinValidationMessage').text('Delivery Available').css('color', 'green');
                    // showCoordinates();
                } else {
                    $('#pinValidationMessage').text('Delivery Not Available').css('color', 'red');
                    $('#latitude-row').hide();
                    $('#longitude-row').hide();
                    
                    $('#Register').hide();
                }
            },
            error: function(jqXHR, textStatus, errorThrown) {
                toastr.error("An error occurred while verifying the PIN code. Please try again.", "Error");
                $('#latitude-row').hide();
                $('#longitude-row').hide();
                $('#Register').parent().hide();
            }
        });
    }
}

</script>
<?php
	require_once("footer.php");
?>
</body></html>

EliteHackz.ORG
Revonzy Mini Shell
root@revonzy.com

Linux 65-254-81-4.cprapid.com 5.14.0-284.11.1.el9_2.x86_64 #1 SMP PREEMPT_DYNAMIC Tue May 9 05:49:00 EDT 2023 x86_64
Apache
65.254.81.4