if (isset($_POST["addr_road"]) && !empty($_POST["addr_road"])) {
        $addr_road = $_POST["addr_road"];
    }
    if (isset($_POST["addr_amphur"]) && !empty($_POST["addr_amphur"])) {
        $addr_amphur = $_POST["addr_amphur"];
    }
    if (isset($_POST["addr_district"]) && !empty($_POST["addr_district"])) {
        $addr_district = $_POST["addr_district"];
    }
    if (isset($_POST["addr_province"]) && !empty($_POST["addr_province"])) {
        $addr_province = $_POST["addr_province"];
    }
    if (isset($_POST["addr_zipcode"]) && !empty($_POST["addr_zipcode"])) {
        $addr_zipcode = $_POST["addr_zipcode"];
    }
    $new_id = get_address_id($addr_num, $addr_village, $addr_alley, $addr_moo, $addr_road, $addr_district, $addr_amphur, $addr_province, $addr_zipcode);
    if ($addr_id != $new_id) {
        del_address($id, $addr_id, $type);
        add_address($id, $addr_num, $addr_village, $addr_alley, $addr_moo, $addr_road, $addr_district, $addr_amphur, $addr_province, $addr_zipcode, $type);
    }
}
if (isset($_POST["organizationtype"]) && !empty($_POST["organizationtype"]) && $organization_id != 0) {
    $organization_sql = get_organization($id, $organization_id);
    $organization = mysql_fetch_assoc($organization_sql);
    if ($_POST["organizationtype"] != $organization["ORGANIZATION_TYPE_ID"]) {
        $query = "UPDATE `organization` SET `ORGANIZATION_TYPE_ID`='" . $_POST['organizationtype'] . "' WHERE `ID`={$organization_id}";
        mysql_query($query);
    }
}
if (isset($_POST["organization_comment"]) && !empty($_POST["organization_comment"]) && $organization_id != 0) {
    $organization_sql = get_organization($id, $organization_id);
Example #2
0
function add_address_to_wb_list($user_id, $addr, $wb)
{
    global $dbh;
    $matches = array();
    # look for an email address of the form <user@domain>
    if (preg_match('/<(\\S+\\@\\S+\\.\\S+)>/', $addr, $matches) > 0) {
        $addr = $matches[1];
    } elseif (preg_match("/(\\S+\\@\\S+\\.\\S+)/", $addr, $matches) > 0) {
        $addr = $matches[1];
    }
    $addr = fix_address($addr);
    $addr_id = get_address_id($addr);
    if (substr($addr, 0, 1) == '@') {
        $addr = "*" . $addr;
    }
    if ($addr_id == 0) {
        $addr_id = add_address($addr);
        add_wb_entry($user_id, $addr_id, $wb);
        return 'text_wb_address_added';
    } else {
        $wb_stat = get_wb_status($user_id, $addr_id);
        if ($wb_stat == '') {
            add_wb_entry($user_id, $addr_id, $wb);
            return 'text_wb_address_added';
        } else {
            if ($wb_stat != $wb) {
                set_wb_status($user_id, $addr_id, $wb);
            }
            return 'text_wb_address_changed';
        }
    }
}