<?php






ini_set('session.gc_maxlifetime', 30*60);

session_start();

include '../../includes/config.php';



$U_ID = $_SESSION['U_Log'];




if (!$_SESSION['U_Log'])
echo '<script language="JavaScript">
 document.location="../Users-Sign-In.php";
</script>';







$sql3 = mysqli_query($dbConn,"select * from users where ID='$U_ID'");
					$row3 = mysqli_fetch_array($sql3);
$Name=$row3['Name'];
$Phone_Number=$row3['Phone_Number'];
$Gender=$row3['Gender'];
$Photo=$row3['Photo'];
$lon=$row3['Longitude'];
$lat=$row3['Latitude'];
$Total_Rates=$row3['Total_Rates'];






$sql55 = mysqli_query($dbConn,"select * from trips_users where User_ID='$U_ID' AND Status='Pending'");
$sql555 = mysqli_query($dbConn,"select * from trips_users where User_ID='$U_ID' AND Status='Pickedup'");
$sql5555 = mysqli_query($dbConn,"select * from trips_users where User_ID='$U_ID' AND Status='Dropoff' AND Driver_Rate_Status=''");
if (mysqli_num_rows($sql55)>0){
	
$row55 = mysqli_fetch_array($sql55);	

$Trip_ID = $row55['Trip_ID'];
$Private_Status = $row55['Private_Status'];

$sql66 = mysqli_query($dbConn,"select * from trips where ID='$Trip_ID'");
$row66 = mysqli_fetch_array($sql66);
$Trip_Type = $row66['Trip_Type'];
$Gender_Type = $row66['Gender_Type'];
$Max_Limit_Riders = $row66['Max_Limit_Riders'];


$Driver_ID = $row66['Driver_ID'];
$Total_Riders = $row55['Total_Riders'];
$From_Longitude = $row55['From_Longitude'];
$From_Latitude = $row55['From_Latitude'];
$To_Longitude = $row55['To_Longitude'];
$To_Latitude = $row55['To_Latitude'];
$From_Location = $row55['From_Location'];
$To_Location = $row55['To_Location'];
$Total_KM_Distance = $row55['Total_KM_Distance'];
$Total_Price = $row55['Total_Price'];
$Total_Price_All_Riders = $row55['Total_Price_All_Riders'];
$Payment_Type = $row55['Payment_Type'];
$Spot_Number = $row55['Spot_Number'];




if ($Gender_Type=='Mix' && $Private_Status=='False'){
	

echo '<script language="JavaScript">
 document.location="shared-mix-gender/waiting-request-accepted.php?U_ID='.$U_ID.'&Trip_ID='.$Trip_ID.'&Driver_ID='.$Driver_ID.'&Total_Riders='.$Total_Riders.'&From_Longitude='.$From_Longitude.'&From_Latitude='.$From_Latitude.'&To_Longitude='.$To_Longitude.'&To_Latitude='.$To_Latitude.'&From_Location='.$From_Location.'&To_Location='.$To_Location.'&Total_KM_Distance='.$Total_KM_Distance.'&Total_Price='.$Total_Price.'&Total_Price_All_Riders='.$Total_Price_All_Riders.'&Payment_Type='.$Payment_Type.'&Spot_Number='.$Spot_Number.'&Change=False";
</script>';		
	
	
}elseif ($Gender_Type=='Mix' && $Private_Status=='True'){
	
	echo '<script language="JavaScript">
 document.location="shared-same-gender/waiting-request-accepted-2.php?Max_Limit_Riders='.$Max_Limit_Riders.'&U_ID='.$U_ID.'&Trip_ID='.$Trip_ID.'&Driver_ID='.$Driver_ID.'&Total_Riders='.$Total_Riders.'&From_Longitude='.$From_Longitude.'&From_Latitude='.$From_Latitude.'&To_Longitude='.$To_Longitude.'&To_Latitude='.$To_Latitude.'&From_Location='.$From_Location.'&To_Location='.$To_Location.'&Total_KM_Distance='.$Total_KM_Distance.'&Total_Price='.$Total_Price.'&Total_Price_All_Riders='.$Total_Price_All_Riders.'&Payment_Type='.$Payment_Type.'&Spot_Number='.$Spot_Number.'&Change=False";
</script>';	
	
	
}elseif ($Gender_Type!='Mix' && $Private_Status=='False'){
	
	echo '<script language="JavaScript">
 document.location="shared-same-gender/waiting-request-accepted.php?U_ID='.$U_ID.'&Trip_ID='.$Trip_ID.'&Driver_ID='.$Driver_ID.'&Total_Riders='.$Total_Riders.'&From_Longitude='.$From_Longitude.'&From_Latitude='.$From_Latitude.'&To_Longitude='.$To_Longitude.'&To_Latitude='.$To_Latitude.'&From_Location='.$From_Location.'&To_Location='.$To_Location.'&Total_KM_Distance='.$Total_KM_Distance.'&Total_Price='.$Total_Price.'&Total_Price_All_Riders='.$Total_Price_All_Riders.'&Payment_Type='.$Payment_Type.'&Spot_Number='.$Spot_Number.'&Change=False";
</script>';	
	
	
}elseif ($Gender_Type!='Mix' && $Private_Status=='True'){
	
	echo '<script language="JavaScript">
 document.location="shared-same-gender/waiting-request-accepted-2.php?Max_Limit_Riders='.$Max_Limit_Riders.'&U_ID='.$U_ID.'&Trip_ID='.$Trip_ID.'&Driver_ID='.$Driver_ID.'&Total_Riders='.$Total_Riders.'&From_Longitude='.$From_Longitude.'&From_Latitude='.$From_Latitude.'&To_Longitude='.$To_Longitude.'&To_Latitude='.$To_Latitude.'&From_Location='.$From_Location.'&To_Location='.$To_Location.'&Total_KM_Distance='.$Total_KM_Distance.'&Total_Price='.$Total_Price.'&Total_Price_All_Riders='.$Total_Price_All_Riders.'&Payment_Type='.$Payment_Type.'&Spot_Number='.$Spot_Number.'&Change=False";
</script>';	
	
	
}
	
	
	
}




