ok

Mini Shell

Direktori : /home2/selectio/www/subamangala/admin/data-tables/
Upload File :
Current File : /home2/selectio/www/subamangala/admin/data-tables/profiles-match-list.php

<?php 
ob_start();
session_start();
include"../config/config.php";
//$allPermissions=$_SESSION['permission'];

$requestData= $_REQUEST;

if($requestData['length']==-1){
    $requestData['length']=100000;
}


/*Fetch Database column Details*/
        $columns = array( 
            0 =>'id',
            1 =>'id',
            2 =>'id',
            3 =>'created_on'
        );
        
$conditions="";


if(isset($_POST['gender'])){
    $string_gender = implode("','", $_POST['gender']);
    $conditions.="and h.gender in ('".$string_gender."')";
}
if(isset($_POST['regtype'])){
    $string_regtype = implode("','", $_POST['regtype']);
    $conditions.="and h.regtype in ('".$string_regtype."')";
}
if(isset($_POST['regnop'])){
    $string_regnop = implode("','", $_POST['regnop']);
    $conditions.="and h.regnop in ('".$string_regnop."')";
}

if(isset($_POST['caste'])){
    $string_caste = implode("','", $_POST['caste']);
    $conditions.="and h.caste in ('".$string_caste."')";
}

if(isset($_POST['subcaste'])){
    $string_subcaste = implode("','", $_POST['subcaste']);
    
    
    $conditions.="and h.subcaste in ('".$string_subcaste."')";
}

if(isset($_POST['edu'])){
    $string_edu = implode("','", $_POST['edu']);
    $conditions.="and h.edu in ('".$string_edu."')";
}

if(isset($_POST['job_place'])){
    $string_job_place = implode("','", $_POST['job_place']);
    $conditions.="and h.job_place in ('".$string_job_place."')";
}

if(isset($_POST['native_place'])){
    $string_native_place = implode("','", $_POST['native_place']);
    $conditions.="and h.native_place in ('".$string_native_place."')";
}

if(isset($_POST['natchatram'])){
    $string_natchatram = implode("','", $_POST['natchatram']);
    $conditions.="and h.natchatram in ('".$string_natchatram."')";
}

if(isset($_POST['edu_cat'])){
    $string_edu_cat = implode("','", $_POST['edu_cat']);
    $conditions.="and h.edu_cat in ('".$string_edu_cat."')";
}


if(isset($_POST['job_cat'])){
    $string_job_cat = implode("','", $_POST['job_cat']);
    $conditions.="and h.job_cat in ('".$string_job_cat."')";
}

if(isset($_POST['height_cat'])){
    $string_height_cat = implode("','", $_POST['height_cat']);
    $conditions.="and h.height_cat in ('".$string_height_cat."')";
}

if(isset($_POST['weight_cat'])){
    $string_weight_cat = implode("','", $_POST['weight_cat']);
    $conditions.="and h.weight_cat in ('".$string_weight_cat."')";
}
if(isset($_POST['broker_cat'])){
    $string_broker_cat = implode("','", $_POST['broker_cat']);
    $conditions.="and h.brokertype in ('".$string_broker_cat."')";
}
if(isset($_POST['brokername'])){
    $string_brokername = implode("','", $_POST['brokername']);
    $conditions.="and h.broker_ids in ('".$string_brokername."')";
}

if(isset($_POST['physical_hand'])){
    $string_physical_hand = implode("','", $_POST['physical_hand']);
    $conditions.="and h.physical_hand in ('".$string_physical_hand."')";
}

if(isset($_POST['astro_type'])){
    $string_astro_type = implode("','", $_POST['astro_type']);
    $conditions.="and h.astrotype in ('".$string_astro_type."')";
}

if(isset($_POST['rasi'])){
    $string_rasi = implode("','", $_POST['rasi']);
    $conditions.="and h.rasi in ('".$string_rasi."')";
}

if(isset($_POST['color'])){
    $string_color = implode("','", $_POST['color']);
    $conditions.="and h.color in ('".$string_color."')";
}
if(isset($_POST['height'])){
    $string_height = implode("','", $_POST['height']);
    $conditions.="and h.height in ('".$string_height."')";
}

