blackrose59 Posted November 21, 2006 Share Posted November 21, 2006 Hi everyone. I'm new here and would like to ask that you bear with me. I'm not a coder and have just a very basic understanding of how to do code. I have a website that is based on tufat's matchmaking script. The original files called for the genders to be simply Man/Woman/Couple I changed that in the language file and the tpl files to be completely different. Now I'm having an issue with the search function now working properly. I really could use some help fixing this so that the search function performs properly and brings back the genders that the members are seeking which turn out to be BDSM roles rather than their sex. Here is the coding I have redone so far.Language File Changes: $lang['signup_gender_values'] = array( 'M' => 'Dominant', 'F' => 'Female sub', 'C' => 'Couple', 'S' => 'Male Sub', 'D => 'Dominatrix', 'V' => 'Male slave', 'Y' => 'Female slave', 'X' => 'TS/TV/TG', 'U' => 'Not Into BDSM', 'L' => 'Other' ); $lang['signup_gender_look'] = array( 'N' => 'Dominant', 'F' => 'Female sub', 'C' => 'Couple', 'B' => 'Female sub/Male sub', 'M' => 'Male Sub', 'D' => 'Dominatrix', 'S' => 'Male slave', 'T' => 'Female slave', 'X' => 'TS/TV/TG', 'U' => 'Not Into BDSM', 'L' => 'Other', 'A' => 'All' ); The code change in the advsearch.php is:$txtgender_search = "and (user.lookgender = 'A' or (user.lookgender = 'B' and '".$usergender."' in ('M','F','C','N','B','D','S','T','X','U','L') ) or user.lookgender = '".$usergender."') "; Code I changed in the extmatch.php file is this:$txtgender_search = ''; if ($_REQUEST['txtgender']) { $txtgender_search = ' user.lookgender in ( '; foreach ($_REQUEST['txtgender'] as $key => $val) { if ($txtgender_search != ' user.lookgender in ( ') { $txtgender_search .= ', '; } if ($val == 'A') { $txtgender_search = " ( user.lookgender <> 'A'"; } elseif ($val == 'B') { $txtgender_search .= "'M','F','C','N','B','D','S','T','X','U','L'"; } else { $txtgender_search .= "'".$val."'"; } } and this:if ($txtgender_search != '') { $sqlwhere .= ' AND '. $txtgender_search; } if (strlen($_REQUEST['txtlookgender']) > 0 ) { $lookgender_search = ' user.gender in ( '; foreach ($_REQUEST['txtlookgender'] as $key => $val) { if ($lookgender_search != ' user.gender in ( ') { $lookgender_search .= ', '; } if ($val == 'A' ) { $lookgender_search = "( user.gender <> 'A' "; } elseif ($val == 'B' ) { $lookgender_search .= "'M','F','C','N','B','D','S','T','X','U','L'"; } else { $lookgender_search .= "'".$val."'"; } } In the getsnap.php the code now looks like this:} else { if ($gender == 'M') { $nopic = './images/male.jpg'; } elseif ($gender == 'F') { $nopic = './images/female.jpg'; } elseif ($gender == 'C') { $nopic = './images/couple.jpg'; } elseif ($gender == 'S') { $nopic = './images/male.jpg'; } elseif ($gender == 'D') { $nopic = './images/female.jpg'; } elseif ($gender == 'V') { $nopic = './images/male.jpg'; } elseif ($gender == 'Y') { $nopic = './images/female.jpg'; } elseif ($gender == 'X') { $nopic = './images/female.jpg'; } elseif ($gender == 'U') { $nopic = './images/female.jpg'; } elseif ($gender == 'L') { $nopic = './images/male.jpg'; } $img2 = imagecreatefromjpeg($nopic); } change to index.php is:/* Get list of latest 10 userid */ $sqlNew = "SELECT id, username, floor(period_diff(extract(year_month from NOW()),extract(year_month from birth_date))/12) as age, (case gender when 'M' then 'Dominant' when 'F' then 'Female sub' when 'S' then 'Male Sub when 'D' then 'Dominatrix'when 'V' then 'Male slave' when 'Y' then 'Female slave' when 'X' then 'TS/TV/TG' when 'U' then "Not Into BDSM' when 'L' then 'Other' else 'Couple' end ) as gender, allow_viewonline, city, country, state_province FROM ! WHERE status in (?, ?) ".$bannedlist." ORDER BY regdate DESC LIMIT 0,".$config['list_newmembers']; $newUsersList = $db->getAll( $sqlNew, array( USER_TABLE, get_lang('status_enum','active'), 'active' )); $list = array(); foreach ($newUsersList as $row) { The change I made to the init.php was this:/***********************************/ /* Collect site statistics */ /***********************************/ $sql = 'select count(*) from ! where active = ? and regdate > ? and status in ( ?, ?) '; $weekcnt = $db->getOne( $sql, array( USER_TABLE, '1', strtotime("-7 day"), 'active', get_lang('status_enum','active') ) ); $t->assign( 'weekcnt', $weekcnt ); $sql = 'select sum(if(gender=\'M\',1,0)) as Dominants, sum(if(gender=\'F\',1,0)) as female subs, sum(if(gender=\'C\',1,0)) as couples, sum(if(gender=\'S\',1,0)) as male subs, sum(if(gender=\'D\',1,0))as Dominatrixs, sum(if(gender=\'V\',1,0))as male slaves, sum(if(gender=\'Y\',1,0))as female slaves, sum(if(gender=\'X\',1,0))as TS TV TG, sum(if(gender=\'U\',1,0))as Not Into BDSM, sum(if(gender=\'L\',1,0))as other from ! where active = ? and status in (?, ?)'; $row = $db->getRow( $sql, array( USER_TABLE, '1', 'active', get_lang('status_enum','active') ) ); $t->assign( 'Dominants', $row['Dominants'] ); $t->assign( 'female subs', $row['female subs'] ); $t->assign( 'couples', $row['couples'] ); $t->assign( 'male subs', $row['male subs'] ); $t->assign( 'Dominatrixs', $row['Dominatrixs'] ); $t->assign( 'male slaves', $row['male slaves'] ); $t->assign( 'female slaves', $row['female slaves'] ); $t->assign( 'TS TV TG', $row['TS TV TG'] ); $t->assign( 'Not Into BDSM', $row['Not Into BDSM'] ); $t->assign( 'Other', $row['Other'] ); $sql = 'select count(*) from ! where ins_time > ? '; $weeksnaps = $db->getOne( $sql, array( USER_SNAP_TABLE, strtotime("-7 day") ) ); $t->assign( 'weeksnaps', $weeksnaps ); In the mymatches.php I am unsure what to change here and need some help on this one. Currently it says:$txtgender_search = " AND user.lookgender in ( 'A', "; if ($user['gender'] == 'M' or $user['gender'] == 'F') { $txtgender_search .= "'B',"; } $txtgender_search .= "'".$user['gender']."' )"; $txtlookgender_search = ''; if ($user['lookgender'] == 'B') { $txtlookender_search = " AND user.gender in ('M','F') "; } elseif ($user['lookgender'] != 'A') { $txtlookgender_search = " AND user.gender = '".$user['lookgender']."' "; } What do I change in this file?In the searchmatch.php I have made these changes although I think I might be wrong on this one as well:$lookgender_search = " AND usr.lookgender in ('A' "; if ($_REQUEST['txtgender'] == 'M' || $_REQUEST['txtgender'] == 'F') { $lookgender_search .= ",'B'"; } $lookgender_search .= ",'".$_REQUEST['txtgender']."') "; $gender_search = " AND usr.gender in ( "; if ($_REQUEST['txtlookgender'] == 'A') { $gender_search .= "'M','F','C','S','T','N','D','V','Y','X','U','L'"; } elseif ( $_REQUEST['txtlookgender'] == 'B') { $gender_search .= "'N','F','D','S','T','D','Y','X','U','L'"; } else { $gender_search .= "'".$_REQUEST['txtlookgender']."'"; } The userstats.php file is also one I am unsure of what changes to make. Help on this one would be appreciated. Currently it says:$txtgender_search = " AND user.lookgender in ( 'A', "; if ($user['gender'] == 'M' or $user['gender'] == 'F') { $txtgender_search .= "'B',"; } $txtgender_search .= "'".$user['gender']."' )"; $txtlookgender_search = ''; if ($user['lookgender'] == 'B') { $txtlookender_search = " AND user.gender in ('M','F') "; } elseif ($user['lookgender'] != 'A') { $txtlookgender_search = " AND user.gender = '".$user['lookgender']."' "; } One more spot where changes need to be made and I'm unsure of in this same file://$same_lookgendersql = 'SELECT count(*) FROM ! WHERE lookgender = ?'; $same_lookgendersql = ' FROM ! WHERE username <> ? AND status in (\'Active\',\'' .get_lang('status_enum','active'). '\')' ; if ($user['lookgender'] == 'B') { $same_lookgendersql .= " and gender in ('M','F') "; } elseif ($user['lookgender'] == 'A') { } else { $same_lookgendersql .= " and gender = '".$user['lookgender']."'"; } That's all of them I believe. Help for the two that I am stuck with plus a check of the changes I've already made to make sure they're right would be greatly appreciated.Thanksblackrose Quote Link to comment Share on other sites More sharing options...
Muddy_Funster Posted April 29, 2015 Share Posted April 29, 2015 You know I read that title and thought "Is this really the best place to get help with that?" Having read the rest of the post, you would have been better posting that in the PHP Applications section of the forums as it's specific to an existing system you have changed rather than just being a general coding question. (Also Code tags are a must - especialy when posting that much code - it's too hard to read without them) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.