-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpull.php-prospective-seller
More file actions
executable file
·28 lines (28 loc) · 2.63 KB
/
pull.php-prospective-seller
File metadata and controls
executable file
·28 lines (28 loc) · 2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
$db = mysqli_connect("piperpal.mysql.domeneshop.no","piperpal","FiFLHHPxyR7PXUg","piperpal");
$query = "SELECT DISTINCT id,name,service,location,modified,created,glat,glon,paid,token,type,email,111.045*DEGREES(ACOS(COS(RADIANS(latpoint))*COS(RADIANS(glat))*COS(RADIANS(longpoint)-RADIANS(glon))+SIN(RADIANS(latpoint))*SIN(RADIANS(glat)))) AS distance_in_km FROM piperpal JOIN (SELECT " . $_GET['glat'] . " AS latpoint, " . $_GET['glon'] . " AS longpoint) AS p ON 1=1 WHERE name = '" . $_GET['name'] . "' ORDER BY distance_in_km";
$result = $db->query($query);
$num_coords = mysqli_num_rows($result);
if ($num_coords == 0) {
print "<form onsubmit='updateGeo()' id='lnsForm' name='lnsForm' action='https://www.piperpal.com/checkout.php' method='POST'>";
print "<input type='hidden' name='c' value='INSERT' />\n";
print "<table cellpadding=5><tr>";
print "<td><a href='http://piperpal.com/" . $_POST['name'] . "'><img border=0 width=16 height=16 src='/js-icon.png' /></td>";
print "<td><input size=16 type=text name=name class=biginput id=name placeholder='Name' value='" . $_POST['name'] . "' /></td>\n";
print "<td><input size=20 type=text name=location class=biginput id=location placeholder='http://' value='" . $_SERVER['HTTP_REFERER'] . "' /></td>\n";
print "<td><input size=16 type=text name=service class=biginput id=service placeholder='Service' /></td>\n";
print "<div id='status'><input type='hidden' name='glat' placeholder='Latitude' size=16 value='" . $_POST['glat'] . "' /><input type='hidden' name='glon' placeholder='Longitude' size=16 value='" . $_POST['glon'] . "' /></div>\n";
print "<td><form action='' method='POST'><script src='https://checkout.stripe.com/checkout.js' class='stripe-button' data-key='pk_live_9UbKhDJJWaAFnMjYQTBA8I9i00H8Z5eMmL' data-amount='43' data-name='Aamot Software' data-description='Piperpal Location Entry (43 cent)' data-image='/128x128.png'></script></td>";
print "</tr>\n";
print "</form>\n";
} else {
print "<p>$(function(){\n var locations = [\n";
while($object = mysqli_fetch_object($result)) {
print " { id: '" . $object->id . "', name: '" . $object->name . "', service: '" . $object->service . "', location: '" . $object->location . "', modified: '" . $object->modified . "', created: '" . $object->created . "', glat: '" . $object->glat . ", glon: '" . $object->glon . "', paid: '" . $object->paid . "', token: '" . $object->token . "', type: '" . $object->type . "', email: '" . $object->email . "' },<br>\n";
}
print "];</p>";
echo '<p>Latitude: '.$_GET['glat'].'<br>';
echo 'Longitude: '.$_GET['glon'] .'<br>';
echo 'Location: '.$_GET['location'] .'</p>';
}
?>