if(isset($_POST['weight'])){
    $string_weight = implode("','", $_POST['weight']);
    $conditions.="and h.weight in ('".$string_weight."')";
}
if(isset($_POST['marriage'])){
    $string_marriage = implode("','", $_POST['marriage']);
    $conditions.="and h.marriage in ('".$string_marriage."')";
}
if(isset($_POST['wealth_class'])){
    $string_wealth_class = implode("','", $_POST['wealth_class']);
    $conditions.="and h.wealth_class in ('".$string_wealth_class."')";
}
if(isset($_POST['family_idty'])){
    $string_family_idty = implode("','", $_POST['family_idty']);
    $conditions.="and h.family_idty in ('".$string_family_idty."')";
}
if(isset($_POST['foreign_opt'])){
    $string_foreign_opt = implode("','", $_POST['foreign_opt']);
    $conditions.="and h.foreign_opt in ('".$string_foreign_opt."')";
}

if(isset($_POST['min']) && $_POST['max']!=''){
    $min=date("Y-m-d", strtotime($_POST['min']));	
	$max=date("Y-m-d", strtotime($_POST['max']));	
	$conditions.=" and DATE_FORMAT(STR_TO_DATE(regdate,'%d-%m-%Y'),'%Y-%m-%d') BETWEEN '$min' and '$max'";
    
}

if(!empty($_POST['mint']) && !empty($_POST['maxt'])){
														
    $mint=$_POST['mint'];	
    $maxt=$_POST['maxt'];	
    $conditions.=" and (tidy >= $mint AND tidy <= $maxt)";
}


if(!empty($_POST['mini']) && !empty($_POST['maxi'])){
														
    $mini=$_POST['mini'];	
    $maxi=$_POST['maxi'];	
    $conditions.=" and (monthly_income >= $mini and monthly_income<=$maxi )";
    }

if(isset($_POST['marstatus2'])){
    $string_marstatus2 = implode("','", $_POST['marstatus2']);
    $conditions.="and h.marstatus2 in ('".$string_marstatus2."')";
}


if(isset($_POST['rname'])){
    $string_rname = implode("','", $_POST['rname']);
    $conditions.="and h.registeredby in ('".$string_rname."')";
}


if(isset($_POST['caste_restrict'])){
    $conditions.="and h.caste_restrict ='".$_POST['caste_restrict']."'";
}

if(isset($_POST['astro_option'])){
    $conditions.="and h.astro_option ='".$_POST['astro_option']."'";
}
if(isset($_POST['father_abs'])){
    $conditions.="and h.father_abs ='".$_POST['father_abs']."'";
}

if(isset($_POST['mother_abs'])){
   $conditions.="and h.mother_abs ='".$_POST['mother_abs']."'";
}
if(isset($_POST['bro_abs'])){
    $conditions.="and h.bro_abs ='".$_POST['bro_abs']."'";
}



/*Fetch All Data Start*/        
        
    	$statement = $pdo->prepare("SELECT h.*,caste.name as caste_name,subcaste.name as subcaste_name,preference.Pref_Limit as profile_pref_limit,preference.Entry_Date as profile_pref_date FROM `profiles` h INNER JOIN caste ON h.caste=caste.id INNER JOIN preference ON preference.Profileid=h.id INNER JOIN subcaste ON h.subcaste=subcaste.id where h.id!=0 and delete_status = 1 ".$conditions." ORDER BY h.id DESC");
	    error_log("SELECT h.*,caste.name as caste_name,subcaste.name as subcaste_name,preference.Pref_Limit as profile_pref_limit,preference.Entry_Date as profile_pref_date FROM `profiles` h INNER JOIN caste ON h.caste=caste.id INNER JOIN preference ON preference.Profileid=h.id INNER JOIN subcaste ON h.subcaste=subcaste.id where h.id!=0 and delete_status = 1 ".$conditions." ORDER BY h.id DESC");
		$result = $statement->execute();
		$query = $statement->fetchAll(PDO::FETCH_ASSOC);
		$totalData = $statement->rowCount();
        $totalFiltered = $totalData;
        
/*Fetch All Data End*/       
        