if (mysqli_num_rows($sql555)>0){



$row555 = mysqli_fetch_array($sql555);	

$TU_ID = $row555['ID'];
$Trip_ID = $row555['Trip_ID'];
$Private_Status = $row55['Private_Status'];

$sql66 = mysqli_query($dbConn,"select * from trips where ID='$Trip_ID'");
$row66 = mysqli_fetch_array($sql66);
$Trip_Type = $row66['Trip_Type'];
$Gender_Type = $row66['Gender_Type'];
$Max_Limit_Riders = $row66['Max_Limit_Riders'];



$Driver_ID = $row66['Driver_ID'];
$Total_Riders = $row555['Total_Riders'];
$From_Longitude = $row555['From_Longitude'];
$From_Latitude = $row555['From_Latitude'];
$To_Longitude = $row555['To_Longitude'];
$To_Latitude = $row555['To_Latitude'];
$From_Location = $row555['From_Location'];
$To_Location = $row555['To_Location'];
$Total_KM_Distance = $row555['Total_KM_Distance'];
$Total_Price = $row555['Total_Price'];
$Total_Price_All_Riders = $row555['Total_Price_All_Riders'];
$Payment_Type = $row555['Payment_Type'];
$Spot_Number = $row555['Spot_Number'];



if ($Gender_Type=='Mix' && $Private_Status=='True'){
	

echo '<script language="JavaScript">
 document.location="shared-mix-gender/shared-mix-gender-77.php?Spot_Number='.$Spot_Number.'&Trip_ID='.$Trip_ID.'&Driver_ID='.$Driver_ID.'&U_ID='.$U_ID.'&TU_ID='.$TU_ID.'";
</script>';		
	
	
}elseif ($Gender_Type=='Mix' && $Private_Status=='False'){
	
	echo '<script language="JavaScript">
 document.location="shared-mix-gender/shared-mix-gender-7.php?Spot_Number='.$Spot_Number.'&Trip_ID='.$Trip_ID.'&Driver_ID='.$Driver_ID.'&U_ID='.$U_ID.'&TU_ID='.$TU_ID.'";
</script>';	
	
	
}elseif ($Gender_Type!='Mix' && $Private_Status=='True'){
	
	echo '<script language="JavaScript">
 document.location="shared-same-gender/shared-same-gender-77.php?Spot_Number='.$Spot_Number.'&Trip_ID='.$Trip_ID.'&Driver_ID='.$Driver_ID.'&U_ID='.$U_ID.'&TU_ID='.$TU_ID.'";
</script>';	
	
	
}elseif ($Gender_Type!='Mix' && $Private_Status=='False'){
	
	echo '<script language="JavaScript">
 document.location="shared-same-gender/shared-same-gender-7.php?Spot_Number='.$Spot_Number.'&Trip_ID='.$Trip_ID.'&Driver_ID='.$Driver_ID.'&U_ID='.$U_ID.'&TU_ID='.$TU_ID.'";
</script>';	
	
	
}


}











