Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- define('INCLUDE_CHECK',true);
- include_once 'connect.php';
- session_name('******');
- session_set_cookie_params(2*7*24*60*60);
- session_start();
- ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Registered users only! | Tutorialzine demo</title>
- <link rel="stylesheet" type="text/css" href="demo.css" media="screen" />
- <link type="text/css" href="css/main.css" rel="stylesheet" />
- <link type="text/css" href="css/searchMeme.css" rel="stylesheet" />
- <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=*********&sensor=false&libraries=geometry"></script>
- <script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
- <script type="text/javascript" src="js/jquery-ui-1.8.21.custom.min.js"></script>
- <script type="text/javascript" src="js/main.js"></script>
- <script type="text/javascript" src="js/jquery.searchMeme.js" ></script>
- </head>
- <body>
- <div id="main">
- <div class="registered-contant">
- <div class="container tutorial-info">
- <?php
- if($_SESSION['id']){
- echo '<h3>Hello, '.$_SESSION['usr'].'. You are registered and logged in! <a href="?logoff">Log off</a></h3>';
- echo '<h3>Click here to upload a new Log File <a href="?upload">UPLOAD</a></h3>';
- if(isset($_GET['logoff']))
- {
- $_SESSION = array();
- session_destroy();
- header("Location: index.php");
- exit;
- }
- if(isset($_GET['upload']))
- {
- header("Location: upload.php");
- }
- }
- else echo '<h3>Please, <a href="index.php">login</a> and come back later!</h3>';
- ?>
- </div>
- </div>
- <script type="text/javascript">
- //<![CDATA[
- function load() {
- geocoder = new google.maps.Geocoder();
- var myOptions = {
- zoom: 3,
- center: new google.maps.LatLng(54.312195845815246, -4.45948481875007),
- mapTypeId: google.maps.MapTypeId.ROADMAP, //TERRAIN,
- minZoom: 3,
- streetViewControl: false,
- zoomControl: true,
- mapTypeControl: true,
- mapTypeControlOptions: {
- style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR,
- position: google.maps.ControlPosition.TOP_RIGHT
- },
- navigationControl: true,
- navigationControlOptions: {
- style: google.maps.NavigationControlStyle.ZOOM_PAN,
- position: google.maps.ControlPosition.TOP_LEFT
- },
- scaleControl: true,
- scaleControlOptions: {
- position: google.maps.ControlPosition.BOTTOM_LEFT
- }
- }
- var map = new google.maps.Map(document.getElementById('map'), myOptions);
- var infoWindow = new google.maps.InfoWindow;
- // Change this depending on the name of your PHP file
- downloadUrl("output-xml.php", function(data)
- {
- var points=[];
- var markerbgn=[];
- var markerend=[];
- var xml = data.responseXML;
- var markers = xml.documentElement.getElementsByTagName("marker");
- for (var i = 0; i < markers.length; i++)
- {
- var date = markers[i].getAttribute("date");
- var dateBgn = markers[0].getAttribute("date");
- var time = markers[i].getAttribute("time");
- var timebgn = markers[0].getAttribute("time");
- var timeend = markers[markers.length-1].getAttribute("time");
- var type = markers[i].getAttribute("usid");
- if (dateBgn == date)
- {
- points[i] = new google.maps.LatLng(
- parseFloat(markers[i].getAttribute("lat")),
- parseFloat(markers[i].getAttribute("lng")));
- }
- var html1 = "<b>" + date + "</b> <br/>" + timebgn + "</b> <br/>" + "Start Point";
- var html2 = "<b>" + date + "</b> <br/>" + timeend + "</b> <br/>" + "End Point";
- var content2 = "<b>" + "User: " + type + "</b> <br/>" + date + "</b> <br/>" + "User Route";
- var encoded_path = google.maps.geometry.encoding.encodePath(points);
- console.log(encoded_path);
- }
- var decoded_path = google.maps.geometry.encoding.decodePath(encoded_path);
- // Polyline
- var polyOptions = {
- path: decoded_path,
- map: map,
- clickable: true,
- strokeColor: "#FF0000",
- strokeOpacity: 1.0,
- strokeWeight: 2
- }
- //line text
- var info = decoded_path;
- // Polyline
- var polyline = new google.maps.Polyline(polyOptions);
- polyline.setMap(map);
- createInfoWindow(polyline, map, infoWindow, content2);
- if(decoded_path.length!=0)
- {
- markerbgn = new google.maps.Marker({
- map: map,
- position: decoded_path[0],
- draggable: false,
- visible: true
- });
- markerend = new google.maps.Marker({
- map: map,
- position: points[decoded_path.length-1],
- draggable: false,
- visible: true
- });
- bindInfoWindow(markerbgn, map, infoWindow, html1);
- bindInfoWindow(markerend, map, infoWindow, html2);
- }
- });
- }
- function bindInfoWindow(markerbgn, map, infoWindow, html1) {
- google.maps.event.addListener(markerbgn, 'click', function() {
- map.setZoom(14);
- map.setCenter(markerbgn.getPosition());
- infoWindow.setContent(html1);
- infoWindow.open(map, markerbgn);
- });
- google.maps.event.addListener(markerbgn,"mouseover", function() {
- infoWindow.setContent(html1);
- infoWindow.open(map, markerbgn);
- });
- }
- function bindInfoWindow(markerend, map, infoWindow, html2) {
- google.maps.event.addListener(markerend, 'click', function() {
- map.setZoom(14);
- map.setCenter(markerend.getPosition());
- infoWindow.setContent(html2);
- infoWindow.open(map, markerend);
- });
- google.maps.event.addListener(markerend,"mouseover", function() {
- infoWindow.setContent(html2);
- infoWindow.open(map, markerend);
- });
- }
- function createInfoWindow(polyline, map, infoWindow, content2) {
- google.maps.event.addListener(polyline, 'click', function(event) {
- infoWindow.content = content2;
- infoWindow.position = event.latLng;
- infoWindow.open(map);
- });
- }
- function downloadUrl(url, callback) {
- var request = window.ActiveXObject ?
- new ActiveXObject('Microsoft.XMLHTTP') :
- new XMLHttpRequest;
- request.onreadystatechange = function() {
- if (request.readyState == 4) {
- request.onreadystatechange = doNothing;
- callback(request, request.status);
- }
- };
- request.open('GET', url, true);
- request.send(null);
- }
- function doNothing() {}
- //]]></script>
- <script type="text/javascript">
- $(document).ready(function () {
- var search = $('input').searchMeme({ onSearch: function (searchText) {
- setTimeout(function () {
- search.searchMeme({ searchComplete: true });
- alert('Search completed.');
- }, 3000);
- }
- , buttonPlacement: 'left', button: 'orange'
- });
- });
- </script>
- </head>
- <input type="text" class="search" id="address"/>
- <body onload="load()">
- <div id="map" style="position: absolute; left: 0px; top: 0px; width: 100%; height: 100%; z-index: 0;"></div><br/>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement