$value ) { if ( 'sex' == substr($key,0,3) ) { $sex_sel .= $value . ','; } else if ( 'rel' == substr($key,0,3) ) { $rel_sel .= $value . ','; } else if ( 'country' == $key ) { $country_sel = $value; } else if ( 'age' == substr($key,0,3) ) { if ( 'start' == substr($key,4) ) $age_start_sel = $value; if ( 'end' == substr($key,4) ) $age_end_sel .= $value; } else if ( 'online_only' == $key ) { $onl_only = 'on'; } else if ( 'photo_only' == $key ) { $pic_only = 'on'; } } // ================================================================================= // ================================================================================= $_ni = $_page['name_index']; $_page_cont[$_ni]['page_main_code'] = PageCompPageMainCode(); PageCode(); function PageCompPageMainCode() { global $sex_sel; global $rel_sel; global $country_sel; global $age_start_sel; global $age_end_sel; global $onl_only; global $pic_only; global $ID_PIC_DIR; global $ID_PIC_URL; global $site; global $p_num; global $page; global $pages_num; global $p_per_page; global $page_first_p; global $pages_num; global $search_start_age; global $search_end_age; global $thumb_width; global $thumb_height; global $enable_couple; $query = "SELECT * FROM ProfilesDesc WHERE `name` IN ( 'Sex', 'Relationship', 'Country')"; $res = db_res($query); while ( $arr = mysql_fetch_array( $res ) ) { switch ( $arr['name'] ) { case 'Sex' : $sex_sel = $sex_sel ? $sex_sel : 'male,female'; if( !$enable_couple ) { $arr['extra'] = str_replace( ',\'couple\'', '', $arr['extra']); } $sex_options = makeCheckbox( 'sex', $arr['extra'], $sex_sel ); break; case 'Relationship' : $rel_sel = $rel_sel ? $rel_sel : ''; $relationship_options1 = makeCheckbox( 'rel', $arr['extra'], $rel_sel, 0, 2, '
'); $relationship_options2 = makeCheckbox( 'rel', $arr['extra'], $rel_sel, 2, 2, '
'); $relationship_options3 = makeCheckbox( 'rel', $arr['extra'], $rel_sel, 4, 2, '
'); $relationship_options4 = makeCheckbox( 'rel', $arr['extra'], $rel_sel, 6, '', '
'); break; case 'Country' : $country_sel = $country_sel ? $country_sel : 'all'; //getParam('default_country'); $country_options = makeList( 'country', '' , $arr['extra'], $country_sel, 'onchange="javascript: flagImage = document.getElementById(\'flagImageId\'); if (this.value == \'all\') {flagImage.src = \''. $site['images'] .'spacer.gif\';} else {flagImage.src = \''. $site['url'] .'flags/\' + this.value.toLowerCase() + \'.gif\';}"' ); break; default : echo ":-)"; break; } } $age_start_sel = $age_start_sel ? $age_start_sel : '18'; $age_end_sel = $age_end_sel ? $age_end_sel : '60'; $age_option_start = makeList( 'age_start', "{$search_start_age}-{$search_end_age}", '', $age_start_sel); $age_option_end = makeList( 'age_end', "{$search_start_age}-{$search_end_age}", '', $age_end_sel); $photo_only_check = ''; $online_only_check = ''; $country_def_flag = ($country_sel == 'all' ? $site['images'].'spacer.gif' : $site['url'].'flags/'.strtolower($country_sel).'.gif'); $ret = '
' . _t('_Sex') . ':
' . $sex_options . '
' . _t('_DateOfBirth') . ':
' . _t("from") . ' ' . $age_option_start . '  ' . _t("to") . ' ' . $age_option_end . '
' . _t('_Looking for') . ':
' . $relationship_options1 . '
' . $relationship_options2 . '
' . $relationship_options3 . '
' . $relationship_options4 . '
' . _t('_Country') . ':
'. $country_options .' flag
' . $photo_only_check . ' ' . $online_only_check . '
'; //==================================================================================================== //----------------------- search results ------------------------------------------------- //==================================================================================================== $page = (int)$_GET[page]; $p_per_page = (int)$_GET[p_per_page]; if ( !$page ) $page = 1; if ( !$p_per_page ) $p_per_page = 20; $real_first_p = (int)($page - 1) * $p_per_page; $page_first_p = $real_first_p + 1; $temp_arr = explode(',', $sex_sel); foreach ( $temp_arr as $value ) if ( $value ) $sex_add .= 'couple' != $value ? " `Sex` = '$value' OR " : " `ProfileType` = '$value' OR "; $temp_arr = explode(',', $rel_sel); foreach ( $temp_arr as $value ) if ( $value ) $rel_add .= " `Relationship` LIKE \"%{$value}%\" OR "; if ( $country_sel && 'all' != $country_sel ) $country_add = " `Country` = '{$country_sel}' AND "; if ( $age_start_sel ) $age_add .= " ( (YEAR(NOW()) - {$age_start_sel}) >= YEAR(`DateofBirth`) ) AND "; if ( $age_end_sel ) $age_add .= " ( (YEAR(NOW()) - {$age_end_sel}) <= YEAR(`DateofBirth`) ) AND "; if ( $pic_only ) $pic_add = " AND `Picture` = '1' "; if ( $onl_only ) $onl_add = " AND (LastNavTime > SUBDATE(NOW(), INTERVAL " . getParam( "member_online_time" ) . " MINUTE)) "; $sex_add = $sex_add ? '(' . $sex_add . ' 1=0 ) AND ' : ''; $rel_add = $rel_add ? '(' . $rel_add . ' 1=0 ) AND ' : ''; $age_add = $age_add ? '(' . $age_add . ' 1=1 )' : ''; $sql_add = $sex_add . $rel_add . $country_add . $age_add . $pic_add . $onl_add; $p_num = db_arr( "SELECT COUNT(*) FROM Profiles WHERE $sql_add AND `Status` = 'Active'" ); $p_num = $p_num[0]; $pages_num = ceil( $p_num / $p_per_page ); $profiles_list_query = "SELECT `ID`, `NickName`, `Sex`, `DateOfBirth` FROM Profiles WHERE $sql_add AND `status`='Active' ORDER BY `Picture` DESC LIMIT $real_first_p, $p_per_page;"; $function = ' $ret = \'?\'; foreach ( $_GET as $key => $value ) if ( $value ) $ret .= $key . \'=\' . $value . \'&\'; return $ret; '; $ret .= '
'; $ret .= '
' . ResNavigationRet( 'ProfilesUpper', 0, $function ) . '
'; if ( $p_num > 0) { $res = db_res( $profiles_list_query ); while ( $arr = mysql_fetch_array( $res ) ) { $user_is_online = get_user_online_status($arr[ID]); $cont = get_member_thumbnail($arr['ID'], 'none' ) . '
' . '
' . getProfileOnlineStatus( $user_is_online ) . '
'; $ret .= DesignBoxContentBorder( process_line_output( strmaxtextlen( $arr['NickName'], 11 ) ) . ': ' . age( $arr['DateOfBirth'] ) . ' ' . _t('_y/o'), $cont ); } } else { $ret .= '
'; $ret .= '
' . _t('_No results found') . '
'; $ret .= '
'; } $ret .= '
' . ResNavigationRet( 'ProfilesLower', 0, $function ) . '
'; $ret .= '
'; return $ret; } function makeCheckbox( $name, $variants, $selected, $offset_start = '', $offset_amount = '', $delimiter = '' ) { $variants = str_replace('\'', '', $variants); $arr = split(',', $variants); $temp_arr = explode(',', $selected); $ret = ''; $i = 0; foreach ( $arr as $value ) { if ( !$offset_start || ( $offset_start && $offset_start <= $i) ) if ( !$offset_amount || ( $offset_amount && ($offset_start + $offset_amount) > $i ) ) { if ( $selected && in_array($value, $temp_arr) ) $sel = 'checked="checked"'; else $sel = ''; $ret .= "' . $delimiter; } $i++; } return $ret; } function makeList( $name, $digit_range, $func, $selected='', $js='' ) { $ret = ''; $ret .= "'; return $ret; } ?>