if($_REQUEST['location'] == "") { ?>
=_("Please enter your town or suburb name, followed by region or state or province and then the country (please separate by commas)")?>
=_("eg Sydney, New South Wales, Australia")?>
=_("This is an AJAX form which depends heavily on javascript for auto-complete functionality and while it will work without javascript the usability will be heavily degraded.")?>
} else { if(intval($_REQUEST['location']) == 0) { $bits = explode(",", $_REQUEST['location']); $loc = trim(mysql_escape_string($bits['0'])); $reg = trim(mysql_escape_string($bits['1'])); $ccname = trim(mysql_escape_string($bits['2'])); $query = "select `locations`.`id` as `locid` from `locations`, `regions`, `countries` where `locations`.`name` like '$loc%' and `regions`.`name` like '$reg%' and `countries`.`name` like '$ccname%' and `locations`.`regid`=`regions`.`id` and `locations`.`ccid`=`countries`.`id` order by `locations`.`name` limit 1"; $res = mysql_query($query); if($reg != "" && $ccname == "" && mysql_num_rows($res) <= 0) { $query = "select `locations`.`id` as `locid` from `locations`, `regions`, `countries` where `locations`.`name` like '$loc%' and `countries`.`name` like '$reg%' and `locations`.`regid`=`regions`.`id` and `locations`.`ccid`=`countries`.`id` order by `locations`.`name` limit 1"; $res = mysql_query($query); } if(mysql_num_rows($res) <= 0) die(_("Unable to find suitable location")); $row = mysql_fetch_assoc($res); $_REQUEST['location'] = $row['locid']; } $maxdist = intval($_REQUEST['maxdist']); $locid = intval($_REQUEST['location']); $query = "select * from `locations` where `id`='$locid'"; $loc = mysql_fetch_assoc(mysql_query($query)); if($maxdist <= 10) { $query = "SELECT ROUND(6378.137 * ACOS((SIN(PI() * $loc[lat] / 180) * SIN(PI() * `locations`.`lat` / 180)) + (COS(PI() * $loc[lat] / 180 ) * COS(PI() * `locations`.`lat` / 180) * COS(PI() * `locations`.`long` / 180 - PI() * $loc[long] / 180))), -1) AS `distance`, `locations`.`name` AS `location`, concat(`users`.`fname`, ' ', LEFT(`users`.`lname`, 1)) AS `name`, `long`, `lat`, `users`.`id` as `uid`, `contactinfo` FROM `locations`, `users`, `notary` WHERE `users`.`locid` = `locations`.`id` AND `users`.`id` = `notary`.`to` AND `users`.`listme` = 1 GROUP BY `notary`.`to` HAVING SUM(`notary`.`points`) >= 100 AND `distance` <= '$maxdist' ORDER BY `distance`"; } else { $query = "SELECT ROUND(6378.137 * ACOS((SIN(PI() * $loc[lat] / 180) * SIN(PI() * `locations`.`lat` / 180)) + (COS(PI() * $loc[lat] / 180 ) * COS(PI() * `locations`.`lat` / 180) * COS(PI() * `locations`.`long` / 180 - PI() * $loc[long] / 180))), -1) AS `distance`, `locations`.`name` AS `location`, concat(`users`.`fname`, ' ', LEFT(`users`.`lname`, 1)) AS `name`, `long`, `lat`, `users`.`id` as `uid`, `contactinfo` FROM `locations`, `users`, `notary` WHERE `users`.`locid` = `locations`.`id` AND `users`.`id` = `notary`.`to` AND `users`.`listme` = 1 GROUP BY `notary`.`to` HAVING SUM(`notary`.`points`) >= 100 AND `distance` <= '$maxdist' ORDER BY `distance` LIMIT 50"; } $res = mysql_query($query); ?>=_("Name")?> | =_("Distance")?> | =_("Max Points")?> | =_("Contact Details")?> | =_("Email Assurer")?> |
=$row['distance']?>km | =$points?> | =$row['contactinfo']?> | =_("Email Me")?> |