if (mysqli_num_rows($sql5555)>0){



$row5555 = mysqli_fetch_array($sql5555);	

$TU_ID = $row5555['ID'];
$Trip_ID = $row5555['Trip_ID'];
$Private_Status = $row5555['Private_Status'];

$sql666 = mysqli_query($dbConn,"select * from trips where ID='$Trip_ID'");
$row666 = mysqli_fetch_array($sql666);
$Trip_Type = $row666['Trip_Type'];
$Gender_Type = $row666['Gender_Type'];
$Max_Limit_Riders = $row666['Max_Limit_Riders'];



$Driver_ID = $row666['Driver_ID'];
$Total_Riders = $row5555['Total_Riders'];
$From_Longitude = $row5555['From_Longitude'];
$From_Latitude = $row5555['From_Latitude'];
$To_Longitude = $row5555['To_Longitude'];
$To_Latitude = $row5555['To_Latitude'];
$From_Location = $row5555['From_Location'];
$To_Location = $row5555['To_Location'];
$Total_KM_Distance = $row5555['Total_KM_Distance'];
$Total_Price = $row5555['Total_Price'];
$Total_Price_All_Riders = $row5555['Total_Price_All_Riders'];
$Payment_Type = $row5555['Payment_Type'];
$Spot_Number = $row5555['Spot_Number'];



if ($Gender_Type=='Mix' && $Private_Status=='True'){
	

echo '<script language="JavaScript">
 document.location="shared-mix-gender/shared-mix-gender-88.php?Spot_Number='.$Spot_Number.'&Trip_ID='.$Trip_ID.'&Driver_ID='.$Driver_ID.'&U_ID='.$U_ID.'&TU_ID='.$TU_ID.'";
</script>';		
	
	
}elseif ($Gender_Type=='Mix' && $Private_Status=='False'){
	
	echo '<script language="JavaScript">
 document.location="shared-mix-gender/shared-mix-gender-8.php?Spot_Number='.$Spot_Number.'&Trip_ID='.$Trip_ID.'&Driver_ID='.$Driver_ID.'&U_ID='.$U_ID.'&TU_ID='.$TU_ID.'";
</script>';	
	
	
}elseif ($Gender_Type!='Mix' && $Private_Status=='True'){
	
	echo '<script language="JavaScript">
 document.location="shared-same-gender/shared-same-gender-88.php?Spot_Number='.$Spot_Number.'&Trip_ID='.$Trip_ID.'&Driver_ID='.$Driver_ID.'&U_ID='.$U_ID.'&TU_ID='.$TU_ID.'";
</script>';	
	
	
}elseif ($Gender_Type!='Mix' && $Private_Status=='False'){
	
	echo '<script language="JavaScript">
 document.location="shared-same-gender/shared-same-gender-8.php?Spot_Number='.$Spot_Number.'&Trip_ID='.$Trip_ID.'&Driver_ID='.$Driver_ID.'&U_ID='.$U_ID.'&TU_ID='.$TU_ID.'";
</script>';	
	
	
}


}



