Advertisement
Guest User

oiuasdiahsd

a guest
Apr 9th, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title>Refugee</title>
  4. </head>
  5. <body>
  6. Input refugee's ID (you want '16345957'):
  7. <form method="POST" action="Refugee.php">
  8. <INPUT TYPE = "Text" NAME = "RefugeeID" ID = "RefugeeID"/>
  9. </form>
  10.  
  11. <?php
  12.  
  13. $servername = "localhost";
  14. $username = "messhub";
  15. $password = "REDACTED";
  16. $dbname = "messhub";
  17.  
  18. // Create connection
  19. $conn = new mysqli($servername, $username, $password, $dbname);
  20. // Check connection
  21. if ($conn->connect_error) {
  22. die("Connection failed: " . $conn->connect_error);
  23. }
  24. if(!empty($_POST)){
  25. try{
  26. $userNumber = $_POST['RefugeeID'];
  27. $sql = "SELECT H.`long`, H.`lat` FROM `log_dispense` AS L INNER JOIN `hub` AS H ON L.`idHub` = H.`idHub` WHERE L.`idUSER` = '" . $userNumber . "' GROUP BY H.`id`";
  28. $result = $conn->query($sql);
  29.  
  30. $url = "http://maps.google.com/maps/api/staticmap?center=Aidipsos,Greece&zoom=7&size=1920x1080&maptype=roadmap";
  31.  
  32. while($row = $result->fetch_assoc())
  33. {
  34. $url = $url . "&markers=" . $row["lattitude"] . "," . $row["longitude"];
  35. }
  36. $url = $url . "&sensor=false&key";
  37. header("Location: ". $url); /* Redirect browser */
  38. /*$url = htmlspecialchars_decode($url);*/
  39. /*echo $url;*/
  40.  
  41. $conn->close();
  42. }
  43. catch(Exception $e)
  44. {echo "Exception";}
  45. }
  46. ?>
  47. </body>
  48. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement