root 2009-04-05 00:31:11 +00:00
parent 4848d4d04d
commit 412a998a9a
2 changed files with 13 additions and 7 deletions

View file

@ -19,7 +19,15 @@
if(array_key_exists('assurance',$_REQUEST) && $_REQUEST['assurance'] > 0)
{
$assurance = mysql_escape_string(intval($_REQUEST['assurance']));
mysql_query("delete from `notary` where `id`='$assurance'");
$row = 0;
$res = mysql_query("select `to` from `notary` where `id`='$assurance'");
if ($res) {
$row = mysql_fetch_assoc($res);
}
mysql_query("delete from `notary` where `id`='$assurance'");
if ($row) {
fix_assurer_flag($row['to']);
}
}
if(intval(array_key_exists('userid',$_REQUEST)?$_REQUEST['userid']:0) <= 0)

View file

@ -98,16 +98,14 @@ document.f.location.focus();
$query = "SELECT ROUND(6378.137 * ACOS(0.9999999*((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`";
`users`.`id` as `uid`, `contactinfo` FROM `locations`, `users` WHERE `users`.`locid` = `locations`.`id` AND
`users`.`assurer` = 1 AND `users`.`listme` = 1 HAVING `distance` <= '$maxdist' ORDER BY `distance`";
} else {
$query = "SELECT ROUND(6378.137 * ACOS(0.9999999*((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";
`users`.`id` as `uid`, `contactinfo` FROM `locations`, `users` WHERE `users`.`locid` = `locations`.`id` AND
`users`.`assurer` = 1 AND `users`.`listme` = 1 HAVING `distance` <= '$maxdist' ORDER BY `distance` LIMIT 50";
//echo $query;
}
$res = mysql_query($query);