//////////////////////////////////////////////////////////////////////////////////////










$sql55 = mysqli_query($dbConn,"select * from trips_privates where User_ID='$U_ID' AND Status='Pending'");
$sql555 = mysqli_query($dbConn,"select * from trips_privates where User_ID='$U_ID' AND Status='Pickedup'");
$sql5555 = mysqli_query($dbConn,"select * from trips_privates where User_ID='$U_ID' AND Status='Dropoff' AND Driver_Rate_Status=''");
if (mysqli_num_rows($sql55)>0){
	
$row55 = mysqli_fetch_array($sql55);	

$TP_ID = $row55['ID'];

$sql66 = mysqli_query($dbConn,"select * from trips_privates where ID='$TP_ID'");
$row66 = mysqli_fetch_array($sql66);
$Trip_Type = $row66['Trip_Type'];
$Gender = $row66['Gender'];


$Total_Riders = $row55['Total_Riders'];
$From_Longitude = $row55['From_Longitude'];
$From_Latitude = $row55['From_Latitude'];
$To_Longitude = $row55['To_Longitude'];
$To_Latitude = $row55['To_Latitude'];
$From_Location = $row55['From_Location'];
$To_Location = $row55['To_Location'];
$Total_KM_Distance = $row55['Total_KM_Distance'];
$Total_Price = $row55['Total_Price'];
$Payment_Type = $row55['Payment_Type'];




if ($Gender=='Mix'){
	

echo '<script language="JavaScript">
 document.location="private-mix-gender/private-same-gender-4.php?U_ID='.$U_ID.'&TP_ID='.$TP_ID.'&Total_Riders='.$Total_Riders.'&From_Longitude='.$From_Longitude.'&From_Latitude='.$From_Latitude.'&To_Longitude='.$To_Longitude.'&To_Latitude='.$To_Latitude.'&From_Location='.$From_Location.'&To_Location='.$To_Location.'&Total_KM_Distance='.$Total_KM_Distance.'&Total_Price='.$Total_Price.'&Payment_Type='.$Payment_Type.'";
</script>';		
	
	
}else{
	
	echo '<script language="JavaScript">
 document.location="private-same-gender/private-same-gender-4.php?U_ID='.$U_ID.'&TP_ID='.$TP_ID.'&Total_Riders='.$Total_Riders.'&From_Longitude='.$From_Longitude.'&From_Latitude='.$From_Latitude.'&To_Longitude='.$To_Longitude.'&To_Latitude='.$To_Latitude.'&From_Location='.$From_Location.'&To_Location='.$To_Location.'&Total_KM_Distance='.$Total_KM_Distance.'&Total_Price='.$Total_Price.'&Payment_Type='.$Payment_Type.'";
</script>';	
	
	
}
	
	
	
}




if (mysqli_num_rows($sql555)>0){



$row555 = mysqli_fetch_array($sql555);	

$TP_ID = $row555['ID'];

$sql66 = mysqli_query($dbConn,"select * from trips_privates where ID='$TP_ID'");
$row66 = mysqli_fetch_array($sql66);
$Gender = $row66['Gender'];



$Driver_ID = $row66['Driver_ID'];
$Total_Riders = $row555['Total_Riders'];
$From_Longitude = $row555['From_Longitude'];
$From_Latitude = $row555['From_Latitude'];
$To_Longitude = $row555['To_Longitude'];
$To_Latitude = $row555['To_Latitude'];
$From_Location = $row555['From_Location'];
$To_Location = $row555['To_Location'];
$Total_KM_Distance = $row555['Total_KM_Distance'];
$Total_Price = $row555['Total_Price'];
$Payment_Type = $row555['Payment_Type'];



if ($Gender=='Mix'){
	

echo '<script language="JavaScript">
 document.location="private-mix-gender/private-mix-gender-7.php?TP_ID='.$TP_ID.'&Driver_ID='.$Driver_ID.'&U_ID='.$U_ID.'";
</script>';		
	
	
}else{
	
	echo '<script language="JavaScript">
 document.location="private-same-gender/private-same-gender-7.php?TP_ID='.$TP_ID.'&Driver_ID='.$Driver_ID.'&U_ID='.$U_ID.'";
</script>';	
	
	
}


}