/*Fetch Filter Data Start*/    
         $sql="SELECT h.*,caste.name as caste_name,subcaste.name as subcaste_name,preference.Pref_Limit as profile_pref_limit,preference.Entry_Date as profile_pref_date FROM `profiles` h INNER JOIN caste ON h.caste=caste.id INNER JOIN preference ON preference.Profileid=h.id INNER JOIN subcaste ON h.subcaste=subcaste.id where h.id!=0 and delete_status = 1 ".$conditions;
       
       error_log("SELECT h.*,caste.name as caste_name,subcaste.name as subcaste_name,preference.Pref_Limit as profile_pref_limit,preference.Entry_Date as profile_pref_date FROM `profiles` h INNER JOIN caste ON h.caste=caste.id INNER JOIN preference ON preference.Profileid=h.id INNER JOIN subcaste ON h.subcaste=subcaste.id where h.id!=0 and delete_status = 1 ".$conditions);
        if( !empty($_REQUEST['search']) ) 
         {   
        	$sql.=" AND ( h.id LIKE '%".$_REQUEST['search']."%' ";    
        	$sql.=" OR h.bname LIKE '%".$_REQUEST['search']."%'";
        	$sql.=" OR h.regtype LIKE '%".$_REQUEST['search']."%'";
        	$sql.=" OR h.edu LIKE '%".$_REQUEST['search']."%'";
        	$sql.=" OR h.gender LIKE '%".$_REQUEST['search']."%'";
        	$sql.=" OR h.caste LIKE '%".$_REQUEST['search']."%'";
        	$sql.=" OR h.natchatram LIKE '%".$_REQUEST['search']."%'";
        	$sql.=" OR h.edu_cat LIKE '%".$_REQUEST['search']."%'";
        	$sql.=" OR h.father_name LIKE '%".$_REQUEST['search']."%'";
        	$sql.=" OR h.native_place LIKE '%".$_REQUEST['search']."%'";
        	$sql.=" OR h.regdate LIKE '%".$_REQUEST['search']."%'";
        	$sql.=" OR h.brokercount LIKE '%".$_REQUEST['search']."%'";
        	$sql.=" OR h.dob LIKE '%".$_REQUEST['search']."%' ) ";
        }
        
/*Fetch Filter Data End*/       
        


         $sql.=" ORDER BY ". $columns[$requestData['order'][0]['column']]."   ".$requestData['order'][0]['dir']."  LIMIT ".$requestData['start']." ,".$requestData['length']."   ";
       	
        $statement = $pdo->prepare($sql);
        $statement->execute();
		$query = $statement->fetchAll(PDO::FETCH_ASSOC);

