sopyanx

mikrotikgps.php

Aug 9th, 2019
277
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. // Create connection & CHANGE THE USER, PASSWORD AND DATABASE DETAILS
  3. $con=mysqli_connect("localhost","root","","gps");
  4.  
  5. // Check connection
  6. if (mysqli_connect_errno()) {
  7.   echo "Failed to connect to MySQL: " . mysqli_connect_error();
  8. }
  9.  
  10. // escape variables for security
  11. $identity = mysqli_real_escape_string($con, $_GET['identity']);
  12. $mac = mysqli_real_escape_string($con, $_GET['mac']);
  13. $latitude = mysqli_real_escape_string($con, $_GET['latitude']);
  14. $longitude = mysqli_real_escape_string($con, $_GET['longitude']);
  15. $lat = mysqli_real_escape_string($con, $_GET['lat']);
  16. $lng = mysqli_real_escape_string($con, $_GET['lng']);
  17. $date = mysqli_real_escape_string($con, $_GET['date']);
  18. $dbm = mysqli_real_escape_string($con, $_GET['dbm']);
  19. $technology = mysqli_real_escape_string($con, $_GET['technology']);
  20. $speed = mysqli_real_escape_string($con, $_GET['speed']);
  21. $altitude = mysqli_real_escape_string($con, $_GET['altitude']);
  22. $satellites = mysqli_real_escape_string($con, $_GET['satellites']);
  23.  
  24. $sql="INSERT INTO tbl_gps (identity, mac, latitude, longitude, lat, lng, date, dbm, technology, speed, altitude, satellites)
  25. VALUES ('$identity', '$mac', '$latitude', '$longitude', '$lat', '$lng', $date', '$dbm', '$technology', '$speed', '$altitude', '$satellites')";
  26.  
  27. if (!mysqli_query($con,$sql)) {
  28.   die('Error: ' . mysqli_error($con));
  29. }
  30. echo "1 record added";
  31.  
  32. mysqli_close($con);
  33.  
  34. //close mysql connection
  35. mysqli_close($con);
  36. ?>
RAW Paste Data