if (mysqli_num_rows($sql5555)>0){



$row5555 = mysqli_fetch_array($sql5555);	

$TP_ID = $row5555['ID'];

$sql666 = mysqli_query($dbConn,"select * from trips_privates where ID='$TP_ID'");
$row666 = mysqli_fetch_array($sql666);
$Gender = $row666['Gender'];



$Driver_ID = $row666['Driver_ID'];
$Total_Riders = $row5555['Total_Riders'];
$From_Longitude = $row5555['From_Longitude'];
$From_Latitude = $row5555['From_Latitude'];
$To_Longitude = $row5555['To_Longitude'];
$To_Latitude = $row5555['To_Latitude'];
$From_Location = $row5555['From_Location'];
$To_Location = $row5555['To_Location'];
$Total_KM_Distance = $row5555['Total_KM_Distance'];
$Total_Price = $row5555['Total_Price'];
$Payment_Type = $row5555['Payment_Type'];



if ($Gender=='Mix'){
	

echo '<script language="JavaScript">
 document.location="private-mix-gender/private-mix-gender-8.php?TP_ID='.$TP_ID.'&Driver_ID='.$Driver_ID.'&U_ID='.$U_ID.'";
</script>';		
	
	
}else{
	
	echo '<script language="JavaScript">
 document.location="private-same-gender/private-same-gender-8.php?TP_ID='.$TP_ID.'&Driver_ID='.$Driver_ID.'&U_ID='.$U_ID.'";
</script>';	
	
	
}


}




?>

<!doctype html>
<html lang="en">
<head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="../../css/bootstrap.min.css">
    <!-- FontAwesome -->
    <link rel="stylesheet" href="../../css/fontawesome.css">
    <!-- Main Style -->
    <link rel="stylesheet" href="../../css/styles.css">
    <title>Select your trip type</title>
	
	    <link rel="shortcut icon" href="../../images/icon.ico"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0,user-scalable=0"/>


	<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDemEmJPVUC9PoCzTLZLZdhwJLt5fu5XUc&libraries=places"></script>





	<style>
@font-face {
   font-family: myFirstFont;
   src: url(../../fonts/Arial-Rounded-MT-Bold-Regular.ttf);
   font-size:8px;
}

body {
   font-family: myFirstFont !important;
}


@font-face {
   font-family: myFirstFont2;
   src: url(../../fonts/GE-SS-Two-Bold.otf);
   font-size:8px;
}





</style>















</head>
<body  style="height:auto !important" >


<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <script type="text/javascript">
        function getLocation() {
            if (navigator.geolocation) {
                navigator.geolocation.getCurrentPosition(function(position) {
                    var latitude = position.coords.latitude;
                    var longitude = position.coords.longitude;

                    // Send this to your PHP script via AJAX or other means
                    sendDataToServer(latitude, longitude);
                });
            } else {
                alert("Geolocation is not supported by this browser.");
            }
        }

        function sendDataToServer(latitude, longitude) {
            // Using fetch API to send data to PHP
            fetch('update-my-location-1.php?U_ID=<?php echo $U_ID; ?>	', {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json',
                },
                body: JSON.stringify({
                    latitude: latitude,
                    longitude: longitude
                })
            })
            .then(response => response.json())
            .then(data => {
                console.log('Success:', data);
            })
            .catch((error) => {
                console.error('Error:', error);
            });
        }

        // Keep updating every 5 seconds
        setInterval(getLocation, 5000);
    </script>


	