$data = array();
$i=1;
foreach( $query as $row ) {  // preparing an array
	$nestedData=array(); 
	
$action= "<div class='text-center'><div class='btn-group'>";
	 
	 //if($allPermissions['category']['update']=="1"){                   
		               $action.=" <a style='padding: 6px;margin-right: 3px;' href='edit-profile.php?id=".$row["id"]."' title='Edit Profile' class='tip btn btn-success btn-xs'>
		                    <i class='fa fa-edit'></i>
		                </a>";
		               $action.=" <a style='padding: 6px;margin-right: 3px;' href='view-profile.php?id=".$row["id"]."' title='View Profile' class='tip btn btn-warning btn-xs'>
		                    <i class='fa fa-eye'></i>
		                </a>";
	 //}	                
	//if($allPermissions['category']['delete']=="1"){	                
		                $action.=" <a style='padding: 6px;margin-right: 3px;' target='_blank' href='profile-print.php?id=".$row["id"]."' title='Print Profile'  class='tip btn btn-danger btn-xs'>
		                    <i class='fa fa-print'></i>
		                </a>";
//	}
		 	$action.="</div></div>";
	 	$nestedData[] = $action; 
		 

$nestedData[] = $row["regtype"];
	$nestedData[] = $row["gender"];
	$nestedData[] = $row["regnop"].''.$row['id'];
	$nestedData[] = ucfirst($row["binit"]).''.$row['bname'];
	$nestedData[] = $row["dob"];
	$nestedData[] = $row["edu"];
	$nestedData[] = $row["edu_cat"];
	$nestedData[] = $row["father_name"];
	$nestedData[] = $row["native_place"];
	$nestedData[] = $row["caste_name"];
	if($row["subcaste_name"]!=''){
	  	$nestedData[] = $row["subcaste_name"];  
	}else{
	    $nestedData[]='<span>NULL</span>';
	}
	
		$svalue='';
	if($row['brokercount']>0)
																{
																	if(@strpos(",", $row['broker_ids']) !== false ) 
																	{
																		$bro_ids[0] = $row['broker_ids'];
																		
																	}
																	else
																	{
																		$bro_ids = explode(",",$row['broker_ids']);
																	}
																	for($i=0;$i<$row['brokercount'];$i++)
																	{
																		
																		 $statement3 = $pdo->prepare("SELECT * FROM brokers where id='$bro_ids[$i]'");
                                                                         $statement3->execute();
                                                                         $bro_row = $statement3->fetchAll(PDO::FETCH_ASSOC);
																		
																
																if($bro_row[0]['brokername']!="")
																{
																
																
																$svalue=$svalue.''.$bro_row[0]['brokername'].',';
																      
                                                                  
                                                     			 
																}
																}
																}
	$nestedData[] =$svalue;
	$nestedData[] = age($row["dob"]);
	$nestedData[] = $row["job_cat"];
	$nestedData[] = $row["job_place"];
	$nestedData[] = $row["monthly_income"];
	$nestedData[] = $row["tidy"];
	
    	if($row["natchatram"]=="1"){ $nestedData[]= "அஸ்வினி";}
	else if($row["natchatram"]=="2"){ $nestedData[]= "பரணி";}
	else if($row["natchatram"]=="3"){ $nestedData[]= "கார்த்திகை";}
	else if($row["natchatram"]=="4"){ $nestedData[]= "ரோகிணி";}
	else if($row["natchatram"]=="5"){ $nestedData[]= "மிருகசீரிடம்";}
	else if($row["natchatram"]=="6"){ $nestedData[]= "திருவாதிரை";}
	else if($row["natchatram"]=="7"){ $nestedData[]= "புனர்பூசம்";}
	else if($row["natchatram"]=="8"){ $nestedData[]= "பூசம்";}
	else if($row["natchatram"]=="9"){ $nestedData[]= "ஆயில்யம்";}
	else if($row["natchatram"]=="10"){ $nestedData[]= "மகம்";}
	else if($row["natchatram"]=="11"){ $nestedData[]= "பூரம்";}
	else if($row["natchatram"]=="12"){ $nestedData[]= "உத்தரம்";}
	else if($row["natchatram"]=="13"){ $nestedData[]= "அஸ்தம்";}
	else if($row["natchatram"]=="14"){ $nestedData[]= "சித்திரை";}
	else if($row["natchatram"]=="15"){ $nestedData[]= "சுவாதி";}
	else if($row["natchatram"]=="16"){ $nestedData[]= "விசாகம்";}
	else if($row["natchatram"]=="17"){ $nestedData[]= "அனுஷம்";}
	else if($row["natchatram"]=="18"){ $nestedData[]= "கேட்டை";}
	else if($row["natchatram"]=="19"){ $nestedData[]= "மூலம்";}
	else if($row["natchatram"]=="20"){ $nestedData[]= "பூராடம்";}
	else if($row["natchatram"]=="21"){ $nestedData[]= "உத்திராடம்";}
	else if($row["natchatram"]=="22"){ $nestedData[]= "திருவோணம்";}
	else if($row["natchatram"]=="23"){ $nestedData[]= "அவிட்டம்";}
	else if($row["natchatram"]=="24"){ $nestedData[]= "சதயம்";}
	else if($row["natchatram"]=="25"){ $nestedData[]= "பூரட்டாதி";}
	else if($row["natchatram"]=="26"){ $nestedData[]= "உத்திரட்டாதி";}
	else if($row["natchatram"]=="27"){ $nestedData[]= "ரேவதி";
}
	if($row["rasi"]=="1"){ $nestedData[]= "மேஷம்";}
   else if($row["rasi"]=="2"){ $nestedData[]= "ரிஷபம்";}
   else if($row["rasi"]=="3"){ $nestedData[]= "மிதுனம்";}
   else if($row["rasi"]=="4"){ $nestedData[]= "கடகம்";}
   else if($row["rasi"]=="5"){ $nestedData[]= "சிம்மம்";}
   else if($row["rasi"]=="6"){ $nestedData[]= "கன்னி";}
   else if($row["rasi"]=="7"){ $nestedData[]= "துலாம்";}
   else if($row["rasi"]=="8"){ $nestedData[]= "விருச்சிகம்";}
   else if($row["rasi"]=="9"){ $nestedData[]= "தனுசு";}
   else if($row["rasi"]=="10"){ $nestedData[]= "மகரம்";}
   else if($row["rasi"]=="11"){ $nestedData[]= "கும்பம்";}
   else{ $nestedData[]= "மீனம்";}
															   	
	if($row["color"]=="1"){ $nestedData[]= "மாநிறம்";}
																 
 else if($row["color"]=="2"){ $nestedData[]= "நிறம் குறைவானவர்";}
 else{ $nestedData[]= "சிகப்பு";}
 
 
 	if($row["height_cat"]=="1"){ $nestedData[]= "உயரம் குறைவானவர்";}
																 
 else if($row["height_cat"]=="2"){ $nestedData[]= "சரியான உயரம்";}
 else{ $nestedData[]= "மிகவும் உயரமானவர்";}
					
	$nestedData[] = $row["height"];				

if($row["weight_cat"]=="1"){ $nestedData[]= "ஒல்லியானவர்";}
																 
 else if($row["weight_cat"]=="2"){ $nestedData[]= "சரியான எடை உடையவர்";}
 else{ $nestedData[]= "குண்டானவர்";}
					
$nestedData[] = $row["weight"];
if($row["physical_hand"]=="1"){ $nestedData[]= "ஆம்";}
else{ $nestedData[]= "இல்லை";}
				
$nestedData[] = $row["astrotype"];
if($row["caste_restrict"]=="yes"){ $nestedData[]= "ஆம்";} else {$nestedData[]= "இல்லை";}
if($row["astro_option"]=="yes"){ $nestedData[]= "ஆம்";} else {$nestedData[]= "இல்லை";}
if($row["marriage"]=="first"){ $nestedData[]= "இல்லை";} else {$nestedData[]= "ஆம்";}
if($row["marstatus2"]=="widow"){ $nestedData[]= "விதவை";}  elseif($row["marstatus2"]=="divorcy"){ $nestedData[]= "விவாகரத்தானவர்";} else {$nestedData[]= "--";}
	
	if($row["child"]=="yes"){ $nestedData[]= "குழந்தை உள்ளவர்";}  else {$nestedData[]= "குழந்தை இல்லாதவர் ";}
									if($row["father_abs"]=="yes"){ $nestedData[]= "ஆம்";}  else {$nestedData[]= "இல்லை";}
										if($row["mother_abs"]=="yes"){ $nestedData[]= "ஆம்";}  else {$nestedData[]= "இல்லை";}
											
											if($row["bro_abs"]=="yes"){ $nestedData[]= "ஆம்";}  else {$nestedData[]= "இல்லை";}
												
												if($row["wealth_class"]=="1"){ $nestedData[]= "சாதாரண வசதி";}
																 
																 else if($row["wealth_class"]=="2"){ $nestedData[]= "நடுத்தர வசதி";}
																 else{ $nestedData[]= "உயர் வசதி(வி.ஐ.பி)";}
																 	
																 	$nestedData[] = $row["family_idty"];
																 	
																 	 if($row["foreign_opt"]=="1"){ $nestedData[]= "சம்மதம்";}
																 
																 else { $nestedData[]= "வேண்டாம்";}
																 	
																 	$a= explode("-",$row["regdate"]);
																if($a[0]!="")
																{
																	$nestedData[]= $a[0]."/".$a[1]."/".$a[2]; 
																}
																else
																{
																	$nestedData[]= "--"; 
																}
															   	
															   		$nestedData[] = $row["registeredby"];	
	$data[] = $nestedData;
	$i++;
}

$json_data = array(
			"draw"            => intval( $requestData['draw'] ),  
			"recordsTotal"    => intval( $totalData ),  
			"recordsFiltered" => intval( $totalFiltered ), 
			"data"            => $data   
			);

echo json_encode($json_data); 


function age($birthday){
 list($day, $month, $year) = explode("-", $birthday);
 $year_diff  = date("Y") - $year;
 $month_diff = date("m") - $month;
 $day_diff   = date("d") - $day;
 if ($day_diff < 0 && $month_diff==0) $year_diff--;
 if ($day_diff < 0 && $month_diff < 0) $year_diff--;
 return $year_diff;
}

?>

Zerion Mini Shell 1.0