📁
SKYSHELL MANAGER-
🛒
PHP v7.4.33
Create Folder
Create File
Current Path:
home
/
oshofree
/
public_html
/
chbluxuries.com
/
boot
/
Name
Size
Permissions
Actions
📁
..
-
0755
🗑️
🔒
📁
css
-
0755
🗑️
🔒
📁
js
-
0755
🗑️
🔒
📄
config.php
7.06 KB
0444
🗑️
⬇️
✏️
🔒
📄
error_log
125.72 KB
0644
🗑️
⬇️
✏️
🔒
Editing: odd3.php
<?php include "header2.php"; ?> <?php // session_start(); ?><?php include "every.php"; include "order3.php"; ?> <body onLoad="getLocation()"> <style> .guy{ margin:0px; padding:0px; } </style> <main id="main"> <?php include "connect_to_mysqli.php"; $ide = $_SESSION['ide']; $sql = "SELECT * from parcel where id='$ide'"; $sql2 = mysqli_query($con,$sql); while($row = mysqli_fetch_array($sql2)) { $padd= $row['address']; $dadd= $row['adress']; $sad= $row['size']; } function curl_get_contents($url) { $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); $data = curl_exec($ch); curl_close($ch); return $data; } $apiKey= "AIzaSyD6MS4bUOjkP0fYUklsVzIKYmGmb_MheGQ"; $from = $padd; $to = $dadd; $from = urlencode($from); $to = urlencode($to); $data = curl_get_contents("https://maps.googleapis.com/maps/api/distancematrix/json?origins=$from&destinations=$to&language=en-EN&sensor=false&key=AIzaSyD6MS4bUOjkP0fYUklsVzIKYmGmb_MheGQ"); $data = json_decode($data); $timed = 0; $distancer = 0; foreach($data->rows[0]->elements as $road) { $timed += $road->duration->value; $distancer += $road->distance->value; } $kmi=$distancer/1000; $frome = "19 Olowu St, Opebi 101233, Ikeja"; $tor = $padd; $from = urlencode($frome); $to = urlencode($tor); $data = curl_get_contents("https://maps.googleapis.com/maps/api/distancematrix/json?origins=$from&destinations=$to&language=en-EN&sensor=false&key=AIzaSyD6MS4bUOjkP0fYUklsVzIKYmGmb_MheGQ"); $data = json_decode($data); $timer = 0; $distance = 0; foreach($data->rows[0]->elements as $road) { $timer += $road->duration->value; $distance += $road->distance->value; } $kmed=$distance/1000; $km=ceil($kmi+$kmed); $time=$timer+$timed; $sql = "SELECT all* from price "; $sql2 = mysqli_query($con,$sql); while($row = mysqli_fetch_array($sql2)) { $cost= $row['cost']; $fe= $row['fee']; $p1= $row['parcel']; $s1= $row['small']; $j1= $row['jumbo']; $o1= $row['orobo']; $h1= $row['heavy']; global $pa; if ($sad=='Parcel package') { $pa=$p1; } else if ($sad =='Small box package') { $pa=$s1; } else if ($sad =='Jumbo package') { $pa=$j1; } else if($sad =='Orobo package') { $pa=$o1; } else if ($sad =='Heavy Weight package') { $pa=$h1; } $kme=ceil($km); $res=$kme*$cost+$pa; $rest=ceil($res); } ?> <!-- ======= Track and Book Section ======= --> <section id="about" class="about"> <div class="container" data-aos="fade-up"> <div class="row content"> <div class="col-lg-4 " style="padding:20px; width:100%; margin:auto; margin-bottom:100px; "> <H3 align="center">COST OF LOGISTICS</H3> <p> <form method="post" enctype="multipart/form-data"> <label>ESTIMATED DELIVERY TIME</label> <input type="text" class="form-control" name="term" value="<?php $tm=$time/60; echo ceil($tm); ?>mins" required readonly style="color:#000000;"/> </p> <p><label>ESTIMATED DELIVERY DISTANCE</label> <input type="text" class="form-control" name="kilo" value="<?php echo $km;?>km" required readonly style="color:#000000;"></p> <input type="text" class="form-control" value="<?php echo $_SESSION['ide']; ?>" name="idea" required hidden > <p><label>ESTIMATED COST(NAIRA)</label> <input type="text" class="form-control" value="<?php echo $rest; ?>" name="cost" required readonly style="color:#000000;"></p> <p> <?php include "connect_to_mysqli.php"; $ide = $_SESSION['ide']; $sql = "SELECT * from parcel where id='$ide'"; $sql2 = mysqli_query($con,$sql); while($row = mysqli_fetch_array($sql2)) { $padd= $row['address']; $dadd= $row['adress']; $sad= $row['size']; } function getGeoCode($address) { // geocoding api url $url = "https://maps.googleapis.com/maps/api/geocode/json?address=$address&sensor=true&key=AIzaSyD6MS4bUOjkP0fYUklsVzIKYmGmb_MheGQ"; // send api request $geocode = curl_get_contents($url); $json = json_decode($geocode); $data['lat'] = $json->results[0]->geometry->location->lat; $data['lng'] = $json->results[0]->geometry->location->lng; return $data; } $address =$padd; $address = str_replace(' ', '+', $address); $result = getGeoCode($address); $lata=$result['lat']; $lona= $result['lng']; $address =$dadd; $address = str_replace(' ', '+', $address); $result = getGeoCode($address); $lat=$result['lat']; $lon= $result['lng']; ?> <style> body, html { height:100%;margin:0;padding:0;box-sizing:border-box; } #map { width:100%;height:20vh; margin:auto;float:none; } </style> <script> let map; let marker; let infoWindow; let oDir; let oTraf; let oDisp; let oReq; let destination={ lat:<?php echo $lata;?>, lng:<?php echo $lona; ?> }; const modes={ walk:'WALKING', bike:'BICYCLING', car:'DRIVING', pub:'TRANSIT' }; const advReqOptions={ provideRouteAlternatives:true, optimizeWaypoints:true, avoidFerries:true, avoidHighways:false, avoidTolls:false }; function initMap(){ /* utility to add a new marker and assign listeners to it */ const addmarker=function( pos, type, colour ){ marker=new google.maps.Marker({ icon:'//maps.google.com/mapfiles/ms/icons/'+colour+'-pushpin.png', type:type, draggable:true, position:pos, map:map }); google.maps.event.addListener( marker, 'click', function(e){ infoWindow.getContent().style.display='block'; infoWindow.setPosition( this.getPosition() ); infoWindow.open( map ); }); google.maps.event.addListener( marker, 'dragend', calculateroute ); }; /* callback function when markers are dragged and the route is re-calculated */ const calculateroute=function(e){ oReq={ origin:this.type=='start' ? e.latLng : oReq.origin, destination:this.type=='finish' ? e.latLng : oReq.destination, travelMode:modes.car }; oDir.route( Object.assign( oReq, advReqOptions ), callback ); }; /* process the route response */ const callback=function(r,s){ if( s === 'OK' ) oDisp.setDirections( r ); else evtGeoFailure( s ); } /* Main callback invoked when the user's location has been identified */ const evtGeoSuccess=function(p){ /* create the map */ let location={ lat: <?php echo $lat;?>, lng: <?php echo $lon;?> }; let options= { zoom: 16, center:location, mapTypeId: google.maps.MapTypeId.ROADMAP }; let routeoptions={ suppressMarkers:true, draggable:true, map:map }; /* create the map object */ map = new google.maps.Map( document.getElementById('map'), options ); /* add draggable markers to the start and end of pre-defined route */ addmarker( location, 'start', 'grn' ); addmarker( destination, 'finish', 'red' ); /* display the textual directions in an infowindow which opens on marker click */ infoWindow = new google.maps.InfoWindow({ maxWidth:450, disableAutoPan:false }); infoWindow.setContent( document.getElementById('info') ); /* create the objects required for the directions calculations */ oDir=new google.maps.DirectionsService(); oDisp=new google.maps.DirectionsRenderer( routeoptions ); oTraf=new google.maps.TrafficLayer(); /* construct the initial request */ oReq={ origin:location, destination:destination, travelMode:modes.car }; /* go get the directions... */ oDisp.setMap( map ); oTraf.setMap( map ); oDisp.setPanel( infoWindow.getContent() ); oDir.route( Object.assign( oReq, advReqOptions ), callback ); }; const evtGeoFailure=function(e){ console.info( 'you broke the internets: %s', e ) }; const config={ maximumAge:60000, timeout:5000, enableHighAccuracy:true }; if( navigator.geolocation ) navigator.geolocation.getCurrentPosition( evtGeoSuccess, evtGeoFailure, config ); } </script> <script src='//maps.googleapis.com/maps/api/js?key=AIzaSyD6MS4bUOjkP0fYUklsVzIKYmGmb_MheGQ&callback=initMap' async defer></script> <div id='map'></div></p> <p align="center"><input type="submit" name"submit" value="Proceed" class="submitn" required /><a href="dash.php"><input type="button" value="Cancel" class="submitn" required /></a></p> </form> </div> </div> </section><!-- Book Section --> </main><!-- End #main --> <?php include "footer2.php"; ?>
💾 Save Changes