diff --git a/phoneClients/ios/GpsTracker/WSViewController.m b/phoneClients/ios/GpsTracker/WSViewController.m index 037e4be..6685b1a 100644 --- a/phoneClients/ios/GpsTracker/WSViewController.m +++ b/phoneClients/ios/GpsTracker/WSViewController.m @@ -172,8 +172,7 @@ - (void)updateWebsiteWithLatitde:(NSString *)latitude longitude:(NSString *)longitude speed:(NSString *)speed date:(NSString *)date distance:(NSString *)distance sessionID:(NSString *)sessionID accuracy:(NSString *)accuracy extraInfo:(NSString *)extraInfo direction:(NSString *)direction { // the second was used for testing the .net site on local network - NSString *defaultWebSite = @"http://www.websmithing.com/gpstracker2/getgooglemap3.php"; - // NSString *defaultWebSite = @"http://192.168.1.19/GpsTracker/UpdateLocation.aspx"; + NSString *defaultWebSite = @"http://www.websmithing.com/gpstracker/updatelocation.php"; AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; manager.responseSerializer = [AFHTTPResponseSerializer serializer]; diff --git a/servers/dotNet/gpstracker.bak b/servers/dotNet/gpstracker.bak deleted file mode 100755 index 13878d6..0000000 --- a/servers/dotNet/gpstracker.bak +++ /dev/null Binary files differ diff --git a/servers/dotNet/sqlserver/gpstracker.bak b/servers/dotNet/sqlserver/gpstracker.bak new file mode 100644 index 0000000..07edc20 --- /dev/null +++ b/servers/dotNet/sqlserver/gpstracker.bak Binary files differ diff --git a/servers/php/dbconnect.php b/servers/php/dbconnect.php new file mode 100644 index 0000000..967cd7d --- /dev/null +++ b/servers/php/dbconnect.php @@ -0,0 +1,15 @@ + \ No newline at end of file diff --git a/servers/php/deleteroute.php b/servers/php/deleteroute.php new file mode 100644 index 0000000..c7cf8fa --- /dev/null +++ b/servers/php/deleteroute.php @@ -0,0 +1,12 @@ +multi_query($query)) { + die('$mysqli->multi_query: ' . $mysqli->error); + } + + $mysqli->close(); +?> diff --git a/servers/php/displaymap.php b/servers/php/displaymap.php new file mode 100644 index 0000000..2afd421 --- /dev/null +++ b/servers/php/displaymap.php @@ -0,0 +1,97 @@ + + + + Google Map GPS Cell Phone Tracker + + + + + + + + + + + +
GPS Tracker
+
+ + + + + + + + + + + + + + + + + + + + + diff --git a/servers/php/getgpslocations.php b/servers/php/getgpslocations.php new file mode 100644 index 0000000..6af1b43 --- /dev/null +++ b/servers/php/getgpslocations.php @@ -0,0 +1,31 @@ +'; + + // execute query + if ($mysqli->multi_query($query)) { + + do { + if ($result = $mysqli->store_result()) { + while ($row = $result->fetch_row()) { + $xml .= $row[0]; + } + $result->close(); + } + } while ($mysqli->next_result()); + } + else { + die('$mysqli->multi_query: ' . $mysqli->error); + } + + $xml .= ''; + + header('Content-Type: text/xml'); + echo $xml; + + $mysqli->close(); +?> \ No newline at end of file diff --git a/servers/php/getroutes.php b/servers/php/getroutes.php new file mode 100644 index 0000000..20955aa --- /dev/null +++ b/servers/php/getroutes.php @@ -0,0 +1,30 @@ +'; + + // execute query + if ($mysqli->multi_query($query)) { + + do { + if ($result = $mysqli->store_result()) { + while ($row = $result->fetch_row()) { + $xml .= $row[0]; + } + $result->close(); + } + } while ($mysqli->next_result()); + } + else { + die('$mysqli->multi_query: ' . $mysqli->error); + } + + $xml .= ''; + + header('Content-Type: text/xml'); + echo $xml; + + $mysqli->close(); +?> diff --git a/servers/php/images/ajax-loader.gif b/servers/php/images/ajax-loader.gif new file mode 100644 index 0000000..3c2f7c0 --- /dev/null +++ b/servers/php/images/ajax-loader.gif Binary files differ diff --git a/servers/php/images/ajaxloader.gif b/servers/php/images/ajaxloader.gif new file mode 100644 index 0000000..3288d10 --- /dev/null +++ b/servers/php/images/ajaxloader.gif Binary files differ diff --git a/servers/php/images/ajaxloadersmall.gif b/servers/php/images/ajaxloadersmall.gif new file mode 100644 index 0000000..085ccae --- /dev/null +++ b/servers/php/images/ajaxloadersmall.gif Binary files differ diff --git a/servers/php/images/beepphone.jpg b/servers/php/images/beepphone.jpg new file mode 100644 index 0000000..0f979fc --- /dev/null +++ b/servers/php/images/beepphone.jpg Binary files differ diff --git a/servers/php/images/blue_circle.png b/servers/php/images/blue_circle.png new file mode 100644 index 0000000..b922e48 --- /dev/null +++ b/servers/php/images/blue_circle.png Binary files differ diff --git a/servers/php/images/compassE.jpg b/servers/php/images/compassE.jpg new file mode 100644 index 0000000..e7ef937 --- /dev/null +++ b/servers/php/images/compassE.jpg Binary files differ diff --git a/servers/php/images/compassN.jpg b/servers/php/images/compassN.jpg new file mode 100644 index 0000000..03f4998 --- /dev/null +++ b/servers/php/images/compassN.jpg Binary files differ diff --git a/servers/php/images/compassNE.jpg b/servers/php/images/compassNE.jpg new file mode 100644 index 0000000..fd8d380 --- /dev/null +++ b/servers/php/images/compassNE.jpg Binary files differ diff --git a/servers/php/images/compassNW.jpg b/servers/php/images/compassNW.jpg new file mode 100644 index 0000000..6ef421d --- /dev/null +++ b/servers/php/images/compassNW.jpg Binary files differ diff --git a/servers/php/images/compassS.jpg b/servers/php/images/compassS.jpg new file mode 100644 index 0000000..841f24c --- /dev/null +++ b/servers/php/images/compassS.jpg Binary files differ diff --git a/servers/php/images/compassSE.jpg b/servers/php/images/compassSE.jpg new file mode 100644 index 0000000..1253e8b --- /dev/null +++ b/servers/php/images/compassSE.jpg Binary files differ diff --git a/servers/php/images/compassSW.jpg b/servers/php/images/compassSW.jpg new file mode 100644 index 0000000..62ddf3d --- /dev/null +++ b/servers/php/images/compassSW.jpg Binary files differ diff --git a/servers/php/images/compassW.jpg b/servers/php/images/compassW.jpg new file mode 100644 index 0000000..f694a4d --- /dev/null +++ b/servers/php/images/compassW.jpg Binary files differ diff --git a/servers/php/images/coolblue_small.png b/servers/php/images/coolblue_small.png new file mode 100644 index 0000000..597a53e --- /dev/null +++ b/servers/php/images/coolblue_small.png Binary files differ diff --git a/servers/php/images/coolgreen_small.png b/servers/php/images/coolgreen_small.png new file mode 100644 index 0000000..462894b --- /dev/null +++ b/servers/php/images/coolgreen_small.png Binary files differ diff --git a/servers/php/images/coolred_small.png b/servers/php/images/coolred_small.png new file mode 100644 index 0000000..47384e2 --- /dev/null +++ b/servers/php/images/coolred_small.png Binary files differ diff --git a/servers/php/images/coolshadow_small.png b/servers/php/images/coolshadow_small.png new file mode 100644 index 0000000..3a89759 --- /dev/null +++ b/servers/php/images/coolshadow_small.png Binary files differ diff --git a/servers/php/images/cooltransparent_small.png b/servers/php/images/cooltransparent_small.png new file mode 100644 index 0000000..ba7ed91 --- /dev/null +++ b/servers/php/images/cooltransparent_small.png Binary files differ diff --git a/servers/php/images/deleteroute.jpg b/servers/php/images/deleteroute.jpg new file mode 100644 index 0000000..14ab9ab --- /dev/null +++ b/servers/php/images/deleteroute.jpg Binary files differ diff --git a/servers/php/images/download.jpg b/servers/php/images/download.jpg new file mode 100644 index 0000000..34aa06f --- /dev/null +++ b/servers/php/images/download.jpg Binary files differ diff --git a/servers/php/images/findphone.jpg b/servers/php/images/findphone.jpg new file mode 100644 index 0000000..ccd83e1 --- /dev/null +++ b/servers/php/images/findphone.jpg Binary files differ diff --git a/servers/php/images/info.jpg b/servers/php/images/info.jpg new file mode 100644 index 0000000..18b357a --- /dev/null +++ b/servers/php/images/info.jpg Binary files differ diff --git a/servers/php/images/purple_circle.png b/servers/php/images/purple_circle.png new file mode 100644 index 0000000..209ba12 --- /dev/null +++ b/servers/php/images/purple_circle.png Binary files differ diff --git a/servers/php/images/refresh.jpg b/servers/php/images/refresh.jpg new file mode 100644 index 0000000..f48604a --- /dev/null +++ b/servers/php/images/refresh.jpg Binary files differ diff --git a/servers/php/images/start.jpg b/servers/php/images/start.jpg new file mode 100644 index 0000000..643606c --- /dev/null +++ b/servers/php/images/start.jpg Binary files differ diff --git a/servers/php/images/stop_dark.jpg b/servers/php/images/stop_dark.jpg new file mode 100644 index 0000000..9b2d522 --- /dev/null +++ b/servers/php/images/stop_dark.jpg Binary files differ diff --git a/servers/php/images/stop_green.jpg b/servers/php/images/stop_green.jpg new file mode 100644 index 0000000..00aaa99 --- /dev/null +++ b/servers/php/images/stop_green.jpg Binary files differ diff --git a/servers/php/javascript/maps.js b/servers/php/javascript/maps.js new file mode 100644 index 0000000..3ce6c68 --- /dev/null +++ b/servers/php/javascript/maps.js @@ -0,0 +1,317 @@ + +function loadRoutes(data, responseCode) { + if (data.length == 0) { + showMessage('There are no routes available to view.'); + map.innerHTML = ''; + } + else { + // get list of routes + var xml = GXml.parse(data); + + var routes = xml.getElementsByTagName("route"); + + // create the first option of the dropdown box + var option = document.createElement('option'); + option.setAttribute('value', '0'); + option.innerHTML = 'Select Route...'; + routeSelect.appendChild(option); + + // iterate through the routes and load them into the dropdwon box. + for (i = 0; i < routes.length; i++) { + var option = document.createElement('option'); + option.setAttribute('value', '?sessionID=' + routes[i].getAttribute("sessionID") + + '&phoneNumber=' + routes[i].getAttribute("phoneNumber")); + option.innerHTML = routes[i].getAttribute("phoneNumber") + " " + routes[i].getAttribute("times"); + routeSelect.appendChild(option); + } + + // need to reset this for firefox + routeSelect.selectedIndex = 0; + + hideWait(); + showMessage('Please select a route below.'); + } + +} + +// this will get the map and route, the route is selected from the dropdown box +function getRouteForMap() { + if (hasMap()) { + showWait('Getting map...'); + var url = 'getgpslocations.php' + routeSelect.options[routeSelect.selectedIndex].value; + + //alert("testing route: " + routeSelect.options[routeSelect.selectedIndex].value); + + GDownloadUrl(url, loadGPSLocations); + } + else { + alert("Please select a route before trying to refresh map."); + } +} + +// check to see if we have a map loaded, don't want to autorefresh or delete without it +function hasMap() { + if (routeSelect.selectedIndex == 0) { // means no map + return false; + } + else { + return true; + } +} + +function loadGPSLocations(data, responseCode) { + if (data.length == 0) { + showMessage('There is no tracking data to view.'); + map.innerHTML = ''; + } + else { + if (GBrowserIsCompatible()) { + + // create list of GPS data locations from our XML + var xml = GXml.parse(data); + + // markers that we will display on Google map + var markers = xml.getElementsByTagName("locations"); + + // get rid of the wait gif + hideWait(); + + // create new map and add zoom control and type of map control + var map = new GMap2(document.getElementById("map")); + map.setUIToDefault(); + + + // note: replace this publisher ID with your own. + var publisherID = 'pub-7095775186404141'; + + var adsManagerOptions = { + maxAdsOnMap : 2, + style: 'adunit', + // The channel field is optional - replace this field with a channel number + // of your own for Google AdSense tracking + channel: '2332912476' + }; + + adsManager = new GAdsManager(map, publisherID, adsManagerOptions); + adsManager.enable(); + + var length = markers.length; + + // center map on last marker so we can see progress during refreshes + map.setCenter(new GLatLng(parseFloat(markers[length-1].getAttribute("latitude")), + parseFloat(markers[length-1].getAttribute("longitude"))), zoomLevel); + + // interate through all our GPS data, create markers and add them to map + for (var i = 0; i < length; i++) { + var point = new GLatLng(parseFloat(markers[i].getAttribute("latitude")), + parseFloat(markers[i].getAttribute("longitude"))); + + var marker = createMarker(i, length, point, + markers[i].getAttribute("speed"), + markers[i].getAttribute("direction"), + markers[i].getAttribute("distance"), + markers[i].getAttribute("locationMethod"), + markers[i].getAttribute("gpsTime"), + markers[i].getAttribute("phoneNumber"), + markers[i].getAttribute("sessionID"), + markers[i].getAttribute("accuracy"), + markers[i].getAttribute("extraInfo")); + + // add markers to map + map.addOverlay(marker); + } + } + + // show route name + showMessage(routeSelect.options[routeSelect.selectedIndex].innerHTML); + } +} + +function createMarker(i, length, point, speed, direction, distance, locationMethod, gpsTime, + phoneNumber, sessionID, accuracy, extraInfo) { + var icon = new GIcon(); + + // make the most current marker red + if (i == length - 1) { + icon.image = "images/coolred_small.png"; + } + else { + icon.image = "images/coolblue_small.png"; + } + + icon.shadow = "images/coolshadow_small.png"; + icon.iconSize = new GSize(12, 20); + icon.shadowSize = new GSize(22, 20); + icon.iconAnchor = new GPoint(6, 20); + icon.infoWindowAnchor = new GPoint(5, 1); + + var marker = new GMarker(point,icon); + + // this describes how we got our location data, either by satellite or by cell phone tower + var lm = ""; + if (locationMethod == "8") { + lm = "Cell Tower"; + } else if (locationMethod == "327681") { + lm = "Satellite"; + } else { + lm = locationMethod; + } + + var lastMarker = ""; + + // when a user clicks on last marker, let them know it's final one + if (i == length - 1) { + lastMarker = " Final location"; + } + + // convert from meters to feet + accuracy = parseInt(accuracy * 3.28); + + // this creates the pop up bubble that displays info when a user clicks on a marker + GEvent.addListener(marker, "click", function() { + marker.openInfoWindowHtml( + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + + "
  " + + "/" + + lastMarker + + "
Speed:" + speed + " mph
Distance:" + distance + " mi 
Time:" + gpsTime + "
Method:" + lm + " 
Phone #:" + phoneNumber + " 
Session ID:" + sessionID + " 
Accuracy:" + accuracy + " ft 
Extra Info:" + extraInfo + " 
" + ); + }); + + return marker; +} + +// this chooses the proper image for our litte compass in the popup window +function getCompassImage(azimuth) { + if ((azimuth >= 337 && azimuth <= 360) || (azimuth >= 0 && azimuth < 23)) + return "compassN"; + if (azimuth >= 23 && azimuth < 68) + return "compassNE"; + if (azimuth >= 68 && azimuth < 113) + return "compassE"; + if (azimuth >= 113 && azimuth < 158) + return "compassSE"; + if (azimuth >= 158 && azimuth < 203) + return "compassS"; + if (azimuth >= 203 && azimuth < 248) + return "compassSW"; + if (azimuth >= 248 && azimuth < 293) + return "compassW"; + if (azimuth >= 293 && azimuth < 337) + return "compassNW"; + + return ""; +} + +function deleteRoute() { + if (hasMap()) { + var answer = confirm("This will permanently delete this route\n from the database. Do you want to delete?") + if (answer){ + showWait('Deleting route...'); + var url = 'deleteroute.php' + routeSelect.options[routeSelect.selectedIndex].value; + GDownloadUrl(url, deleteRouteResponse); + } + else { + return false; + } + } + else { + alert("Please select a route before trying to delete."); + } +} + +function deleteRouteResponse(data, responseCode) { + map.innerHTML = ''; + routeSelect.length = 0; + GDownloadUrl('getroutes.php', loadRoutes); +} + +// auto refresh the map. there are 3 transitions (shown below). transitions happen when a user +// selects an option in the auto refresh dropdown box. an interval is an amount of time in between +// refreshes of the map. for instance, auto refresh once a minute. in the method below, the 3 numbers +// in the code show where the 3 transitions are handled. setInterval turns on a timer that calls +// the getRouteForMap() method every so many seconds based on the value of newInterval. +// clearInterval turns off the timer. if newInterval is 5, then the value passed to setInterval is +// 5000 milliseconds or 5 seconds. +function autoRefresh() { + /* + 1) going from off to any interval + 2) going from any interval to off + 3) going from one interval to another + */ + + if (hasMap()) { + newInterval = refreshSelect.options[refreshSelect.selectedIndex].value; + + if (currentInterval > 0) { // currently running at an interval + + if (newInterval > 0) { // moving to another interval (3) + clearInterval(intervalID); + intervalID = setInterval("getRouteForMap();", newInterval * 1000); + currentInterval = newInterval; + } + else { // we are turning off (2) + clearInterval(intervalID); + newInterval = 0; + currentInterval = 0; + } + } + else { // off and going to an interval (1) + intervalID = setInterval("getRouteForMap();", newInterval * 1000); + currentInterval = newInterval; + } + + // show what auto refresh action was taken and after 5 seconds, display the route name again + showMessage(refreshSelect.options[refreshSelect.selectedIndex].innerHTML); + setTimeout('showRouteName();', 5000); + } + else { + alert("Please select a route before trying to refresh map."); + refreshSelect.selectedIndex = 0; + } +} + +function changeZoomLevel() { + if (hasMap()) { + zoomLevel = zoomLevelSelect.selectedIndex + 1; + + getRouteForMap(); + + // show what zoom level action was taken and after 5 seconds, display the route name again + showMessage(zoomLevelSelect.options[zoomLevelSelect.selectedIndex].innerHTML); + setTimeout('showRouteName();', 5000); + } + else { + alert("Please select a route before selecting zoom level."); + zoomLevelSelect.selectedIndex = zoomLevel - 1; + } +} + +function showMessage(message) { + messages.innerHTML = 'GPS Tracker: ' + message + ''; +} + +function showRouteName() { + showMessage(routeSelect.options[routeSelect.selectedIndex].innerHTML); +} + +function showWait(theMessage) { + map.innerHTML = ''; + showMessage(theMessage); +} + +function hideWait() { + map.innerHTML = ''; + messages.innerHTML = 'GPS Tracker'; +} + diff --git a/servers/php/mysql/gpstracker-1-12-14.sql b/servers/php/mysql/gpstracker-1-12-14.sql new file mode 100644 index 0000000..25b1116 --- /dev/null +++ b/servers/php/mysql/gpstracker-1-12-14.sql @@ -0,0 +1,253 @@ +-- MySQL dump 10.13 Distrib 5.5.34, for debian-linux-gnu (i686) +-- +-- Host: localhost Database: gpstracker +-- ------------------------------------------------------ +-- Server version 5.5.34-0ubuntu0.12.04.1 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `gpslocations` +-- + +DROP TABLE IF EXISTS `gpslocations`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `gpslocations` ( + `GPSLocationID` int(10) unsigned NOT NULL AUTO_INCREMENT, + `LastUpdate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `Latitude` decimal(10,6) NOT NULL DEFAULT '0.000000', + `Longitude` decimal(10,6) NOT NULL DEFAULT '0.000000', + `phoneNumber` varchar(50) NOT NULL DEFAULT '', + `sessionID` varchar(50) NOT NULL DEFAULT '', + `speed` int(10) unsigned NOT NULL DEFAULT '0', + `direction` int(10) unsigned NOT NULL DEFAULT '0', + `distance` decimal(10,1) NOT NULL DEFAULT '0.0', + `gpsTime` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `LocationMethod` varchar(50) NOT NULL DEFAULT '', + `accuracy` int(10) unsigned NOT NULL DEFAULT '0', + `extraInfo` varchar(255) NOT NULL DEFAULT '', + `eventType` varchar(50) NOT NULL DEFAULT '', + PRIMARY KEY (`GPSLocationID`), + KEY `sessionIDIndex` (`sessionID`), + KEY `phoneNumberIndex` (`phoneNumber`) +) ENGINE=InnoDB AUTO_INCREMENT=85 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `gpslocations` +-- + +LOCK TABLES `gpslocations` WRITE; +/*!40000 ALTER TABLE `gpslocations` DISABLE KEYS */; +INSERT INTO `gpslocations` VALUES (3,'2014-01-08 11:52:25',48.856700,2.350800,'webUser','11137',137,0,25.0,'2007-10-17 18:37:00','0',95,'yes','webUser'),(4,'2014-01-08 11:52:54',48.856700,2.350800,'webUser','11137',137,0,25.0,'2007-10-17 18:37:00','0',95,'yes','webUser'),(5,'2014-01-08 11:53:01',48.856700,2.350800,'webUser','11137',137,0,25.0,'2007-10-17 18:37:00','0',95,'yes','webUser'),(6,'2014-01-08 11:53:09',48.856700,2.350800,'webUser','11137',137,0,25.0,'2007-10-17 18:37:00','0',95,'yes','webUser'),(7,'2014-01-08 12:03:29',48.856700,2.350800,'webUser','11137',137,0,25.0,'2007-10-17 18:37:00','0',95,'yes','webUser'); +/*!40000 ALTER TABLE `gpslocations` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Dumping routines for database 'gpstracker' +-- +/*!50003 DROP PROCEDURE IF EXISTS `prcDeleteRoute` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = latin1 */ ; +/*!50003 SET character_set_results = latin1 */ ; +/*!50003 SET collation_connection = latin1_swedish_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +CREATE DEFINER=`gpstracker_user`@`localhost` PROCEDURE `prcDeleteRoute`( +_sessionID VARCHAR(20), +_phoneNumber VARCHAR(25) +) +BEGIN + DELETE FROM gpslocations + WHERE sessionID = _sessionID + AND phoneNumber = _phoneNumber + ORDER BY lastupdate; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `prcGetAllGpsLocations` */; +ALTER DATABASE `gpstracker` CHARACTER SET utf8 COLLATE utf8_general_ci ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +CREATE DEFINER=`gpstracker_user`@`localhost` PROCEDURE `prcGetAllGpsLocations`() +BEGIN + +SELECT * FROM gpslocations; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +ALTER DATABASE `gpstracker` CHARACTER SET latin1 COLLATE latin1_swedish_ci ; +/*!50003 DROP PROCEDURE IF EXISTS `prcGetRouteForMap` */; +ALTER DATABASE `gpstracker` CHARACTER SET utf8 COLLATE utf8_general_ci ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +CREATE DEFINER=`gpstracker_user`@`localhost` PROCEDURE `prcGetRouteForMap`( +_sessionID VARCHAR(50), +_phoneNumber VARCHAR(50)) +BEGIN + SELECT + CONCAT('') xml + FROM gpslocations + WHERE sessionID = _sessionID + AND phoneNumber = _phoneNumber + ORDER BY lastupdate; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +ALTER DATABASE `gpstracker` CHARACTER SET latin1 COLLATE latin1_swedish_ci ; +/*!50003 DROP PROCEDURE IF EXISTS `prcGetRoutes` */; +ALTER DATABASE `gpstracker` CHARACTER SET utf8 COLLATE utf8_general_ci ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +CREATE DEFINER=`gpstracker_user`@`localhost` PROCEDURE `prcGetRoutes`() +BEGIN + CREATE TEMPORARY TABLE tempRoutes ( + sessionID VARCHAR(50), + phoneNumber VARCHAR(50), + startTime DATETIME, + endTime DATETIME) + ENGINE = MEMORY; + + INSERT INTO tempRoutes (sessionID, phoneNumber) + SELECT DISTINCT sessionID, phoneNumber + FROM gpslocations; + + UPDATE tempRoutes tr + SET startTime = (SELECT MIN(gpsTime) FROM gpslocations gl + WHERE gl.sessionID = tr.sessionID + AND gl.phoneNumber = tr.phoneNumber); + + UPDATE tempRoutes tr + SET endTime = (SELECT MAX(gpsTime) FROM gpslocations gl + WHERE gl.sessionID = tr.sessionID + AND gl.phoneNumber = tr.phoneNumber); + + SELECT + CONCAT('') + FROM tempRoutes + ORDER BY phoneNumber; + + DROP TABLE tempRoutes; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +ALTER DATABASE `gpstracker` CHARACTER SET latin1 COLLATE latin1_swedish_ci ; +/*!50003 DROP PROCEDURE IF EXISTS `prcGetUUID` */; +ALTER DATABASE `gpstracker` CHARACTER SET utf8 COLLATE utf8_general_ci ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +CREATE DEFINER=`gpstracker_user`@`localhost` PROCEDURE `prcGetUUID`() +BEGIN + SELECT UUID(); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +ALTER DATABASE `gpstracker` CHARACTER SET latin1 COLLATE latin1_swedish_ci ; +/*!50003 DROP PROCEDURE IF EXISTS `prcSaveGPSLocation` */; +ALTER DATABASE `gpstracker` CHARACTER SET utf8 COLLATE utf8_general_ci ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +CREATE DEFINER=`gpstracker_user`@`localhost` PROCEDURE `prcSaveGPSLocation`( +_lat VARCHAR(45), +_lng VARCHAR(45), +_mph VARCHAR(45), +_direction VARCHAR(45), +_distance VARCHAR(45), +_date VARCHAR(100), +_locationMethod VARCHAR(100), +_phoneNumber VARCHAR(20), +_sessionID VARCHAR(50), +_accuracy VARCHAR(20), +_extraInfo VARCHAR(255), +_eventType VARCHAR(50) +) +BEGIN + INSERT INTO gpslocations (latitude, longitude, speed, direction, distance, gpsTime, locationMethod, phoneNumber, sessionID, accuracy, extraInfo, eventType) + VALUES (_lat, _lng, _mph, _direction, _distance, _date, _locationMethod, _phoneNumber, _sessionID, _accuracy, _extraInfo, _eventType); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +ALTER DATABASE `gpstracker` CHARACTER SET latin1 COLLATE latin1_swedish_ci ; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2014-01-14 15:17:52 diff --git a/servers/php/php_info.php b/servers/php/php_info.php new file mode 100644 index 0000000..008e91f --- /dev/null +++ b/servers/php/php_info.php @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/servers/php/styles/styles.css b/servers/php/styles/styles.css new file mode 100644 index 0000000..7c31ecc --- /dev/null +++ b/servers/php/styles/styles.css @@ -0,0 +1,72 @@ +/* +Please leave the link below with the source code, thank you. +http://www.websmithing.com/portal/Programming/tabid/55/articleType/ArticleView/articleId/6/Google-Map-GPS-Cell-Phone-Tracker-Version-2.aspx +*/ + +* { + margin: 0; + padding: 0; +} +body { + font-family: arial, helvetica, sans-serif; + font-size: 17px; +} +#messages +{ + position:absolute; + left: 10px; + top: 10px; + width:700px; +} +#map +{ + position:absolute; + left: 10px; + top: 40px; + width:700px; + height:450px; + border:1px; + border-style:solid; + background-color:#FFF; +} + +#selectRoute +{ + position:absolute; + left: 10px; + top: 510px; + width: 575px; +} + +#selectRefresh +{ + position:absolute; + left: 10px; + top: 550px; + width: 250px; +} + +#selectZoomLevel +{ + position:absolute; + left: 335px; + top: 550px; + width: 250px; +} + +#delete +{ + position:absolute; + left: 625px; + top: 510px; + width: 75px; +} + +#refresh +{ + position:absolute; + left: 625px; + top: 550px; + width: 75px; +} + diff --git a/servers/php/updatelocation.php b/servers/php/updatelocation.php new file mode 100644 index 0000000..46115d8 --- /dev/null +++ b/servers/php/updatelocation.php @@ -0,0 +1,45 @@ +multi_query($query)) { + die('$mysqli->multi_query: ' . $mysqli->error); + } + + $mysqli->close(); + + echo '0'; + +?>