Example #1
0
function getSearchCondition($s, $email, $searchsign)
{
    global $_MooClass, $dbTablePre, $user_arr;
    //note 获取搜索条件
    $sr = $_MooClass['MooMySQL']->getOne("select * from `{$dbTablePre}searchbak` where `scid` = '{$s}'");
    //note 以下是不同的会员信息正则转换
    $body = $sr['searchcondition'];
    preg_match("/<gender>(.*)<\\/gender>/isU", $body, $gender_arr);
    $gender = isset($gender_arr[1]) ? $gender_arr[1] : 0;
    preg_match("/<age_start>(.*)<\\/age_start>/isU", $body, $age_start_arr);
    $age_start = isset($age_start_arr[1]) ? $age_start_arr[1] : 0;
    preg_match("/<age_end>(.*)<\\/age_end>/isU", $body, $age_end_arr);
    $age_end = isset($age_end_arr[1]) ? $age_end_arr[1] : 0;
    preg_match("/<work_province>(.*)<\\/work_province>/isU", $body, $work_province_arr);
    $work_province = isset($work_province_arr[1]) ? $work_province_arr[1] : 0;
    preg_match("/<work_city>(.*)<\\/work_city>/isU", $body, $work_city_arr);
    $work_city = isset($work_city_arr[1]) ? $work_city_arr[1] : 0;
    preg_match("/<marriage>(.*)<\\/marriage>/isU", $body, $marriage_arr);
    $marriage = 0;
    if (isset($marriage_arr[1])) {
        if ($marriage_arr[1] == '-1' || $marriage_arr[1] == '-2') {
            $marriage = $marriage_arr[1];
        } else {
            $marriage = explode(",", $marriage_arr[1]);
        }
    }
    preg_match("/<salary>(.*)<\\/salary>/isU", $body, $salary_arr);
    $salary = 0;
    if (isset($salary_arr[1])) {
        if ($salary_arr[1] == '-1' || $salary_arr[1] == '-2') {
            $salary = $salary_arr[1];
        } else {
            $salary = explode(",", $salary_arr[1]);
        }
    }
    preg_match("/<education>(.*)<\\/education>/isU", $body, $education_arr);
    $education = 0;
    if (isset($education_arr[1])) {
        if ($education_arr[1] == '-1' || $education_arr[1] == '-2') {
            $education = $education_arr[1];
        } else {
            $education = explode(",", $education_arr[1]);
        }
    }
    preg_match("/<height1>(.*)<\\/height1>/isU", $body, $height1_arr);
    $height1 = isset($height1_arr[1]) ? $height1_arr[1] : 0;
    preg_match("/<height2>(.*)<\\/height2>/isU", $body, $height2_arr);
    $height2 = isset($height2_arr[1]) ? $height2_arr[1] : 0;
    preg_match("/<weight1>(.*)<\\/weight1>/isU", $body, $weight1_arr);
    $weight1 = isset($weight1_arr[1]) ? $weight1_arr[1] : 0;
    preg_match("/<weight2>(.*)<\\/weight2>/isU", $body, $weight2_arr);
    $weight2 = isset($weight2_arr[1]) ? $weight2_arr[1] : 0;
    preg_match("/<body1>(.*)<\\/body1>/isU", $body, $body_arr);
    $body1 = 0;
    if (isset($body_arr[1])) {
        if ($body_arr[1] == '-1' || $body_arr[1] == '-2') {
            $body1 = $body_arr[1];
        } else {
            $body1 = explode(",", $body_arr[1]);
        }
    }
    preg_match("/<smoking>(.*)<\\/smoking>/isU", $body, $smoking_arr);
    $smoking = 0;
    if (isset($smoking_arr[1])) {
        if ($smoking_arr[1] == '-1' || $smoking_arr[1] == '-2') {
            $smoking = $smoking_arr[1];
        } else {
            $smoking = explode(",", $smoking_arr[1]);
        }
    }
    preg_match("/<drinking>(.*)<\\/drinking>/isU", $body, $drinking_arr);
    $drinking = 0;
    if (isset($drinking_ar[1])) {
        if ($drinking_arr[1] == '-1' || $drinking_arr[1] == '-2') {
            $drinking = $drinking_arr[1];
        } else {
            $drinking = explode(",", $drinking_arr[1]);
        }
    }
    preg_match("/<occupation>(.*)<\\/occupation>/isU", $body, $occupation_arr);
    $occupation = 0;
    if (isset($occupation_arr[1])) {
        if ($occupation_arr[1] == '-1' || $occupation_arr[1] == '-2') {
            $occupation = $occupation_arr[1];
        } else {
            $occupation = explode(",", $occupation_arr[1]);
        }
    }
    preg_match("/<house>(.*)<\\/house>/isU", $body, $house_arr);
    $house = 0;
    if (isset($house_arr[1])) {
        if ($house_arr[1] == '-1' || $house_arr[1] == '-2') {
            $house = $house_arr[1];
        } else {
            $house = explode(",", $house_arr[1]);
        }
    }
    preg_match("/<vehicle>(.*)<\\/vehicle>/isU", $body, $vehicle_arr);
    $vehicle = 0;
    if (isset($vehicle_arr[1])) {
        if ($vehicle_arr[1] == '-1' || $vehicle_arr[1] == '-2') {
            $vehicle = $vehicle_arr[1];
        } else {
            $vehicle = explode(",", $vehicle_arr[1]);
        }
    }
    preg_match("/<corptype>(.*)<\\/corptype>/isU", $body, $corptype_arr);
    $corptype = 0;
    if (isset($corptype_ar[1])) {
        if ($corptype_arr[1] == '-1' || $corptype_arr[1] == '-2') {
            $corptype = $corptype_arr[1];
        } else {
            $corptype = explode(",", $corptype_arr[1]);
        }
    }
    preg_match("/<children>(.*)<\\/children>/isU", $body, $children_arr);
    $children = 0;
    if (isset($children_arr[1])) {
        if ($children_arr[1] == '-1' || $children_arr[1] == '-2') {
            $children = $children_arr[1];
        } else {
            $children = explode(",", $children_arr[1]);
        }
    }
    preg_match("/<wantchildren>(.*)<\\/wantchildren>/isU", $body, $wantchildren_arr);
    $wantchildren = 0;
    if (isset($wantchildren_arr[1])) {
        if ($wantchildren_arr[1] == '-1' || $wantchildren_arr[1] == '-2') {
            $wantchildren = $wantchildren_arr[1];
        } else {
            $wantchildren = explode(",", $wantchildren_arr[1]);
        }
    }
    preg_match("/<home_townprovince>(.*)<\\/home_townprovince>/isU", $body, $home_townprovince_arr);
    $home_townprovince = isset($home_townprovince_arr[1]) ? $home_townprovince_arr[1] : 0;
    preg_match("/<home_towncity>(.*)<\\/home_towncity>/isU", $body, $home_towncity_arr);
    $home_towncity = isset($home_towncity_arr[1]) ? $home_towncity_arr[1] : 0;
    preg_match("/<nation>(.*)<\\/nation>/isU", $body, $nation_arr);
    $nation = isset($nation_arr[1]) ? $nation_arr[1] : 0;
    preg_match("/<animalyear>(.*)<\\/animalyear>/isU", $body, $animalyear_arr);
    $animalyear = 0;
    if (isset($animalyear_arr[1])) {
        if ($animalyear_arr[1] == '-1' || $animalyear_arr[1] == '-2') {
            $animalyear = $animalyear_arr[1];
        } else {
            $animalyear = explode(",", $animalyear_arr[1]);
        }
    }
    preg_match("/<constellation>(.*)<\\/constellation>/isU", $body, $constellation_arr);
    $constellation = 1;
    if (isset($constellation_arr[1])) {
        if ($constellation_arr[1] == '-1' || $constellation_arr[1] == '-2') {
            $constellation = $constellation_arr[1];
        } else {
            $constellation = explode(",", $constellation_arr[1]);
        }
    }
    preg_match("/<bloodtype>(.*)<\\/bloodtype>/isU", $body, $bloodtype_arr);
    $bloodtype = 0;
    if (isset($bloodtype_arr[1])) {
        if ($bloodtype_arr[1] == '-1' || $bloodtype_arr[1] == '-2') {
            $bloodtype = $bloodtype_arr[1];
        } else {
            $bloodtype = explode(",", $bloodtype_arr[1]);
        }
    }
    preg_match("/<religion>(.*)<\\/religion>/isU", $body, $religion_arr);
    $religion = 0;
    if (isset($religion_arr[1])) {
        if ($religion_arr[1] == '-1' || $religion_arr[1] == '-2') {
            $religion = $religion_arr[1];
        } else {
            $religion = explode(",", $religion_arr[1]);
        }
    }
    preg_match("/<family>(.*)<\\/family>/isU", $body, $family_arr);
    $family = 0;
    if (isset($family_arr[1])) {
        if ($family_arr[1] == '-1' || $family_arr[1] == '-2') {
            $family = $family_arr[1];
        } else {
            $family = explode(",", $family_arr[1]);
        }
    }
    preg_match("/<language1>(.*)<\\/language1>/isU", $body, $language_arr);
    $language = 0;
    if (isset($language_arr[1])) {
        if ($language_arr[1] == '-1' || $language_arr[1] == '-2') {
            $language = $language_arr[1];
        } else {
            $language = explode(",", $language_arr[1]);
        }
    }
    preg_match("/<photo>(.*)<\\/photo>/isU", $body, $photo_arr);
    $photo = 0;
    if (isset($photo_arr[1])) {
        if ($photo_arr[1] == '-1' || $photo_arr[1] == '-2') {
            $photo = $photo_arr[1];
        } else {
            $photo = explode(",", $photo_arr[1]);
        }
    }
    if ($gender == -1) {
        $gender = 1;
    }
    if ($age_start == -1) {
        $age_start = 0;
    }
    if ($age_end == -1) {
        $age_end = 0;
    }
    if ($work_province == -1) {
        $work_province = 0;
    } elseif ($work_province == -2) {
        $work_province = 2;
    }
    if ($work_city == -1) {
        $work_city = 0;
    }
    if ($marriage == -1) {
        $marriage = 0;
    }
    if ($salary == -1) {
        $salary = 0;
    }
    if ($education == -1) {
        $education = 0;
    }
    if ($height1 == -1) {
        $height1 = 0;
    }
    if ($height2 == -1) {
        $height2 = 0;
    }
    if ($weight1 == -1) {
        $weight1 = 0;
    }
    if ($weight2 == -1) {
        $weight2 = 0;
    }
    if ($body == -1) {
        $body = 0;
    }
    if ($smoking == -1) {
        $smoking = 0;
    }
    if ($drinking == -1) {
        $drinking = 0;
    }
    if ($occupation == -1) {
        $occupation = 0;
    }
    if ($house == -1) {
        $house = 0;
    }
    if ($vehicle == -1) {
        $vehicle = 0;
    }
    if ($corptype == -1) {
        $corptype = 0;
    }
    if ($children == -1) {
        $children = 0;
    }
    if ($wantchildren == -1) {
        $wantchildren = 0;
    }
    if ($home_townprovince == -1) {
        $home_townprovince = 0;
    } elseif ($home_townprovince) {
        $home_townprovince = 2;
    }
    if ($home_towncity == -1) {
        $home_towncity = 0;
    }
    if ($nation == -1) {
        $nation = 0;
    }
    if ($animalyear == -1) {
        $animalyear = 0;
    }
    if ($constellation == -1) {
        $constellation = 0;
    }
    if ($bloodtype == -1) {
        $bloodtype = 0;
    }
    if ($religion == -1) {
        $religion = 0;
    }
    if ($family == -1) {
        $family = 0;
    }
    if ($language == -1) {
        $language = 0;
    }
    if ($photo == -1) {
        $photo = 0;
    }
    advance_search($gender, $age_start, $age_end, $work_province, $work_city, $marriage, $salary, $education, $height1, $height2, $weight1, $weight2, $body, $smoking, $drinking, $occupation, $house, $vehicle, $corptype, $children, $wantchildren, $home_townprovince, $home_towncity, $nation, $body1, $animalyear, $constellation, $bloodtype, $religion, $family, $language, $photo, $email, $searchsign);
}
Example #2
0
         if ($religion == -1) {
             $religion = 0;
         }
         if ($family == -1) {
             $family = 0;
         }
         if ($language == -1) {
             $language = 0;
         }
         if ($photo == -1) {
             $photo = 0;
         }
         //note 条件查询
         advance_search_page($gender, $age_start, $age_end, $work_province, $work_city, $marriage, $salary, $education, $height1, $height2, $weight1, $weight2, $body, $smoking, $drinking, $occupation, $house, $vehicle, $corptype, $children, $wantchildren, $home_townprovince, $home_towncity, $nation, $animalyear, $constellation, $bloodtype, $religion, $family, $language, $photo);
     } else {
         advance_search();
     }
     break;
 case 'add_del_search':
     //note 增加、删除的搜索条件
     //note 性别
     $gender = isset($_GET['gender']) ? trim(MooGetGPC('gender', 'integer', 'G')) : 0;
     //note 不超过年龄和不低于年龄
     $age_start = isset($_GET['age_start']) ? trim(MooGetGPC('age_start', 'integer', 'G')) : 0;
     $age_end = isset($_GET['age_end']) ? trim(MooGetGPC('age_end', 'integer', 'G')) : 0;
     //note 工作省、市
     $work_province = isset($_GET['workprovince']) ? trim(MooGetGPC('workprovince', 'integer', 'G')) : 0;
     $work_city = isset($_GET['workcity']) ? trim(MooGetGPC('workcity', 'integer', 'G')) : 0;
     //note 修正广东省深圳和广州的区域查询
     if (in_array($work_province, array(10101201, 10101002))) {
         $work_city = $work_province;