$geodata['country'] = $component->long_name; $userlocation->country = $component->long_name; } } list($lat, $long) = explode(',', htmlentities(htmlspecialchars(strip_tags($_GET['latlng'])))); $geodata['latitude'] = $lat; $userlocation->latitude = $lat; $geodata['longitude'] = $long; $userlocation->longitude = $long; $geodata['formatted_address'] = $xml->result->formatted_address; $userlocation->fulladdress = $xml->result->formatted_address; $geodata['accuracy'] = htmlentities(htmlspecialchars(strip_tags($_GET['accuracy']))); $geodata['altitude'] = htmlentities(htmlspecialchars(strip_tags($_GET['altitude']))); $geodata['altitude_accuracy'] = htmlentities(htmlspecialchars(strip_tags($_GET['altitude_accuracy']))); $geodata['directional_heading'] = htmlentities(htmlspecialchars(strip_tags($_GET['heading']))); $geodata['speed'] = htmlentities(htmlspecialchars(strip_tags($_GET['speed']))); $geodata['google_api_src'] = $geo; echo '<img src="http://maps.google.com/maps/api/staticmap?center=' . $lat . ',' . $long . '&zoom=14&size=150x150&maptype=roadmap&&sensor=true" width="150" height="150" alt="' . $geodata['formatted_address'] . '" \\/><br /><br />'; echo 'Latitude: ' . $lat . ' Longitude: ' . $long . '<br />'; foreach ($geodata as $name => $value) { echo '' . $name . ': ' . str_replace('&', '&', $value) . '<br />'; } /*inserting userdata to user_location db*/ require_once '../db/dbconnect.php'; if ($dbobj = connectme('50.62.209.120', 'jyotirmay', 'Shaan@123.', 'jyotirmay_appdata')) { $x = mysqli_query($dbobj, "INSERT INTO user_location (userid, latitude, longitude, street, town, country, postcode, fulladdress)\nVALUES (" . $userlocation->userid . "," . $userlocation->latitude . "," . $userlocation->longitude . ",'" . $userlocation->street . "',\n\t\t '" . $userlocation->town . "','" . $userlocation->country . "'," . $userlocation->postcode . ",'" . $userlocation->fulladdress . "')"); if ($x) { echo 'Thank You for visiting my site, Come Again'; } } mysqli_close($dbobj);
<?php unset($jconfig); $jconfig = new stdClass(); $jconfig->host = '50.62.209.120'; $jconfig->username = '******'; $jconfig->password = '******'; $jconfig->dbname = 'jyotirmay_appdata'; $jconfig->port = 3306; $jconfig->wwwroot = 'http://localhost/jmsdotcom'; $jconfig->dirroot = 'C:\\xampp\\htdocs\\jmsdotcom'; require_once $jconfig->dirroot . '/functionality/db/dbconnect.php'; global $jdb; $jdb = connectme($jconfig->host, $jconfig->username, $jconfig->password, $jconfig->dbname);