I'm not sure that'll help, as I'm positive it's how ?h is being handled. But I digress, I'll add in debugging echos and see if there's anything I'm failing to account for. I may have been unclear above, but if I change $_GET['h'] in the header to a k or anything else, the list of maps is viewable when I do ?h. Maybe the $_GET on the index is somehow clashing with the header? I've tried putting $ismap = isset($_GET['h']) in the same else if on the index with no change. I'll try it again though.

map_php.php wrote:

Code:
<?php
   include_once('map_sql.php');
   $mapdb      = "**";
   $maptables   = "SHOW TABLES FROM $mapdb";
   $mapresult = mysqli_query($mapcon, $maptables);
   $latitude=null;
   $longitude=null;
   $user = "Alex";
   
   // Set the sub title for the page
   $header_title = " | Map";
   
   // $_GET
   if(isset($_GET['map'])) {$map = $_GET['map'];} else {$map = null;}
   $map = preg_replace("/[^0-9]/", '', $map);
   $map = htmlspecialchars($map);
   
   $map ="$user$$map";
?>


map_script.php wrote:

Code:
    <style type="text/css">
      #map-canvas {
        height: 500px;
        width: 1000px;
        margin: 0px;
        padding: 10px
      }
    </style>
   
   <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&signed_in=true"></script>
   
    <script>
function initialize() {
  var mapOptions = {
    zoom: 10,
    center: new google.maps.LatLng(37.3226668,-121.8924502,12),
    mapTypeId: google.maps.MapTypeId.TERRAIN
  };

  var map = new google.maps.Map(document.getElementById('map-canvas'),
      mapOptions);

  var myHike = [
    <?php
      if($map) {
         $mapsql = "SELECT id, latitude, longitude FROM $map";
      // Not MySQLi compliant?
      #   $sql = "SELECT * FROM (SELECT @row := @row +1 AS id, latitude, longitude FROM ( SELECT @row :=0) r, $map ) ranked WHERE id %120 =1"
         $path = mysqli_query($mapcon,$mapsql) or die(mysqli_error($mapcon));
         
         while($point = mysqli_fetch_assoc($path)) {
            $row            =      $point["id"];
            $lat            =      $point["latitude"];
            $lon            =      $point["longitude"];
            
            // Set this variable to adjust the frequence/accuracy of the path
            ## Data is usually in one second intervals
            $time = 120;
            if($row %$time == 0) {
               // This is on two lines so I have a new line in the JS
               echo("new google.maps.LatLng($lat, $lon),
               ");
            }
         }
      } 
   ?>      
  ];
  var hikePath = new google.maps.Polyline({
    path: myHike,
    geodesic: true,
    strokeColor: '#FF0000',
    strokeOpacity: 1.0,
    strokeWeight: 2
  });
 
  hikePath.setMap(map);
}

google.maps.event.addDomListener(window, 'load', initialize);

    </script>
Google Tutorial


I created map_php because I needed to put stuff above the start of the HTML, such as the page title for the header.

Update:
Quote:
I've tried putting $ismap = isset($_GET['h']) in the same else if on the index with no change. I'll try it again though.

Did not work. It was actually $ismap = TRUE. I ended up getting an undefined variable, $ismap, in the header. Put global before the variable and killed the whole thing. I could store it as a session variable, I suppose. See if that helps.
For the last two and a half years I've let this site sit as it's required no upkeep or changes, which I've been thankful for. However, I went to upload some photos the other day and got a "Table not found" error when adding information to the database. It only affected the import script so it hasn't affected any visitor facing pages. I combed through the code but my comments on the SQL script are non-existent, which makes it hard to understand how I intended the script to work back then and why it's failing now as opposed to a few months ago. I sorted it out but it's more of a workaround than a real solution.

While going through the script and adding this issue to the Git repo, I decided to add some other issues and tackle those. Since my current web project is on the back burner for a short while, and the changes I want to bring to Alex Takes Pics are similar to the other project, I'll be able to implement these changes when I pick it up again.



So, I'll start by adjusting the page where I manage my uploads. Right now this is only good for viewing my uploads and by selecting the radio button and submitting the form, I can (un)hide photos. By clicking each line I'll eventually be able to add a description, set the title, and (un)hide or delete the photo. In the midst of this I want to finally implement rotating. The value is in the database but I can't get the script to rotate images. Which, isn't a huge problem but it is one I want to address.

I run most of my images through VSCO which automatically rotates the images based on the value stored in EXIF. However, if I take a photo in landscape orientation and upload it without any editing, the photo is displayed improperly. This behavior led me to implement the ability to hide photos; because one day I'll be able to show them properly.

This will give my the experience of editing data that is already in the database. This will benefit my other project because I'll be able to take this experience and allow users to edit their profiles. Which, granted, likely isn't that hard because it consists of pulling data from the database and inserting it back, and I have experience updating rows (from upvoting and downvoting) but this is the first time I'm manipulating data already in the database inside a user-editable form.

I'll be adding the ability to upload photos to this page as well. Currently I use an app on my phone to upload the photos via FTP. Which works fine but I have to go to a page on the site that runs a script to process the uploads. My goal here is to move that access away from a publicly accessible URL and place it behind the login page.

Some changes to the public pages are changes to the pagination. I'll finally be adding Next and Previous links, making the current page more visible since it's currently indistinguishable from the other pages. Lastly, the wedding portfolio is really hard to view. Since the images all run-in to each other, which makes it difficult to see each wedding separately. This will likely require a rewrite of the script as every portfolio and gallery is displayed by one script; I want to separate each wedding with a header that displays the date but I don't want that change to reflect in the other portfolios and galleries.

I also kind of want to redo the unique ID thing and perhaps do it correctly but that's a far bigger project than I'm ready for.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 3 of 3
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement