HEX
Server: nginx/1.28.0
System: Linux hetz-jb03 6.8.0-63-generic #66-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 13 20:25:30 UTC 2025 x86_64
User: higradeelectronics (1198)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /home/kongugettimelam/class.Search.php
<?php 

class Search extends Db 
{

/* Member - Related tables
   tbl_member a, tbl_mem_astrology b, tbl_mem_edu c, tbl_mem_emp d, tbl_mem_family e, tbl_mem_pe f, tbl_mem_physical g, 
   tbl_mem_wealth h */

	function get_search_list($objArray)
	{
			//echo $_REQUEST['lan'];
echo $_POST['mem_caste_division'];echo "<br>";
		global $objDb;
         if(!empty($_SESSION['matri_id'])){ $matri_id	= $_SESSION['matri_id']; }else{$matri_id = "";}
		if (isset($_REQUEST['act']) && $_REQUEST['act'] == 'simple')
		{	
		
		
		$select_logo = "SELECT view_content,verification_auto FROM tbl_logo";
		$select_logo1 = $objDb->execute($select_logo, "select");
			$where_condition = " a.matri_id IS NOT NULL";
			if($select_logo1[0]['verification_auto'] == 'Yes')
			{
			$where_condition .= "   AND a.mem_status='Approved'";
			}
			$where_condition .= "   AND h.plan_status='Active'";
			if(!empty($_POST['act']))
			{
				
				if(isset($_SESSION['gender']))	
				{
					if($_SESSION['gender']=='Male')
					{
						$mem_gender='Female';
					}else if($_SESSION['gender']=='Female')
					{
						$mem_gender='Male';
					}
				}else
				{
				if(isset($_POST['mem_gender'])){$mem_gender = $_POST['mem_gender'];}else{$mem_gender='';}
				}
				$age_from 	= $_POST['age_from'];
				$age_to 	= $_POST['age_to'];		
				$mem_marital_status   = $_POST['mem_marital_status'];
				$language   = $_POST['language'];
				//$mem_spectacles   = $_POST['mem_spectacles'];
				$mem_kottam   = $_POST['mem_kottam'];
				$photo = $_POST['photo'];
				$horo = $_POST['horo'];
			$_SESSION['ssearch1'] = compact('mem_gender','age_from','age_to','mem_marital_status','empnature', 'mem_kottam','mem_spectacles','with_photo');
		$extract_search  = extract($_SESSION['ssearch1']);
			}
			else
			   $extract_search  = extract($_SESSION['ssearch1']);
			if (!empty($mem_gender)) $where_condition .= " AND a.mem_gender = '$mem_gender' "; 
			if (!empty($age_from) && !empty($age_to)) $where_condition .= " AND (a.mem_age BETWEEN '$age_from' AND '$age_to' or a.mem_age='' )"; 
			if (!empty($mem_marital_status)) $where_condition .=" AND a.mem_marital_status = '$mem_marital_status' ";
			if (!empty($language)) $where_condition .= " AND b.language = '$language' ";
			
		//	if (!empty($mem_spectacles)) $where_condition .= " AND g.mem_spectacles = '$mem_spectacles' ";
			
		    if (!empty($mem_kottam)) $where_condition .= " AND b.mem_kottam = '$mem_kottam' "; 
			if (!empty($photo)) {
			 $where_condition .= " AND a.mem_phot_self != ''"; 
				} else {
					 $where_condition .= " AND a.mem_phot_self != ''";  }
					 if (!empty($horo)) {
			 $where_condition .= " AND a.mem_photo_horoscope != ''"; 
			  $where_condition .= " AND a.admin_app_horoscope = 'Yes'";
				}
		
			//ignore profile
			
			$ignore_qry = "SELECT block_user FROM tbl_mem_blockprofiles WHERE mem_user = '".$_SESSION['matri_id']."' AND block_status = 1";
			$ignore_res =  $objDb->execute($ignore_qry,"select");
			if (!empty($ignore_res))
			{
				for ($k=0;$k < count($ignore_res);$k++)
				{ 
					if (trim($ignore_res[$k]['block_user']) != '') { 
						if ($ignore_res1 != '') $ignore_res1 .= ",";
						$ignore_res1 .= "'".$ignore_res[$k]['block_user'] ."'";
					}
				}
			}
			
			if (!empty($ignore_res1))
				$where_condition .= "  AND a.matri_id NOT IN ('".$ignore_res1."')" ;  
				
				//ignore bookmark profile
			
			$bkmark_qry = "SELECT bookmark_matri_id FROM tbl_bookmark WHERE matri_id  = '".$_SESSION['matri_id']."' ";
			$bkmark_res =  $objDb->execute($bkmark_qry,"select");
			if (!empty($bkmark_res))
			{
				for ($k=0;$k < count($bkmark_res);$k++)
				{ 
					if (trim($bkmark_res[$k]['block_user']) != '') { 
						if ($bkmark_res1 != '') $bkmark_res1 .= ",";
						$bkmark_res1 .= "'".$bkmark_res[$k]['bookmark_matri_id'] ."'";
					}
				}
			}
			
			if (!empty($bkmark_res1))
				$where_condition .= "  AND a.matri_id NOT IN (".$bkmark_res1.")" ;  	

			if (!empty($matri_id))
				$where_condition .= "  AND a.matri_id NOT IN ('".$matri_id."')" ;  	
				
							
				 $search_qry ="SELECT b.mem_sub_caste,b.mem_caste_division,a.mem_gender,a.mem_fullname ,a.mem_marital_status,a.mem_phot_self,a.mem_age,a.admin_app_phot, DATE_FORMAT(a.mem_last_login,'%d-%b-%Y %h:%i %p') as mem_last_login,a.matri_id,
  b.mem_kottam,b.mem_star ,b.mem_rasi,  
  c.mem_edu,
  c.empnature
 FROM tbl_member AS a LEFT JOIN tbl_mem_astrology AS b ON b.matri_id = a.matri_id LEFT JOIN tbl_mem_edu AS c ON c.matri_id = a.matri_id LEFT JOIN tbl_membership as d on d. membership_id  = a.mem_membership_id ". $condition ." WHERE ".$where_condition." GROUP BY a.matri_id order by d.plan_activated_on DESC LIMIT 0, ".$member_search_count;

				
/*$search_qry ="SELECT a.mem_gender,a.mem_fullname ,a.mem_marital_status,a.mem_phot_self,a.mem_age,a.admin_app_phot,d.mem_city, d.mem_state, d.mem_country, DATE_FORMAT(a.mem_last_login,'%d-%b-%Y %h:%i %p') as mem_last_login,a.matri_id,
  b.mem_kottam,b.mem_star ,b.mem_rasi,  
  c.mem_edu,
  c.empnature
 FROM tbl_member AS a INNER JOIN tbl_mem_astrology AS b ON b.matri_id = a.matri_id INNER JOINtbl_mem_edu AS c ON c.matri_id = a.matri_id  LEFT JOIN  tbl_mem_com AS d ON d.matri_id = a.matri_id LEFT JOIN  tbl_mem_physical  AS g ON g.matri_id = a.matri_id LEFT JOIN tbl_membership AS h ON h.matri_id = a.matri_id  ". $condition ." WHERE ".$where_condition." GROUP BY a.matri_id order by a.mem_created_on LIMIT 0, ".$member_search_count;*/

	return $search_res = $objDb->execute($search_qry,"select");
	
		}	else if (isset($_REQUEST['act']) && $_REQUEST['act'] == 'iyear')
		{
		
		
 $cast=$_REQUEST['lan'];
 $gender=$_REQUEST['gen'];

			$where_condition = " a.matri_id IS NOT NULL";
			$where_condition .= "   AND a.mem_status='Approved'";
			$where_condition .= "   AND d.plan_status='Active'";
			$where_condition .= "   AND a.mem_gender='$gender'";
			$where_condition .= "   AND b.mem_sub_caste='$cast'";
			//ignore profile
			if(isset($_SESSION['matri_id'])) {
			
			$ignore_qry = "SELECT block_user FROM tbl_mem_blockprofiles WHERE mem_user = '".$_SESSION['matri_id']."' AND block_status = 1";
			$ignore_res =  $objDb->execute($ignore_qry,"select");
			if (!empty($ignore_res))
			{
				for ($k=0;$k < count($ignore_res);$k++)
				{ 
					if (trim($ignore_res[$k]['block_user']) != '') { 
						if ($ignore_res1 != '') $ignore_res1 .= ",";
						$ignore_res1 .= "'".$ignore_res[$k]['block_user'] ."'";
					}
				}
			}
			
			if (!empty($ignore_res1))
				$where_condition .= "  AND a.matri_id NOT IN (".$ignore_res1.")" ;  
			
				
	//ignore bookmark profile
			
			 $bkmark_qry = "SELECT bookmark_matri_id FROM tbl_bookmark WHERE matri_id  = '".$_SESSION['matri_id']."' ";
			$bkmark_res =  $objDb->execute($bkmark_qry,"select");
			if (!empty($bkmark_res))
			{
				for ($k=0;$k < count($bkmark_res);$k++)
				{ 
					if (trim($bkmark_res[$k]['bookmark_matri_id']) != '') { 
						if ($bkmark_res1 != '') $bkmark_res1 .= ",";
						$bkmark_res1 .= "'".$bkmark_res[$k]['bookmark_matri_id'] ."'";
					}
				}
			}
			
			if (!empty($bkmark_res1))
				 $where_condition .= "  AND a.matri_id NOT IN (".$bkmark_res1.")" ;  	
				 
			if (!empty($matri_id))
				$where_condition .= "  AND a.matri_id NOT IN ('".$matri_id."')" ;  	
				}
								 				
   $search_qry ="SELECT b.mem_sub_caste,b.mem_caste_division,a.mem_gender, a.mem_fullname, a.mem_marital_status, a.mem_phot_self, a.mem_age, a.admin_app_phot, DATE_FORMAT(a.mem_last_login,'%d-%b-%Y %h:%i %p') as mem_last_login, a.matri_id, b.mem_kottam, b.mem_star, b.mem_rasi, c.mem_edu, c.empnature
 FROM tbl_member AS a LEFT JOIN tbl_mem_astrology AS b ON b.matri_id = a.matri_id LEFT JOIN tbl_mem_edu AS c ON c.matri_id = a.matri_id LEFT JOIN tbl_membership as d on d. membership_id  = a.mem_membership_id WHERE".$where_condition."  GROUP BY a.matri_id order by d.plan_activated_on DESC";
 exit;
	return $search_res = $objDb->execute($search_qry,"select");
		}	
		
		
		else if (isset($_REQUEST['act']) && $_REQUEST['act'] == 'quick')
		{	
			$where_condition = " a.matri_id IS NOT NULL";
			$where_condition .= "   AND a.mem_status='Approved'";
			$where_condition .= "   AND h.plan_status='Active'";
			if(!empty($_POST['act']))
			{
				if(isset($_SESSION['gender']))	
				{
					if($_SESSION['gender']=='Male')
					{
						$mem_gender='Female';
					}else if($_SESSION['gender']=='Female')
					{
						$mem_gender='Male';
					}
				}else
				{
			if(isset($_POST['mem_gender'])){$mem_gender = $_POST['mem_gender'];}else{$mem_gender='';}
				}	
				$age_from 	= $_POST['age_from'];
				$age_to 	= $_POST['age_to'];		
				$mem_kottam   = $_POST['mem_kollam'];
				@$photo = $_POST['photo'];
				@$horo = $_POST['horo'];
			 $_SESSION['ssearch2'] = compact('mem_gender','age_from','age_to','mem_kottam','photo');
		  $extract_search  = extract($_SESSION['ssearch2']);
			}
			else
			{
			  $extract_search  = extract($_SESSION['ssearch2']);
			}
			if (!empty($mem_gender)) $where_condition .= " AND a.mem_gender = '$mem_gender' "; 
			if (!empty($age_from) && !empty($age_to)) $where_condition .= " AND (a.mem_age BETWEEN '$age_from' AND '$age_to' or a.mem_age='' )"; 
		    if (!empty($mem_kottam)) $where_condition .= " AND b.mem_kottam = '$mem_kottam' "; 
			if (!empty($photo)) {
			 $where_condition .= " AND a.mem_phot_self != ''"; 
				} 
		 if (!empty($horo)) {
			 $where_condition .= " AND a.mem_photo_horoscope != ''"; 
			  $where_condition .= " AND a.admin_app_horoscope = 'Yes'";
				}
			//ignore profile
			
			$ignore_qry = "SELECT block_user FROM tbl_mem_blockprofiles WHERE mem_user = '".$_SESSION['matri_id']."' AND block_status = 1";
			$ignore_res =  $objDb->execute($ignore_qry,"select");
			if (!empty($ignore_res))
			{
				for ($k=0;$k < count($ignore_res);$k++)
				{ 
					if (trim($ignore_res[$k]['block_user']) != '') { 
						if ($ignore_res1 != '') $ignore_res1 .= ",";
						$ignore_res1 .= "'".$ignore_res[$k]['block_user'] ."'";
					}
				}
			}
			
			if (!empty($ignore_res1))
				$where_condition .= "  AND a.matri_id NOT IN (".$ignore_res1.")" ;  
				
				
	//ignore bookmark profile
			
			 $bkmark_qry = "SELECT bookmark_matri_id FROM tbl_bookmark WHERE matri_id  = '".$_SESSION['matri_id']."' ";
			$bkmark_res =  $objDb->execute($bkmark_qry,"select");
			if (!empty($bkmark_res))
			{
				for ($k=0;$k < count($bkmark_res);$k++)
				{ 
					if (trim($bkmark_res[$k]['bookmark_matri_id']) != '') { 
						if ($bkmark_res1 != '') $bkmark_res1 .= ",";
						$bkmark_res1 .= "'".$bkmark_res[$k]['bookmark_matri_id'] ."'";
					}
				}
			}
			
			if (!empty($bkmark_res1))
				 $where_condition .= "  AND a.matri_id NOT IN (".$bkmark_res1.")" ;  	
				 
			if (!empty($matri_id))
				$where_condition .= "  AND a.matri_id NOT IN ('".$matri_id."')" ;  	
								 				
  $search_qry ="SELECT  b.mem_sub_caste,b.mem_caste_division,a.mem_fullname,a.mem_gender, a.mem_marital_status, a.mem_phot_self, a.mem_age, a.admin_app_phot, DATE_FORMAT(a.mem_last_login,'%d-%b-%Y %h:%i %p') as mem_last_login, a.matri_id, b.mem_kottam, b.mem_star, b.mem_rasi, c.mem_edu, c.empnature
 FROM tbl_member AS a INNER JOIN tbl_mem_astrology AS b ON b.matri_id = a.matri_id INNER JOIN tbl_mem_edu AS c ON c.matri_id = a.matri_id INNER JOIN tbl_membership as d on d. membership_id  = a.mem_membership_id ".$where_condition." GROUP BY a.matri_id order by d.plan_activated_on DESC";
	return $search_res = $objDb->execute($search_qry,"select");
		}	
	else if (isset($_REQUEST['act']) && $_REQUEST['act'] == 'advance')
		{	
			$where_condition = " a.matri_id IS NOT NULL";
			$where_condition .= "   AND a.mem_status='Approved'";
			$where_condition .= "   AND h.plan_status='Active'";
			if(!empty($_POST['act']))
			{
				if(!empty($_SESSION['gender']))	
				{
					if($_SESSION['gender']=='Male')
					{
						$mem_gender='Female';
					}else if($_SESSION['gender']=='Female')
					{
						$mem_gender='Male';
					}
				}else
				{
			if(!empty($_POST['mem_gender'])){$mem_gender = $_POST['mem_gender'];}else{$mem_gender='';}
				}		
				$age_from 	= $_POST['age_from'];
				$age_to 	= $_POST['age_to'];		
				$mem_marital_status   = $_POST['mem_marital_status'];
				$mem_education   = $_POST['mem_education'];
				$empnature   = $_POST['empnature'];
				$language   = $_POST['language'];
				$mem_kottam   = $_POST['mem_kottam'];
				$height_from   = $_POST['height_from'];
				$height_to   = $_POST['height_to'];
				$weight_from   = $_POST['weight_from'];
				$weight_to   = $_POST['weight_to'];
				//$mem_spectacles   = $_POST['mem_spectacles'];
				 $abroad   = $_POST['abroad'];
				/* $sevvai   = $_POST['sevvai'];
			 	$raghu   = $_POST['raghu'];*/
				$photo = $_POST['photo'];
				$horo = $_POST['horo'];
				if(!empty($_POST['mem_religion'])){
				$mem_religion=$_POST['mem_religion'];}
				if(!empty($_POST['mem_caste_division'])){
				$mem_caste_division=$_POST['mem_caste_division'];}
				if(!empty($_POST['mem_sub_caste'])){
				$mem_sub_caste=$_POST['mem_sub_caste'];}
				
			if (!empty($mem_marital_status))	$mem_marital_status = implode(",",$mem_marital_status);
			else	$mem_marital_status  = "";
			if (!empty($mem_education))	$mem_education = implode(",",$mem_education);
			else	$mem_education  = "";
			if (!empty($empnature))	$empnature = implode(",",$empnature);
			else	$empnature  = "";
			if (!empty($mem_kottam))	$mem_kottam = implode(",",$mem_kottam);
			else	$mem_kottam  = "";
				
			 $_SESSION['ssearch3'] = compact('mem_gender','age_from','age_to','mem_marital_status','mem_education', 'empnature','mem_kottam','height_from','height_to','weight_from', 'weight_to','abroad','mem_spectacles','sevvai','raghu','photo');
		  $extract_search  = extract($_SESSION['ssearch3']);
			}
			else
			   $extract_search  = extract($_SESSION['ssearch3']);
			if (!empty($mem_gender)) $where_condition .= " AND a.mem_gender = '$mem_gender' "; 
			if (!empty($age_from) && !empty($age_to)) $where_condition .= " AND (a.mem_age BETWEEN '$age_from' AND '$age_to' or a.mem_age='' )"; 
			
			if (!empty($mem_religion)) $where_condition .= " AND b.mem_religion = '$mem_religion' "; 
			if (!empty($mem_caste_division)) $where_condition .= " AND b.mem_caste_division = '$mem_caste_division' "; 
			if (!empty($mem_sub_caste)) $where_condition .= " AND b.mem_sub_caste = '$mem_sub_caste' "; 
			if (!empty($language)) $where_condition .= " AND b.language = '$language' "; 
						
			
	if (!empty($mem_marital_status) ) { $where_condition .= " AND FIND_IN_SET(a.mem_marital_status,'$mem_marital_status')"; }
			
	if (!empty($mem_marital_status) ) { $where_condition .= " AND FIND_IN_SET(a.mem_marital_status,'$mem_marital_status')"; }
	if (!empty($mem_education) ) { $where_condition .= " AND FIND_IN_SET(c.mem_edu,'$mem_education')"; }
	if (!empty($empnature) ) { $where_condition .= " AND FIND_IN_SET(c.empnature,'$empnature')"; }
	if (!empty($mem_kottam) ) { $where_condition .= " AND FIND_IN_SET(b.mem_kottam,'$mem_kottam')"; }

			if (!empty($height_from) && !empty($height_to)) $where_condition .= " AND (g.mem_height BETWEEN '$height_from' AND '$height_to' or g.mem_height='' )"; 	
			if (!empty($weight_from) && !empty($weight_to)) $where_condition .= " AND (g.mem_weight BETWEEN '$weight_from' AND '$weight_to' or g.mem_weight='' )"; 	
			//if (!empty($mem_spectacles)) $where_condition .= " AND g.mem_spectacles = '$mem_spectacles' ";




			if (!empty($abroad) && ($abroad == 'Yes')) $where_condition .= " AND d.mem_country_living !='98'  ";
			else $where_condition .= " AND d.mem_country_living = '98'  ";
	
	if (!empty($sevvai) && ($sevvai == 'Yes') ) { $where_condition .= " AND b.mem_dosham LIKE '%Sevvai%' "; }
	if (!empty($raghu) && ($raghu == 'Yes') ) { $where_condition .= " AND b.mem_dosham LIKE '%Rahu Kedhu%' "; }

	if (!empty($sevvai) && ($sevvai == 'No') ) { $where_condition .= " AND b.mem_dosham NOT LIKE '%Sevvai%' "; }
	if (!empty($raghu) && ($raghu == 'No') ) { $where_condition .= " AND b.mem_dosham NOT LIKE '%Rahu Kedhu%' "; }
//	if (!empty($sevvai) && ($sevvai == 'Yes') ) { $where_condition .= " AND FIND_IN_SET(b.mem_dosham,'Sevvai')"; }
//	if (!empty($raghu) && ($raghu == 'Yes') ) { $where_condition .= " AND FIND_IN_SET(b.mem_dosham,'Rahu Kedhu')"; }
			
			
			if (!empty($photo)) {
			 $where_condition .= " AND a.mem_phot_self != ''"; 
				} else {
					 $where_condition .= " AND a.mem_phot_self != ''";  }
		 if (!empty($horo)) {
			 $where_condition .= " AND a.mem_photo_horoscope != ''"; 
			  $where_condition .= " AND a.admin_app_horoscope = 'Yes'";
				}
		
			//ignore profile
			
			$ignore_qry = "SELECT block_user FROM tbl_mem_blockprofiles WHERE mem_user = '".$_SESSION['matri_id']."' AND block_status = 1";
			$ignore_res =  $objDb->execute($ignore_qry,"select");
			if (!empty($ignore_res))
			{
				for ($k=0;$k < count($ignore_res);$k++)
				{ 
					if (trim($ignore_res[$k]['block_user']) != '') { 
						if ($ignore_res1 != '') $ignore_res1 .= ",";
						$ignore_res1 .= "'".$ignore_res[$k]['block_user'] ."'";
					}
				}
			}
			
			if (!empty($ignore_res1))
				$where_condition .= "  AND a.matri_id NOT IN (".$ignore_res1.")" ;  
				
	//ignore bookmark profile
			
			 $bkmark_qry = "SELECT bookmark_matri_id FROM tbl_bookmark WHERE matri_id  = '".$_SESSION['matri_id']."' ";
			$bkmark_res =  $objDb->execute($bkmark_qry,"select");
			if (!empty($bkmark_res))
			{
				for ($k=0;$k < count($bkmark_res);$k++)
				{ 
					if (trim($bkmark_res[$k]['bookmark_matri_id']) != '') { 
						if ($bkmark_res1 != '') $bkmark_res1 .= ",";
						$bkmark_res1 .= "'".$bkmark_res[$k]['bookmark_matri_id'] ."'";
					}
				}
			}
			
			if (!empty($bkmark_res1))
				 $where_condition .= "  AND a.matri_id NOT IN (".$bkmark_res1.")" ;  		
				 
			if (!empty($matri_id))
				$where_condition .= "  AND a.matri_id NOT IN ('".$matri_id."')" ;  	
								
   $search_qry ="SELECT b.mem_sub_caste,b.mem_caste_division,a.mem_fullname ,a.mem_gender,a.mem_marital_status,a.mem_phot_self,a.mem_age,a.admin_app_phot,DATE_FORMAT(a.mem_last_login,'%d-%b-%Y %h:%i %p') as mem_last_login,a.matri_id,
  b.mem_kottam, b.mem_star ,b.mem_rasi, b.mem_religion, b.mem_caste_division, b.mem_sub_caste, c.mem_edu, c.empnature FROM tbl_member AS a INNER JOIN tbl_mem_astrology AS b ON b.matri_id = a.matri_id INNER JOIN tbl_mem_edu AS c ON c.matri_id = a.matri_id LEFT JOIN  tbl_mem_com AS d ON d.matri_id = a.matri_id LEFT JOIN  tbl_mem_physical  AS g ON g.matri_id = a.matri_id INNER JOIN tbl_membership as e on e.membership_id  = a.mem_membership_id ". $condition ." WHERE ".$where_condition." GROUP BY a.matri_id order by e.plan_activated_on DESC";
  
 
	return $search_res = $objDb->execute($search_qry,"select");
	
		}			
		
	}
	
	
	function get_search_count($objArray)
	{
		$condition="";
		global $objDb;
		if(!empty($_SESSION['mem_plan'])){ $matri_plan = $_SESSION['mem_plan'];}else{$matri_plan = "";}
		if(!empty($_SESSION['mem_membership'])){ $memship_id = $_SESSION['mem_membership'];}else{ $memship_id = "";}
		if(!empty($_SESSION['matri_id'])){$matri_id = $_SESSION['matri_id'];}else{$matri_id = ""; $_SESSION['matri_id']="";}

//		 $matri_id	= $_SESSION['matri_id']; 
		if (isset($_REQUEST['act']) && $_REQUEST['act'] == 'simple')
		{	
			
			$select_logo = "SELECT view_content,verification_auto FROM tbl_logo";
			$select_logo1 = $objDb->execute($select_logo, "select");
		
			$where_condition = " a.matri_id IS NOT NULL";
			if($select_logo1[0]['verification_auto'] == 'No')
			{
				$where_condition .= "   AND a.mem_status='approved'";
			}
			if(!empty($_POST['act']))
			{
			if(isset($_SESSION['gender']))	
				{
					if($_SESSION['gender']=='Male')
					{
						$mem_gender='Female';
					}else if($_SESSION['gender']=='Female')
					{
						$mem_gender='Male';
					}
				}else
				{
if(isset($_POST['mem_gender'])){$mem_gender = $_POST['mem_gender'];}else{$mem_gender='';}
				}
				$age_from 	= $_POST['age_from'];
				$age_to 	= $_POST['age_to'];		
				$mem_marital_status   = $_POST['mem_marital_status'];
				@$language   = $_POST['language'];
				if(!empty($_POST['mem_religion'])){
				$mem_religion=$_POST['mem_religion'];}
				if(!empty($_POST['mem_caste_division'])){
				$mem_caste_division=$_POST['mem_caste_division'];}
				if(!empty($_POST['mem_sub_caste'])){
				$mem_sub_caste=$_POST['mem_sub_caste'];}
				if(!empty($_POST['mem_spectacles'])){
				$mem_spectacles = $_POST['mem_spectacles'];}else{ $mem_spectacles ="";}
				if(!empty($_POST['mem_kottam'])){
				$mem_kottam=$_POST['mem_kottam'];}else { $mem_kottam="";}
				
				@$photo = $_POST['photo'];
				@$horo = $_POST['horo'];
				$site_fields='';
			 $_SESSION['ssearch4'] = compact('mem_gender','age_from','age_to','mem_marital_status','language', 'mem_kottam','mem_spectacles','with_photo');
		  $extract_search  = extract($_SESSION['ssearch4']);
			}
			else
			   $extract_search  = extract($_SESSION['ssearch4']);
			if (!empty($mem_gender)) $where_condition .= " AND a.mem_gender = '$mem_gender' "; 
			if (!empty($age_from) && !empty($age_to)) $where_condition .= " AND (a.mem_age BETWEEN '$age_from' AND '$age_to' or a.mem_age='' )"; 
			if (!empty($mem_marital_status)) $where_condition .=" AND a.mem_marital_status = '$mem_marital_status' ";
			if (!empty($language)) $where_condition .= " AND b.language = '$language' ";
			
		//	if (!empty($mem_spectacles)) $where_condition .= " AND g.mem_spectacles = '$mem_spectacles' ";
			
	if (!empty($mem_kottam) ) { $where_condition .= " AND b.mem_kottam <> '$mem_kottam'"; }
			if (!empty($photo)) {
			 /*$where_condition .= " AND a.mem_phot_self != '' AND a.admin_app_phot = 'Yes'"; */
			 $where_condition .= " AND a.mem_phot_self != ''"; 
				} 
				else {
			// $where_condition .= " AND (a.mem_phot_self == '' || a.mem_phot_self != '')"; 
				}
				 if (!empty($horo)) {
			 $where_condition .= " AND a.mem_photo_horoscope != ''"; 
			  $where_condition .= " AND a.admin_app_horoscope = 'Yes'";
				} else {
					  }

			//ignore profile
			$ignore_qry = "SELECT block_user FROM tbl_mem_blockprofiles WHERE mem_user = '".$matri_id."' AND block_status = 1";
			$ignore_res =  $objDb->execute($ignore_qry,"select");
			if (!empty($ignore_res))
			{
				for ($k=0;$k < count($ignore_res);$k++)
				{ 
					if (trim($ignore_res[$k]['block_user']) != '') { 
						if (!empty($ignore_res1)) $ignore_res1 .= ",";
						@$ignore_res1 .= "'".$ignore_res[$k]['block_user'] ."'";
					}
				}
			}
			
			if (!empty($ignore_res1))
				$where_condition .= "  AND a.matri_id NOT IN (".$ignore_res1.")" ;  
				
								//ignore bookmark profile
			
			 $bkmark_qry = "SELECT bookmark_matri_id FROM tbl_bookmark WHERE matri_id  = '".$matri_id."' ";
			$bkmark_res =  $objDb->execute($bkmark_qry,"select");
			$bkmark_res1='';
			if (!empty($bkmark_res))
			{
				for ($k=0;$k < count($bkmark_res);$k++)
				{ 
					if (trim($bkmark_res[$k]['bookmark_matri_id']) != '') { 
						if ($bkmark_res1 != '') $bkmark_res1 .= ",";
						$bkmark_res1 .= "'".$bkmark_res[$k]['bookmark_matri_id'] ."'";
					}
				}
			}
			
			if (!empty($bkmark_res1))
				 $where_condition .= "  AND a.matri_id NOT IN (".$bkmark_res1.")" ;  	
				
				if (!empty($matri_id))
				$where_condition .= "  AND a.matri_id NOT IN ('".$matri_id."')" ; 
				if(!empty($mem_religion))
				{
  					$where_condition .= "  AND b.mem_religion ='$mem_religion'" ;
					$site_fields .= " b.mem_religion," ;
				}
				if(!empty($mem_caste_division))
				{
  					$where_condition .= "  AND b.mem_caste_division ='$mem_caste_division'" ;
					$site_fields .= " b.mem_caste_division," ;
				}
				if(!empty($mem_sub_caste))
				{
					$where_condition .= "  AND b.mem_sub_caste ='$mem_sub_caste'" ;
					$site_fields .= " b.mem_sub_caste," ;
				}
											
  $search_qry ="SELECT b.mem_sub_caste,b.mem_caste_division,a.mem_gender, a.mem_fullname , a.mem_marital_status, a.mem_phot_self, a.mem_age, a.admin_app_phot, a.mem_plan_id, a.mem_membership_id, a.mem_status, DATE_FORMAT(a.mem_last_login,'%d-%b-%Y %h:%i %p') as mem_last_login, a.matri_id, b.mem_kottam, b.mem_star ,b.mem_rasi, ".$site_fields." c.mem_edu, c.empnature FROM tbl_member AS a LEFT JOIN tbl_mem_astrology  AS b ON b.matri_id = a.matri_id LEFT JOIN  tbl_mem_edu  AS c ON c.matri_id = a.matri_id LEFT JOIN tbl_membership as d on d. membership_id  = a.mem_membership_id ". $condition ." WHERE ".$where_condition." GROUP BY a.matri_id order by d.plan_activated_on DESC";

	return $search_qry;
		}	
		
		else if (isset($_REQUEST['act']) && $_REQUEST['act'] == 'quick')
		{	
		$select_logo = "SELECT view_content,verification_auto FROM tbl_logo";
		$select_logo1 = $objDb->execute($select_logo, "select");
		
			$where_condition = " a.matri_id IS NOT NULL";
			if($select_logo1[0]['verification_auto'] == 'No')
			{
			$where_condition .= "   AND a.mem_status='approved'";
			}
		
		//				$where_condition .= "   AND h.plan_status='Active'";

			if(!empty($_POST['act']))
			{
				if(isset($_SESSION['gender']))	
				{
					if($_SESSION['gender']=='Male')
					{
						$mem_gender='Female';
					}else if($_SESSION['gender']=='Female')
					{
						$mem_gender='Male';
					}
				}else
				{
				if(isset($_POST['mem_gender'])){$mem_gender = $_POST['mem_gender'];}else{$mem_gender='';}
				}
				$age_from 	= $_POST['age_from'];
				$age_to 	= $_POST['age_to'];		
				if(!empty($_POST['mem_religion'])){$mem_religion   = $_POST['mem_religion'];} else {$mem_religion="";}
				if(!empty($_POST['photo'])){$photo = $_POST['photo'];} else {$photo="";}
				if(!empty($_POST['horo'])){$photo = $_POST['horo'];} else {$horo="";}
				$_SESSION['ssearch5'] = compact('mem_gender','age_from','age_to','mem_kottam','photo');
				$extract_search  = extract($_SESSION['ssearch5']);

			}
			else
			   $extract_search  = extract($_SESSION['ssearch5']);
			if (!empty($mem_gender)) $where_condition .= " AND a.mem_gender = '$mem_gender' "; 
			if (!empty($age_from) && !empty($age_to)) $where_condition .= " AND (a.mem_age BETWEEN '$age_from' AND '$age_to' or a.mem_age='' )"; 
	if (!empty($mem_religion) ) { $where_condition .= " AND b.mem_religion ='$mem_religion'"; }
			if (!empty($photo)) {
			 /*$where_condition .= " AND a.mem_phot_self != '' AND a.admin_app_phot = 'Yes'";*/ 
			 $where_condition .= " AND a.mem_phot_self != ''";
				} 
				else {
			// $where_condition .= " AND (a.mem_phot_self == '' || a.mem_phot_self != '')"; 
				}
				
				if (!empty($horo)) {
			 $where_condition .= " AND a.mem_photo_horoscope != ''"; 
			  $where_condition .= " AND a.admin_app_horoscope = 'Yes'";
				}

			//ignore profile
			 $ignore_qry = "SELECT block_user FROM tbl_mem_blockprofiles WHERE mem_user = '".$_SESSION['matri_id']."' AND block_status = 1";
			$ignore_res =  $objDb->execute($ignore_qry,"select");
			if (!empty($ignore_res))
			{
				for ($k=0;$k < count($ignore_res);$k++)
				{ 
					if (trim($ignore_res[$k]['block_user']) != '') { 
						if ($ignore_res1 != '') $ignore_res1 .= ",";
						$ignore_res1 .= "'".$ignore_res[$k]['block_user'] ."'";
					}
				}
			}
			
			if (!empty($ignore_res1))
				$where_condition .= "  AND a.matri_id NOT IN (".$ignore_res1.")" ;  
				
	//ignore bookmark profile
			
			 $bkmark_qry = "SELECT bookmark_matri_id FROM tbl_bookmark WHERE matri_id  = '".$_SESSION['matri_id']."' ";
			$bkmark_res =  $objDb->execute($bkmark_qry,"select");
			if (!empty($bkmark_res))
			{
				for ($k=0;$k < count($bkmark_res);$k++)
				{ 
					if (trim($bkmark_res[$k]['bookmark_matri_id']) != '') { 
						if ($bkmark_res1 != '') $bkmark_res1 .= ",";
						$bkmark_res1 .= "'".$bkmark_res[$k]['bookmark_matri_id'] ."'";
					}
				}
			}
			
			if (!empty($bkmark_res1))
				 $where_condition .= "  AND a.matri_id NOT IN (".$bkmark_res1.")" ;  					
				
							if (!empty($matri_id))
				$where_condition .= "  AND a.matri_id NOT IN ('".$matri_id."')" ;  	
				
  $search_qry ="SELECT b.mem_sub_caste,b.mem_caste_division,a.mem_gender,a.mem_fullname ,a.mem_marital_status,a.mem_phot_self,a.mem_age,a.admin_app_phot,DATE_FORMAT(a.mem_last_login,'%d-%b-%Y %h:%i %p') as mem_last_login,a.matri_id,
  b.mem_kottam, b.mem_star ,b.mem_rasi,b.mem_religion, c.mem_edu, c.empnature FROM tbl_member  AS a INNER JOIN tbl_mem_astrology AS b ON b.matri_id = a.matri_id INNER JOIN tbl_mem_edu AS c ON c.matri_id = a.matri_id INNER JOIN tbl_membership as d on d. membership_id  = a.mem_membership_id ". $condition ." WHERE ".$where_condition." GROUP BY a.matri_id order by d.plan_activated_on DESC";
 		
	return $search_qry;
		}	
		
	else if (isset($_REQUEST['act']) && $_REQUEST['act'] == 'advance')
		{
			
		
		$select_logo = "SELECT view_content,verification_auto FROM tbl_logo";
		$select_logo1 = $objDb->execute($select_logo, "select");
			$where_condition = " a.matri_id IS NOT NULL";
			if($select_logo1[0]['verification_auto'] == 'No')
			{
			$where_condition .= "   AND a.mem_status='Approved'";
			}
		//$where_condition .= "   AND h.plan_status='Active'";
			if(!empty($_POST['act']))
			{
			
			if(isset($_SESSION['gender']))	
				{
					if($_SESSION['gender']=='Male')
					{
						$mem_gender='Female';
					}else if($_SESSION['gender']=='Female')
					{
						$mem_gender='Male';
					}
				}else
				{
			if(!empty($_POST['mem_gender'])){$mem_gender = $_POST['mem_gender'];}else{$mem_gender='';}
				}
			if(!empty($_POST['age_from'])){$age_from = $_POST['age_from'];}else{$age_from='';}	
			if(!empty($_POST['age_to'])){$age_to = $_POST['age_to'];}else{$age_to='';}	
			if(!empty($_POST['mem_marital_status'])){$mem_marital_status = $_POST['mem_marital_status'];}else{$mem_marital_status='';}	
			if(!empty($_POST['mem_education'])){$mem_education = $_POST['mem_education'];}else{$mem_education='';}	
			if(!empty($_POST['empnature'])){$empnature = $_POST['empnature'];}else{$empnature='';}	
			if(!empty($_POST['language'])){$language = $_POST['language'];}else{$language='';}	
			
				
				@$mem_kottam   = $_POST['mem_kottam'];
				
				@$height_from   = $_POST['height_from'];
				
				@$height_to   = $_POST['height_to'];
				@$weight_from   = $_POST['weight_from'];
				@$weight_to   = $_POST['weight_to'];
				//$mem_spectacles   = $_POST['mem_spectacles'];
				@$star = $_POST['star'];
				@$abroad   = $_POST['abroad'];
				@$mem_religion=$_POST['mem_religion'];
				@$mem_caste_division=$_POST['mem_caste_division'];
				@$mem_sub_caste=$_POST['mem_sub_caste'];
				
				@$sevvai   = $_POST['sevvai'];
				@$raghu   = $_POST['raghu'];
				@$photo = $_POST['photo'];
				@$horo = $_POST['horo'];
				
			if (!empty($mem_marital_status))	$mem_marital_status = implode(",",$mem_marital_status);
			else	$mem_marital_status  = "";
			if (!empty($mem_education))	$mem_education = implode(",",$mem_education);
			else	$mem_education  = "";
			if (!empty($empnature))	$empnature = implode(",",$empnature);
			else	$empnature  = "";
		//	if (!empty($mem_kottam))	$mem_kottam = implode(",",$mem_kottam);
			//else	$mem_kottam  = "";
			if (!empty($star))	$star = implode(",",$star);
			else $star  = "";
			
			if (!empty($mem_religion)) $where_condition .= " AND b.mem_religion = '$mem_religion' "; 
			if (!empty($mem_caste_division)) $where_condition .= " AND b.mem_caste_division = '$mem_caste_division' "; 
			if (!empty($mem_sub_caste)) $where_condition .= " AND b.mem_sub_caste = '$mem_sub_caste' "; 
				if (!empty($language)) $where_condition .= " AND b.language = '$language' "; 
				

			 $_SESSION['ssearch6'] = compact('mem_gender','age_from','age_to','mem_marital_status','mem_education', 'empnature','mem_kottam','height_from','height_to','weight_from', 'weight_to','star','abroad','sevvai','raghu','photo');
		  $extract_search  = extract($_SESSION['ssearch6']);
}else
 $extract_search  = extract($_SESSION['ssearch6']);

			if (!empty($mem_gender)) $where_condition .= " AND a.mem_gender = '$mem_gender' "; 
			if (!empty($age_from) && !empty($age_to)) $where_condition .= " AND (a.mem_age BETWEEN '$age_from' AND '$age_to' or a.mem_age='' )"; 			
			
	if (!empty($mem_marital_status) ) { $where_condition .= " AND FIND_IN_SET(a.mem_marital_status,'$mem_marital_status')"; }
	if (!empty($mem_education) ) { $where_condition .= " AND FIND_IN_SET(c.mem_edu,'$mem_education')"; }
	if (!empty($empnature) ) { $where_condition .= " AND FIND_IN_SET(c.empnature,'$empnature')"; }
	if (!empty($mem_kottam) ) { $where_condition .= " AND b.mem_kottam <> '$mem_kottam'"; }

			if (!empty($height_from) && !empty($height_to)) $where_condition .= " AND (g.mem_height BETWEEN '$height_from' AND '$height_to' or g.mem_height='' )"; 	
			if (!empty($weight_from) && !empty($weight_to)) $where_condition .= " AND (g.mem_weight BETWEEN '$weight_from' AND '$weight_to' or g.mem_weight='' )"; 	
		//	if (!empty($mem_spectacles)) $where_condition .= " AND g.mem_spectacles = '$mem_spectacles' ";
		if (!empty($star) ) { $where_condition .= " AND FIND_IN_SET(b.mem_star,'$star')"; }
			if (!empty($abroad) && ($abroad == 'Yes')) $where_condition .= " AND d.mem_country_living<>'98'";
			else if (!empty($abroad) && ($abroad == 'No')) $where_condition .= " AND d.mem_country_living = '98' ";
			 
			
	//if (!empty($sevvai) && ($sevvai == 'Yes') ) { $where_condition .= " AND FIND_IN_SET(b.mem_dosham,'Sevvai')"; }
	//if (!empty($raghu) && ($raghu == 'Yes') ) { $where_condition .= " AND FIND_IN_SET(b.mem_dosham,'Rahu Kedhu')"; }

	if (!empty($sevvai) && ($sevvai == 'Yes') ) { $where_condition .= " AND b.mem_dosham LIKE '%Sevvai%' "; }
	if (!empty($raghu) && ($raghu == 'Yes') ) { $where_condition .= " AND b.mem_dosham LIKE '%Rahu Kedhu%' "; }

	if (!empty($sevvai) && ($sevvai == 'No') ) { $where_condition .= " AND b.mem_dosham NOT LIKE '%Sevvai%' "; }
	if (!empty($raghu) && ($raghu == 'No') ) { $where_condition .= " AND b.mem_dosham NOT LIKE '%Rahu Kedhu%' "; }


			if (!empty($photo)) {
			 /*$where_condition .= " AND a.mem_phot_self != '' AND a.admin_app_phot = 'Yes'"; */
			 $where_condition .= " AND a.mem_phot_self != '' "; 
				} /*else {
					 $where_condition .= " AND a.mem_phot_self = ''";  }*/
		if (!empty($horo)) {
			 $where_condition .= " AND a.mem_photo_horoscope != ''"; 
			  $where_condition .= " AND a.admin_app_horoscope = 'Yes'";
				}
			//ignore profile
			
			$ignore_qry = "SELECT block_user FROM tbl_mem_blockprofiles WHERE mem_user = '".$_SESSION['matri_id']."' AND block_status = 1";
			$ignore_res =  $objDb->execute($ignore_qry,"select");
			if (!empty($ignore_res))
			{
				for ($k=0;$k < count($ignore_res);$k++)
				{ 
					if (trim($ignore_res[$k]['block_user']) != '') { 
						if ($ignore_res1 != '') $ignore_res1 .= ",";
						$ignore_res1 .= "'".$ignore_res[$k]['block_user'] ."'";
					}
				}
			}
			
			if (!empty($ignore_res1))
				$where_condition .= "  AND a.matri_id NOT IN (".$ignore_res1.")" ;  
			

				
				
				
					//ignore bookmark profile
			
			 $bkmark_qry = "SELECT bookmark_matri_id FROM tbl_bookmark WHERE matri_id  = '".$_SESSION['matri_id']."' ";
			$bkmark_res =  $objDb->execute($bkmark_qry,"select");
			$bkmark_res1='';
			if (!empty($bkmark_res))
			{
				for ($k=0;$k < count($bkmark_res);$k++)
				{ 
					if (trim($bkmark_res[$k]['bookmark_matri_id']) != '') { 
						if ($bkmark_res1 != '') $bkmark_res1 .= ",";
						$bkmark_res1 .= "'".$bkmark_res[$k]['bookmark_matri_id'] ."'";
					}
				}
			}
			
			
			if (!empty($bkmark_res1))
				 $where_condition .= "  AND a.matri_id NOT IN (".$bkmark_res1.")" ;  	
				
							if (!empty($matri_id))
				$where_condition .= "  AND a.matri_id NOT IN ('".$matri_id."')" ;  	
				
//echo $where_condition;				
  $search_qry ="SELECT b.mem_sub_caste,b.mem_caste_division,a.mem_gender, a.mem_marital_status,a.mem_fullname, a.mem_phot_self, a.mem_age, b.mem_dosham, a.admin_app_phot, DATE_FORMAT(a.mem_last_login,'%d-%b-%Y %h:%i %p') as mem_last_login, a.matri_id, b.mem_kottam, b.mem_star , b.mem_rasi, b.mem_religion, b.mem_caste_division, b.mem_sub_caste, c.mem_edu, c.empnature
 FROM tbl_member AS a INNER JOIN tbl_mem_astrology AS b ON b.matri_id = a.matri_id INNER JOIN tbl_mem_edu AS c ON c.matri_id = a.matri_id LEFT JOIN  tbl_mem_com AS d ON d.matri_id = a.matri_id LEFT JOIN  tbl_mem_physical  AS g ON g.matri_id = a.matri_id  INNER JOIN tbl_membership as e on e.membership_id  = a.mem_membership_id". $condition ." WHERE ".$where_condition." GROUP BY a.matri_id order by e.plan_activated_on DESC";

	return $search_qry;
		}	
		else if (isset($_REQUEST['act']) && $_REQUEST['act'] == 'iyear')
		{
		
		
 $cast1=$_REQUEST['lan'];
 $gender=$_REQUEST['gen'];
 if($cast1 == 'Iyer'){ $cast = 4; }else if($cast1 == 'Iyengar'){ $cast = 3; }

			$where_condition = " a.matri_id IS NOT NULL";
			$where_condition .= "   AND a.mem_status='Approved'";
			$where_condition .= "   AND d.plan_status='Active'";
			$where_condition .= "   AND a.mem_gender='$gender'";
			$where_condition .= "   AND b.mem_sub_caste='$cast'";
			//ignore profile
			if(isset($_SESSION['matri_id'])) {
			
			$ignore_qry = "SELECT block_user FROM tbl_mem_blockprofiles WHERE mem_user = '".$_SESSION['matri_id']."' AND block_status = 1";
			$ignore_res =  $objDb->execute($ignore_qry,"select");
			if (!empty($ignore_res))
			{
				for ($k=0;$k < count($ignore_res);$k++)
				{ 
					if (trim($ignore_res[$k]['block_user']) != '') { 
						if ($ignore_res1 != '') $ignore_res1 .= ",";
						$ignore_res1 .= "'".$ignore_res[$k]['block_user'] ."'";
					}
				}
			}
			
			if (!empty($ignore_res1))
				$where_condition .= "  AND a.matri_id NOT IN (".$ignore_res1.")" ;  
			
				
	//ignore bookmark profile
			
			 $bkmark_qry = "SELECT bookmark_matri_id FROM tbl_bookmark WHERE matri_id  = '".$_SESSION['matri_id']."' ";
			$bkmark_res =  $objDb->execute($bkmark_qry,"select");
			if (!empty($bkmark_res))
			{
				for ($k=0;$k < count($bkmark_res);$k++)
				{ 
					if (trim($bkmark_res[$k]['bookmark_matri_id']) != '') { 
						if ($bkmark_res1 != '') $bkmark_res1 .= ",";
						$bkmark_res1 .= "'".$bkmark_res[$k]['bookmark_matri_id'] ."'";
					}
				}
			}
			
			if (!empty($bkmark_res1))
				 $where_condition .= "  AND a.matri_id NOT IN (".$bkmark_res1.")" ;  	
				 
			if (!empty($matri_id))
				$where_condition .= "  AND a.matri_id NOT IN ('".$matri_id."')" ;  	
				}
								 				
  $search_qry ="SELECT b.mem_sub_caste,b.mem_caste_division,a.mem_gender, a.mem_fullname, a.mem_marital_status, a.mem_phot_self, a.mem_age, a.admin_app_phot, DATE_FORMAT(a.mem_last_login,'%d-%b-%Y %h:%i %p') as mem_last_login, a.matri_id, b.mem_kottam, b.mem_star, b.mem_rasi, c.mem_edu, c.empnature
 FROM tbl_member AS a INNER JOIN tbl_mem_astrology AS b ON b.matri_id = a.matri_id INNER JOIN tbl_mem_edu AS c ON c.matri_id = a.matri_id INNER JOIN tbl_membership as d on d. membership_id  = a.mem_membership_id WHERE".$where_condition."  GROUP BY a.matri_id order by d.plan_activated_on DESC";
 
	return $search_qry;
		}else if (isset($_REQUEST['act']) && $_REQUEST['act'] == 'profile_id')
		{
		
		 $search_matri_id=$_POST['search_matri_id'];
		
 
 
			$where_condition = " a.matri_id IS NOT NULL AND a.matri_id='".$search_matri_id."'";
			$where_condition .= "   AND a.mem_status='Approved'";
			$where_condition .= "   AND d.plan_status='Active'";
			
			//ignore profile
			if(isset($_SESSION['matri_id'])) {
			
			$ignore_qry = "SELECT block_user FROM tbl_mem_blockprofiles WHERE mem_user = '".$_SESSION['matri_id']."' AND block_status = 1";
			$ignore_res =  $objDb->execute($ignore_qry,"select");
			if (!empty($ignore_res))
			{
				for ($k=0;$k < count($ignore_res);$k++)
				{ 
					if (trim($ignore_res[$k]['block_user']) != '') { 
						if ($ignore_res1 != '') $ignore_res1 .= ",";
						$ignore_res1 .= "'".$ignore_res[$k]['block_user'] ."'";
					}
				}
			}
			
			if (!empty($ignore_res1))
				$where_condition .= "  AND a.matri_id NOT IN (".$ignore_res1.")" ;  
			
				
	//ignore bookmark profile
			
			 $bkmark_qry = "SELECT bookmark_matri_id FROM tbl_bookmark WHERE matri_id  = '".$_SESSION['matri_id']."' ";
			$bkmark_res =  $objDb->execute($bkmark_qry,"select");
			if (!empty($bkmark_res))
			{
				for ($k=0;$k < count($bkmark_res);$k++)
				{ 
					if (trim($bkmark_res[$k]['bookmark_matri_id']) != '') { 
						if ($bkmark_res1 != '') $bkmark_res1 .= ",";
						$bkmark_res1 .= "'".$bkmark_res[$k]['bookmark_matri_id'] ."'";
					}
				}
			}
			
			if (!empty($bkmark_res1))
				 $where_condition .= "  AND a.matri_id NOT IN (".$bkmark_res1.")" ;  	
				 
			if (!empty($matri_id))
				$where_condition .= "  AND a.matri_id NOT IN ('".$matri_id."')" ;  	
				}
								 				
  $search_qry ="SELECT b.mem_sub_caste,b.mem_caste_division,a.mem_gender, a.mem_fullname, a.mem_marital_status, a.mem_phot_self, a.mem_age, a.admin_app_phot, DATE_FORMAT(a.mem_last_login,'%d-%b-%Y %h:%i %p') as mem_last_login, a.matri_id, b.mem_kottam, b.mem_star, b.mem_rasi, c.mem_edu, c.empnature
 FROM tbl_member AS a INNER JOIN tbl_mem_astrology AS b ON b.matri_id = a.matri_id INNER JOIN tbl_mem_edu AS c ON c.matri_id = a.matri_id INNER JOIN tbl_membership as d on d. membership_id  = a.mem_membership_id WHERE".$where_condition."  GROUP BY a.matri_id order by d.plan_activated_on DESC";
 
	return $search_qry;
		}		
		
		
		
	}
}
?>