Location: PHPKode > projects > HuMo-gen > admin/include/tree_check.php
<?php

// *** Safety line ***
if (!defined('ADMIN_PAGE')){ exit; }

include ('../include/database_name.php');
global $Taalkeuze;

echo '<H1 align=center>'.$language["control_header"].'</H1>';

@set_time_limit(3000);

echo '<form method="POST" action="'.$_SERVER['PHP_SELF'].'" style="display : inline;">';
echo '<input type="hidden" name="page" value="'.$page.'">';

if (isset($_POST['tree'])){ $tree=$_POST['tree']; }

echo $language["control_choose"];
$tree_sql = "SELECT * FROM humo_trees WHERE tree_prefix!='LEEG' ORDER BY tree_order";

$tree_result = mysql_query($tree_sql,$db);
echo '<select size="1" name="tree">';
while ($treeDb=mysql_fetch_object($tree_result)){
	$treetext_name=database_name($treeDb->tree_prefix, $Taalkeuze);		
	$selected='';
	if (isset($tree)){ if ($treeDb->tree_prefix==$tree){ $selected=' SELECTED'; } }
	echo '<option value="'.$treeDb->tree_prefix.'"'.$selected.'>'.
		@$treetext_name.'</option>';
}
echo '</select>';

$age_search=80; if (isset($_POST['age_search'])){ $age_search=$_POST['age_search']; }
$age_mark=90; if (isset($_POST['age_mark'])){ $age_mark=$_POST['age_mark']; }

echo ' '.$language["control_min_age"].': <input type="text" name="age_search" value="'.$age_search.'" size="2">';
echo ' '.$language["control_mark_age"].': <input type="text" name="age_mark" value="'.$age_mark.'" size="2">';

echo ' <input type="Submit" name="" value="'.$language["admin_select"].'">';
echo '</form>';

if (isset($_POST['tree'])){
	include ('../include/calculate_age_cls.php');
	$leeftijd = New berekening_jaar_cls;
	$tree=veilig($_POST["tree"]);

	echo '<table class="humo" width="800px"><tr><td width="50%" valign="top">';

		// *** Check age ***
		$persoon_qry= "SELECT * FROM ".$tree."person ORDER BY pers_lastname, pers_firstname";
		$persoon_result = mysql_query($persoon_qry,$db);
		echo '<h2>'.$language["control_age"].'</h2>';
		echo '<div style="height: 400px; overflow-y: scroll;">';
		echo '<table class="humo">';
		while ($persoon=mysql_fetch_object($persoon_result)){
			$age='';
			if (($persoon->pers_bapt_date OR $persoon->pers_birth_date) AND $persoon->pers_death_date) {
				$age=$leeftijd->leeftijd_berekenen($persoon->pers_bapt_date,$persoon->pers_birth_date,$persoon->pers_death_date, true);
				//echo $age;  //comma en spatie komen al met $age mee
			}
			if ($age>$age_search){
				echo '<tr><td>';
					if ($age>$age_mark){ echo '<b>'; }
					echo '<a href="../gezin.php?database='.$tree.'&amp;id='.$persoon->pers_indexnr.'&hoofdpersoon='.$persoon->pers_gedcomnumber.'">';
					echo $persoon->pers_firstname.' '.$persoon->pers_prefix.$persoon->pers_lastname;
					echo '</a>';
					if ($age>$age_mark){ echo '</b>'; }
				echo '</td><td>';
					if ($age>$age_mark){ echo '<b>'; }
					echo $age;
					if ($age>$age_mark){ echo '</b>'; }
				echo '</td></tr>';
			}
		}
		echo '</table>';
		echo '</div>';
	
	echo '</td><td valign="top">';

		// *** Show latest changes ***
		$persoon_qry= "SELECT *, STR_TO_DATE(pers_changed_date,'%d %b %Y') AS datum FROM ".$tree."person
			WHERE pers_changed_date!=''
			ORDER BY datum DESC, pers_changed_time DESC
			LIMIT 0,50";

		$persoon_result = mysql_query($persoon_qry,$db);
		echo '<h2>'.$language["control_latest_changes"].'</h2>';
		echo '<div style="height: 400px; overflow-y: scroll;">';
		echo '<table class="humo">';
		while ($persoon=mysql_fetch_object($persoon_result)){
			echo '<tr><td>';
				echo '<a href="../gezin.php?database='.$tree.'&amp;id='.$persoon->pers_indexnr.'&hoofdpersoon='.$persoon->pers_gedcomnumber.'">';
				echo $persoon->pers_firstname.' '.$persoon->pers_prefix.$persoon->pers_lastname;
				echo '</a>';
			echo '</td><td>';
				echo '<nobr>'.strtolower($persoon->pers_changed_date).' '.$persoon->pers_changed_time.'</nobr>';
			echo '</td></tr>';
		}
		echo '</table>';
		echo '</div>';
	
	echo '</td></tr></table>';

}

?>
Return current item: HuMo-gen