latlong_validate.php 385 B

123456789101112
  1. <?php
  2. // Validate input
  3. if (is_empty($VARS['lat']) || is_empty($VARS['long'])) {
  4. sendError("Missing information.", true);
  5. }
  6. if (!preg_match('/-?[0-9]{1,3}\.[0-9]{2,}/', $VARS['lat'])) {
  7. sendError("Latitude (lat) is in the wrong format.", true);
  8. }
  9. if (!preg_match('/-?[0-9]{1,3}\.[0-9]{2,}/', $VARS['long'])) {
  10. sendError("Longitude (long) is in the wrong format.", true);
  11. }