if ($id == '') { $txt = 'Add '; } else { $txt = 'Edit '; } if ($_POST['submitedit'] != '') { $err = ''; $listing_price = checknumeric('listing_price', 'Listing price'); $tax_amount = checknumeric('tax_amount', 'Tax Amount'); $beds_up = checknumeric('beds_up', 'Beds up'); $beds_down = checknumeric('beds_down', 'Beds down'); $full_baths = checknumeric('full_baths', 'Full baths'); $half_baths = checknumeric('half_baths', 'Half baths'); $building_age = checknumeric('building_age', 'Building age'); $square_footage = checknumeric('square_footage', 'Square footage'); $tax_year = checknumeric('tax_year', 'Tax year'); if ($id == '') { if ($err == '') { $sql = 'insert into tb_listings (listing_price,tax_amount,tax_year,subdivision,postalcode,building_no,street_name,public_overview,square_footage,garage_typeid,beds_up,beds_down'; $sql .= ',building_age,full_baths,half_baths,realtor1id) values (' . $listing_price . ',' . $tax_amount . ',' . $tax_year . ',' . $_POST['subdivision'] . ',"' . htmlentities($_POST['postalcode'], ENT_QUOTES); $sql .= '","' . htmlentities($_POST['building_no'], ENT_QUOTES) . '","' . htmlentities($_POST['street_name'], ENT_QUOTES) . '","' . htmlentities($_POST['public_overview'], ENT_QUOTES); $sql .= '",' . $square_footage . ',' . $_POST['garage_typeid'] . ',' . $beds_up . ',' . $beds_down . ',' . $building_age . ',' . $full_baths . ',' . $half_baths . ',' . $_SESSION['uid'] . ')'; echo $sql; $res = mysql_query($sql); if ($res) { $msg = 'Successfully created new listing'; } else { $err = 'Failure creating new listing ' . mysql_error(); } } } else {
$sql = 'select * from tb_realtor_municipality trm,tb_municipality tm where realtorid=' . $_SESSION['uid'] . ' and tm.id=trm.municipalityid'; $res = mysql_query($sql); $rw = mysql_fetch_array($res, MYSQL_ASSOC); if ($_POST['post42'] != '') { $err = ''; $listing_price = checknumeric('listing_price', 'Listing price'); $tax_amount = checknumeric('tax_amount', 'Tax Amount'); $beds_up = checknumeric('beds_up', 'Beds up'); $beds_down = checknumeric('beds_down', 'Beds down'); $full_baths = checknumeric('full_baths', 'Full baths'); $half_baths = checknumeric('half_baths', 'Half baths'); $building_age = checknumeric('building_age', 'Building age'); $square_footage = checknumeric('square_footage', 'Square footage'); $tax_year = checknumeric('tax_year', 'Tax year'); $monthly_fee = checknumeric('monthly_fee', 'Monthly Fee'); $acres = checknumeric('acres', 'Acres'); $address = $_POST['building_no'] . ' ' . $_POST['street_name'] . ' ' . $rw['name'] . ' ' . $rw['prov']; $request_url = $base_url . "&q=" . urlencode($address); $xml = simplexml_load_file($request_url) or die("url not loading"); $status = $xml->Response->Status->code; if (strcmp($status, "200") == 0) { $coordinates = $xml->Response->Placemark->Point->coordinates; $coordinatesSplit = split(",", $coordinates); $lat = $coordinatesSplit[1]; $lng = $coordinatesSplit[0]; } else { $lat = ''; $lng = ''; } if ($id == '') { if ($err == '') {