<!--Loading Container Start-->
<div id="load"  class="loading-overlay display-flex flex-column justify-content-center align-items-center">
    <div class="primary-color font-28 fas fa-spinner fa-spin"></div>
</div>
<!--Loading Container End-->


<div class="row h-100">
    <div class="col-xs-12 col-sm-12 remaining-height">

       
		
		
		
		 <!--Page Title & Icons Start-->
        <div class="header-icons-container text-center">
           
                <span class="float-left menu-open closed">
                    <img src="../../icons/menu.svg" alt="Menu Hamburger Icon">
            </span>
            <span class="title" ><br>Select your trip type</span>
            <a href="#" >
                <span class="float-right" style="margin-top:-27px !important">
                    <img src="../../images/icon.png" alt="Logo" width="14px" height="20px">
                </span>
            </a>
        </div>
        <!--Page Title & Icons End-->

       
  
     
				<br><br><br><br><br><br><br>
				
		   
        <div class="col-xs-12 col-sm-12 margin-bottom-up">
            <div class="text-center mb-5">
				
                <img src="../../images/banner.png" width="75%" style="border-radius: 10%;" alt="Main Logo">
				
            </div>

            <!--Sign Up Buttons Container Start-->
            <div class="sign-up-btn-container" style="margin-bottom:-25px">
                <!--<a class="btn btn-center width-100 display-block btn-secondary  btn-padding-1">Sign Up With Facebook</a>-->
                <a href="shared-same-gender/shared-same-gender.php?DID=<?php echo $DID; ?>&user_ID=<?php echo $user_ID; ?>" style="height:50px; font-size: 16px; border-style: dashed; width:100% !important; border-radius: 12px; color:#fff; border:none; background-image: linear-gradient(to right, #B3E207 0%, #3ADBDB 100%);" class="btn  w-100 mb-3">Shared / same gender</a>
            </div>
			
			

			
			
            <div class="sign-up-btn-container" style="margin-bottom:-25px">
                <!--<a class="btn btn-center width-100 display-block btn-secondary  btn-padding-1">Sign Up With Facebook</a>-->
                <a href="shared-mix-gender/shared-mix-gender.php?DID=<?php echo $DID; ?>&user_ID=<?php echo $user_ID; ?>" style="height:50px; font-size: 16px; border-style: dashed; width:100% !important; border-radius: 12px; color:#fff; border:none; background-image: linear-gradient(to right, #B3E207 0%, #3ADBDB 100%);" class="btn  w-100 mb-3">Shared / mix gender</a>
            </div>
			
		
		
		
		
		
		 <!--Sign Up Buttons Container Start-->
            <div class="sign-up-btn-container" style="margin-bottom:-25px">
                <!--<a class="btn btn-center width-100 display-block btn-secondary  btn-padding-1">Sign Up With Facebook</a>-->
                <a href="private-same-gender/private-same-gender.php?DID=<?php echo $DID; ?>&user_ID=<?php echo $user_ID; ?>" style="height:50px; font-size: 16px; border-style: dashed; width:100% !important; border-radius: 12px; color:#fff; border:none; background-image: linear-gradient(to right, #B3E207 0%, #3ADBDB 100%);" class="btn  w-100 mb-3">Private / same gender</a>
            </div>
			
			

			
			
            <div class="sign-up-btn-container" style="margin-bottom:-25px">
                <!--<a class="btn btn-center width-100 display-block btn-secondary  btn-padding-1">Sign Up With Facebook</a>-->
                <a href="private-mix-gender/private-mix-gender.php?DID=<?php echo $DID; ?>&user_ID=<?php echo $user_ID; ?>" style="height:50px; font-size: 16px; border-style: dashed; width:100% !important; border-radius: 12px; color:#fff; border:none; background-image: linear-gradient(to right, #B3E207 0%, #3ADBDB 100%);" class="btn  w-100 mb-3">Private / mix gender</a>
            </div>
			
		
		
		
		
		
		
		
		
		
		
		
        </div>
  




        
    </div>
	  </div>


    <?php
	include 'menu.php'
	?>
</body>
</html>