<?php

	include "library.php";

	$cxn = start_code();

	$cxn_common = db_common_login();


	$start_pos = val( $_GET, "startpos" );

	$query = "SELECT * FROM profile WHERE deleted = 'no' AND locked  = 'no' AND system_user = 'no' AND email_address_valid = 'yes' ";
		
	$ip_country = get_ip_country( $cxn_common );

	$heading = "Latest 100 Members";		
	
	
	$query .= " ORDER BY id DESC LIMIT 100";
	

	$result = run_query( $query, $cxn );


	page_header( $heading, $cxn, $cxn_common );
	
//	echo "<hr>";
	
	for ($i=0; $i < query_num_rows( $result ); $i++)
	{
		$data = get_row( $result );
			
		echo "<a name='id".$data['id']."'>";		/* bookmark to go back to search screen */

		echo "<table width='100%'><tr>";

		echo "<td width='10%'>";

		echo show_handle( $data['id'], $data['handle'], "search", $start_pos );

//		if ($data[$i]['logged_in'] != "")
//			echo "<br><br>".watermark( "online now" );

		echo "</td><td width='16%' align='center'>";

		show_photo( $data['id'], 100, -1, true, false, $cxn );

		echo "</td>";

//		echo "<td width='52%'>".black( convert_to_html( $data['short_intro'] ) )."</td>";

		echo "<td width='52%'>".show_introduction( $data['id'], convert_to_html( $data['short_intro'] ), "main", "0" )."</td>";

		echo "<td width='2%'></td>";

		if (! low_res_screen())
		{	
			echo "<td width='10%'>".black( name_case( $data['city'] ) )."</td>";

//			if ($country == "")
				echo "<td width='10%'>".black( $data['country'] )."</td>";
//			else
//				echo "<td width='10%'></td>";
		}
		else
		{
			echo "<td width='10%'>".black( name_case( $data['city'] )."<br><br>".name_case( $data['country'] ) )."</td>";		
		}

		echo "</tr></table><hr>";


//		if (! low_res_screen() && (($i-$start_pos) % 5 == 4))
		if (! low_res_screen() && ($i == 3))
		{
            echo "<br><br><br><table width='100%'><tr><td width='100%' align='center'>";
            
            echo show_ads_small_banner();
            
            echo "</td></tr></table><br><br><br><hr>";
		}
		
	}

	function show_introduction( $member_id, $text, $returnpoint, $startpos )
	{
		if ($startpos == "")
			$startpos = "0";		// if missing default to start of list

		$url = url_encode( "display_profile.php", "showid", $member_id, "returnpoint", $returnpoint, "startpos", $startpos );

		return ("<a href='".$url."' style='text-decoration: none;'><span class='gblack'>".$text."</span></a>");
	}
	
?>