<?php 
/**
 * Usersuche2k7 v0.1
 * Copyright (c) 2007 by Jörg Harr (joerg@echtHARRt.de)
 * http://www.echtHARRt.de
 * 
 * Usersuche v0.1 was based on Usersuche vkp MX2.1
 * by Andreas Schlössinger - www.rubensdreams.de
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * $Author: Jörg Harr $
 */
if (!function_exists('is_user')) die ('You can\'t access this file directly...');

if (!defined("USEARCH_MODULE_NAME")) define("USEARCH_MODULE_NAME", basename(dirname(__FILE__)));
if (!defined("USEARCH_MODULE_PATH")) define("USEARCH_MODULE_PATH", "modules/" . USEARCH_MODULE_NAME . "/");

$index = 1;

?>

<style type="text/css">
.bordertop { 
   border: 1px ridge silver; 
}
.borderzeile { 
   border-bottom: 1px ridge silver; 
}
</style>

<script>
	function loadPage(anfang){
		myform = 	document.getElementById('SearchForm');
		myhidden = document.getElementById('anfangspos');
		myhidden.setAttribute("value", anfang);
		myform.submit();
	}
</script>
<?
init();
function init(){
	//  Switch
	include("header.php");
	OpenTable();
	echo "<center><img src=\"modules/Usersuche/images/guy.gif\" border=\"0\" align=\"absmiddle\"><font style='font-size: 18px;'>$sitename Mitgliedersuche</font><img src=\"modules/Usersuche/images/girl.gif\" border=\"0\" align=\"absmiddle\"></center>";
	CloseTable();
	if(!empty($_POST["ausgabe"])){
		search();
		echo "<div style=\"display:none\">";
		eingabe();
		echo "</div>";
	}else{
		eingabe();
	}
	include("footer.php");	
}

/* Eingabemaske */  
function eingabe () {
	global $bgcolor1, $bgcolor2, $bgcolor3, $sitename;
	OpenTable();
################# HINWEIS:
################# Sollten die Auswahlfelder bei euch NICHT funktionieren, bitte die Option Zeilen anpassen. D.h. Gegenfalls die value ändern oder fehlende Einträge hinzufügen/löschen. 
################# Hierzu ganz einfach in die mx_userfunctions.php gehen und zB. nach "Famstatus" suchen. dann alles abgleichen und dann gehts.
#################
?>
	<center>
		<form name="SearchForm" action="modules.php?name=Usersuche" method="post" id="SearchForm">
			<table class="bordertop" cellspacing="1" cellpadding="3" bgcolor="<?echo"$bgcolor1";?>">
				<tr valign="top">
					<td class="borderzeile" bgcolor="<?echo"$bgcolor1";?>"><b>Benutzername:</b></td>
					<td class="borderzeile" colspan="3" bgcolor="<?echo"$bgcolor1";?>"><input type="text" name="uname" size="50" maxlength="25" value="<? if(!empty($_POST["uname"])) echo $_POST["uname"]; ?>"></td>
				</tr>
				<tr valign="top">
					<td class="borderzeile" bgcolor="<?echo"$bgcolor1";?>"><b>Richtiger Name:</b></td>
					<td class="borderzeile" colspan="3" bgcolor="<?echo"$bgcolor1";?>"><input type="text" name="realname" size="50" maxlength="60" value="<? if(!empty($_POST["realname"])) echo $_POST["realname"]; ?>"></td>
				</tr>
				<tr valign="top">
					<td class="borderzeile" bgcolor="<?echo"$bgcolor1";?>"><b>Wohnort:</b></td>
					<td class="borderzeile" colspan="3" bgcolor="<?echo"$bgcolor1";?>"><input type="text" name="user_from" size="20" maxlength="100" value="<? if(!empty($_POST["user_from"])) echo $_POST["user_from"]; ?>"></td>
				</tr>
				<tr valign="top">
					<td class="borderzeile" bgcolor="<?echo"$bgcolor1";?>"><b>Geburtstag:</b></td>
					<td class="borderzeile" colspan="3" bgcolor="<?echo"$bgcolor1";?>">
						Tag:
						<select name="bday_day">
							<option value="" selected>-</option>
							<?
							for($i=1; $i<=31;$i++){ 
								echo "<option value=\"".SucheGetDoubleNumber($i)."\"";
								if($_POST["bday_day"] == SucheGetDoubleNumber($i)) echo " selected";
								echo ">".SucheGetDoubleNumber($i)."</option>";
							}
							?>
						</select>
						Monat:
						<select name="bday_month">
							<option value="" selected>-</option>
							<?
							for($i=1; $i<=12;$i++){ 
								echo "<option value=\"".SucheGetDoubleNumber($i)."\"";
								if($_POST["bday_month"] == SucheGetDoubleNumber($i)) echo " selected";
								echo ">".SucheGetDoubleNumber($i)."</option>";
							}
							?>
						</select>
						Jahr:
						<input type="text" name="bday_year" value="<? if(!empty($_POST["bday_year"])) echo $_POST["bday_year"]; ?>" size="5" maxlength="4">
					</td>
				</tr>
				<tr valign="top">
					<td class="borderzeile" bgcolor="<?echo"$bgcolor1";?>"><b>Im Alter von:</b></td>
					<td class="borderzeile" colspan="3" bgcolor="<?echo"$bgcolor1";?>">
						<input type="text" name="user_partneralter1" size="2" maxlength="2" value="<? if(!empty($_POST["user_partneralter1"])) echo $_POST["user_partneralter1"]; ?>">
						bis
						<input type="text" name="user_partneralter2" size="2" maxlength="2" value="<? if(!empty($_POST["user_partneralter2"])) echo $_POST["user_partneralter2"]; ?>">
					</td>
				</tr>
				<tr valign="top">
					<td class="borderzeile" bgcolor="<?echo"$bgcolor1";?>"><b>Geschlecht:</b></td>
					<td class="borderzeile" colspan="3" bgcolor="<?echo"$bgcolor1";?>">
						<select name='user_sexus' size='1'>
							<option value=''<? if(empty($_POST["user_sexus"])) echo " selected"; ?>>egal</option>
							<option value='0'<? if($_POST["user_sexus"] == "0") echo " selected"; ?>>nicht angegeben</option>
							<option value='1'<? if($_POST["user_sexus"] == "1") echo " selected"; ?>>weiblich</option>
							<option value='2'<? if($_POST["user_sexus"] == "2") echo " selected"; ?>>m&auml;nnlich</option>
						</select>
					</td>
				</tr>
				<tr valign="top">
					<td class="borderzeile" bgcolor="<?echo"$bgcolor1";?>"><b>Familienstand:</b></td>
					<td class="borderzeile" colspan="3" bgcolor="<?echo"$bgcolor1";?>">
						<select name="user_famstatus" size="1">
							<option value=""<? if(empty($_POST["user_famstatus"])) echo " selected"; ?>>egal</option>
							<option value="1"<? if($_POST["user_famstatus"] == "1") echo " selected"; ?>>single</option>
							<option value="2"<? if($_POST["user_famstatus"] == "2") echo " selected"; ?>>vergeben</option>
							<option value="3"<? if($_POST["user_famstatus"] == "3") echo " selected"; ?>>verliebt</option>
							<option value="0"<? if($_POST["user_famstatus"] == "0") echo " selected"; ?>>kein Interesse</option>
						</select>
					</td>
				</tr>
				<tr valign="top">
					<td class="borderzeile" bgcolor="<?echo"$bgcolor1";?>"><b>Grösse:</b></td>
					<td class="borderzeile" width="100%" bgcolor="<?echo"$bgcolor1";?>" ><input type="text" name="user_heigh1" size="3" maxlength="3" value="<? if(!empty($_POST["user_heigh1"])) echo $_POST["user_heigh1"]; ?>">&nbsp;cm bis <input type="text" name="user_heigh2" size="3" maxlength="3" value="<? if(!empty($_POST["user_heigh2"])) echo $_POST["user_heigh2"]; ?>">&nbsp;cm</td>
					<td class="borderzeile" bgcolor="<?echo"$bgcolor1";?>" ><b>Gewicht:</b></td>
					<td class="borderzeile" bgcolor="<?echo"$bgcolor1";?>"><input type="text" name="user_gewicht1" size="3" maxlength="3" value="<? if(!empty($_POST["user_gewicht1"])) echo $_POST["user_gewicht1"]; ?>">&nbsp;kg bis <input type="text" name="user_gewicht2" size="3" maxlength="3" value="<? if(!empty($_POST["user_gewicht2"])) echo $_POST["user_gewicht2"]; ?>">&nbsp;kg</td>
				</tr>
				<tr valign="top">
					<td class="borderzeile" bgcolor="<?echo"$bgcolor1";?>"><b>Haarfarbe:</b></td>
					<td class="borderzeile" bgcolor="<?echo"$bgcolor1";?>" ><input type="text" name="user_haar" size="10" maxlength="30" value="<? if(!empty($_POST["user_haar"])) echo $_POST["user_haar"]; ?>"></td>
					<td class="borderzeile" bgcolor="<?echo"$bgcolor1";?>" ><b>Augenfarbe:</b></td>
					<td class="borderzeile" bgcolor="<?echo"$bgcolor1";?>"><input type="text" name="user_augen" size="10" maxlength="30" value="<? if(!empty($_POST["user_augen"])) echo $_POST["user_augen"]; ?>"></td>
				</tr>
				<tr valign="top">
					<td class="borderzeile" bgcolor="<?echo"$bgcolor1";?>"><b>Raucher:</b></td>
					<td class="borderzeile" bgcolor="<?echo"$bgcolor1";?>">
						<select name="user_smoke" size="1">
							<option value=""<? if(empty($_POST["user_smoke"])) echo " selected"; ?>>egal</option>
							<option value="0"<? if($_POST["user_smoke"] == "0") echo " selected"; ?>>Keine Angabe</option>
							<option value="1"<? if($_POST["user_smoke"] == "1") echo " selected"; ?>>Ja</option>
							<option value="2"<? if($_POST["user_smoke"] == "2") echo " selected"; ?>>Nein</option>
							<option value="3"<? if($_POST["user_smoke"] == "3") echo " selected"; ?>>Gelegentlich</option>
						</select>
					</td>
					<td class="borderzeile" bgcolor="<?echo"$bgcolor1";?>"><b>Alkohol:</b></td>
					<td class="borderzeile" bgcolor="<?echo"$bgcolor1";?>">
						<select name="user_alkohol" size="1">
							<option value=""<? if(empty($_POST["user_alkohol"])) echo " selected"; ?>>egal</option>
							<option value="0"<? if($_POST["user_alkohol"] == "0") echo " selected"; ?>>Keine Angabe</option>
							<option value="1"<? if($_POST["user_alkohol"] == "1") echo " selected"; ?>>Oft</option>
							<option value="2"<? if($_POST["user_alkohol"] == "2") echo " selected"; ?>>Gelegentlich</option>
							<option value="3"<? if($_POST["user_alkohol"] == "3") echo " selected"; ?>>Nie</option>
						</select>
					</td>
				</tr>
				<tr valign="top">
					<td class="borderzeile" bgcolor="<?echo"$bgcolor1";?>"><b>Piercing:</b></td>
					<td class="borderzeile" bgcolor="<?echo"$bgcolor1";?>">
						<select name="user_piercing" size="1">
							<option value=""<? if(empty($_POST["user_piercing"])) echo " selected"; ?>>egal</option>
							<option value="0"<? if($_POST["user_piercing"] == "0") echo " selected"; ?>>Keine Angabe</option>
							<option value="1"<? if($_POST["user_piercing"] == "1") echo " selected"; ?>>Ja</option>
							<option value="2"<? if($_POST["user_piercing"] == "2") echo " selected"; ?>>Nein</option>
							<option value="3"<? if($_POST["user_piercing"] == "3") echo " selected"; ?>>Noch nicht</option>
						</select>
					</td>
					<td class="borderzeile" bgcolor="<?echo"$bgcolor1";?>"><b>Tättowierung:</b></td>
					<td class="borderzeile" bgcolor="<?echo"$bgcolor1";?>">
						<select name="user_tatto" size="1">
							<option value=""<? if(empty($_POST["user_tatto"])) echo " selected"; ?>>egal</option>
							<option value="0"<? if($_POST["user_tatto"] == "0") echo " selected"; ?>>Keine Angabe</option>
							<option value="1"<? if($_POST["user_tatto"] == "1") echo " selected"; ?>>Ja</option>
							<option value="2"<? if($_POST["user_tatto"] == "2") echo " selected"; ?>>Nein</option>
							<option value="3"<? if($_POST["user_tatto"] == "3") echo " selected"; ?>>Noch nicht</option>
						</select>
					</td>
				</tr>
				<tr valign="top">
					<td colspan="4" bgcolor="<?echo"$bgcolor1";?>">
						<br><font class="title"><b>Was sucht sie/er?</b></font>
					</td>
				</tr>
				<tr valign="top">
					<td bgcolor="<?echo"$bgcolor1";?>">&nbsp;</td>
					<td bgcolor="<?echo"$bgcolor1";?>">
						<select name="user_sucht" size="1">
							<option value=""<? if(empty($_POST["user_sucht"])) echo " selected"; ?>>egal</option>
							<option value="1"<? if($_POST["user_sucht"] == "1") echo " selected"; ?>>einen Mann</option>
							<option value="2"<? if($_POST["user_sucht"] == "2") echo " selected"; ?>>eine Frau</option>
							<option value="3"<? if($_POST["user_sucht"] == "3") echo " selected"; ?>>ein Paar</option>
							<option value="4"<? if($_POST["user_sucht"] == "4") echo " selected"; ?>>lustige Menschen</option>
						</select>
					</td>
					<td bgcolor="<?echo"$bgcolor1";?>"><b>für eine/n:</b></td><td bgcolor="<?echo"$bgcolor1";?>">
						<select name="user_beziehung" size="1">
							<option value=""<? if(empty($_POST["user_beziehung"])) echo " selected"; ?>>egal</option>
							<option value="1"<? if($_POST["user_beziehung"] == "1") echo " selected"; ?>>fixe Beziehung</option>
							<option value="2"<? if($_POST["user_beziehung"] == "2") echo " selected"; ?>>Seitensprung</option>
							<option value="3"<? if($_POST["user_beziehung"] == "3") echo " selected"; ?>>One Night Stand</option>
							<option value="4"<? if($_POST["user_beziehung"] == "4") echo " selected"; ?>>Freundschaft</option>
							<option value="5"<? if($_POST["user_beziehung"] == "5") echo " selected"; ?>>E-Mail Freundschaft</option>
							<option value="6"<? if($_POST["user_beziehung"] == "6") echo " selected"; ?>>Freizeitpartner</option>
						</select>
					</td>
				</tr>
				<tr valign="top">
					<td class="borderzeile" bgcolor="<?echo"$bgcolor1";?>"><b>Figur:</b></td>
					<td class="borderzeile" colspan="3" bgcolor="<?echo"$bgcolor1";?>">
						<select name="user_partnerfigur" size="1">
							<option value=""<? if(empty($_POST["user_partnerfigur"]) || $_POST["user_partnerfigur"] == "") echo " selected"; ?>>egal</option>
							<option value="2"<? if($_POST["user_partnerfigur"] == "2") echo " selected"; ?>>dünn</option>
							<option value="3"<? if($_POST["user_partnerfigur"] == "3") echo " selected"; ?>>schlank</option>
							<option value="4"<? if($_POST["user_partnerfigur"] == "4") echo " selected"; ?>>normal</option>
							<option value="5"<? if($_POST["user_partnerfigur"] == "5") echo " selected"; ?>>sportlich</option>
							<option value="6"<? if($_POST["user_partnerfigur"] == "6") echo " selected"; ?>>kräftig</option>
							<option value="7"<? if($_POST["user_partnerfigur"] == "7") echo " selected"; ?>>mollig</option>
						</select>
					</td>
				</tr>
				<tr><td colspan="4">&nbsp;</td></tr>
<!--				<tr valign="top">
					<td bgcolor="<?echo"$bgcolor1";?>"><b>Nur User mit Bild:</b></td>
					<td colspan="3" bgcolor="<?echo"$bgcolor1";?>"><input type="checkbox" name="nurBild" <? if(!empty($_POST["nurBild"])) echo "checked=\"checked\"" ?> /></td>
				</tr>-->
				<tr>
					<td bgcolor="<?echo"$bgcolor1";?>">Ergebnisse pro Seite</td>
					<td colspan="3">
						<select name="ausgabe" size="1" >
							<option value="10"<? if($_POST["ausgabe"] == "10") echo " selected"; ?>>10</option>
							<option value="20"<? if($_POST["ausgabe"] == "20" || empty($_POST["ausgabe"])) echo " selected"; ?>>20</option>
							<option value="30"<? if($_POST["ausgabe"] == "30") echo " selected"; ?>>30</option>
							<option value="40"<? if($_POST["ausgabe"] == "40") echo " selected"; ?>>40</option>
							<option value="50"<? if($_POST["ausgabe"] == "50") echo " selected"; ?>>50</option>
						</select>
					</td>
				</tr>
				<tr>
					<td colspan="4" align="right">
						<input type="hidden" name="Anfangsposition" value="<? if(!empty($_POST["Anfangsposition"])) echo $_POST["Anfangsposition"]; else echo 0; ?>" id="anfangspos" />
						<input type="submit" name="submitBTN" value="Jetzt Suchen">
					</td>
				</tr>
			</table>
		</form>
	</center>
	
<?
	CloseTable();
}

//  Funktion Suche nach Nicknamen

function search () {
	global $prefix, $bgcolor1, $bgcolor2, $bgcolor3,$sitename;
	OpenTable();
	$ausgabe = $_POST["ausgabe"];
	$ZeilenProSeite=$_POST["ausgabe"];
	$sql="SELECT uid,name,uname,user_from,user_avatar,user_sexus,user_ingroup,user_lastvisit,user_regdate,user_famstatus, (YEAR( CURRENT_DATE ) - YEAR( user_bday )) -
( RIGHT( CURRENT_DATE, 5 ) < RIGHT( user_bday, 5 ) ) AS user_age FROM ".$prefix."_users WHERE name != 'deleted (admin)' && name != 'deleted (self)'";
//" && uname LIKE '%$query%' and user_sexus LIKE '%$query1%' and name LIKE '%$query2%'"
	if(!empty($_POST["uname"])){
		$sql.=" && uname LIKE '%".trim($_POST["uname"])."%'";
	}
	if(!empty($_POST["realname"])){
		$sql.=" && name LIKE '%".trim($_POST["realname"])."%'";
	}
	if(!empty($_POST["user_from"])){
		$sql.=" && user_from LIKE '%".trim($_POST["user_from"])."%'";
	}
	if(!empty($_POST["bday_day"])){
		$SucheBday_day = trim($_POST["bday_day"]);
	}else{
		$SucheBday_day = "%";
	}
	if(!empty($_POST["bday_month"])){
		$SucheBday_month = trim($_POST["bday_month"]);
	}else{
		$SucheBday_month = "%";
	}
	if(!empty($_POST["bday_year"])){
		$SucheBday_year = trim($_POST["bday_year"]);
	}else{
		$SucheBday_year = "%";
	}
	if($SucheBday_year != "%" || $SucheBday_month != "%" || $SucheBday_day != "%"){
		$sql.=" && user_bday LIKE '".$SucheBday_year."-".$SucheBday_month."-".$SucheBday_day."'";
	}
	if(!empty($_POST["user_partneralter1"])){
		$sql.=" && (YEAR( CURRENT_DATE ) - YEAR( user_bday )) - ( RIGHT( CURRENT_DATE, 5 ) < RIGHT( user_bday, 5 ) ) > ".trim($_POST["user_partneralter1"]);
	}
	if(!empty($_POST["user_partneralter2"])){
		$sql.=" && (YEAR( CURRENT_DATE ) - YEAR( user_bday )) - ( RIGHT( CURRENT_DATE, 5 ) < RIGHT( user_bday, 5 ) ) < ".trim($_POST["user_partneralter2"]);
	}
	if(!empty($_POST["user_sexus"])){
		$sql.=" && user_sexus = '".trim($_POST["user_sexus"])."'";
	}
	if(!empty($_POST["user_famstatus"])){
		$sql.=" && user_famstatus = '".trim($_POST["user_famstatus"])."'";
	}
	if(!empty($_POST["user_kinder"])){
		$sql.=" && user_kinder = '".trim($_POST["user_kinder"])."'";
	}
	if(!empty($_POST["user_heigh1"])){
		$sql.=" && user_heigh > ".trim($_POST["user_heigh1"]);
	}
	if(!empty($_POST["user_heigh2"])){
		$sql.=" && user_heigh < ".trim($_POST["user_heigh2"]);
	}
	if(!empty($_POST["user_gewicht1"])){
		$sql.=" && user_gewicht > ".trim($_POST["user_gewicht1"]);
	}
	if(!empty($_POST["user_gewicht2"])){
		$sql.=" && user_gewicht < ".trim($_POST["user_gewicht2"]);
	}
	if(!empty($_POST["user_haar"])){
		$sql.=" && user_haar LIKE '%".trim($_POST["user_haar"])."%'";
	}
	if(!empty($_POST["user_augen"])){
		$sql.=" && user_augen LIKE '%".trim($_POST["user_augen"])."%'";
	}
	if(!empty($_POST["user_smoke"])){
		$sql.=" && user_smoke = '".trim($_POST["user_smoke"])."'";
	}
	if(!empty($_POST["user_alkohol"])){
		$sql.=" && user_alkohol = '".trim($_POST["user_alkohol"])."'";
	}
	if(!empty($_POST["user_piercing"])){
		$sql.=" && user_piercing = '".trim($_POST["user_piercing"])."'";
	}
	if(!empty($_POST["user_tatto"])){
		$sql.=" && user_tatto = '".trim($_POST["user_tatto"])."'";
	}
	if(!empty($_POST["user_l3"])){
		$sql.=" && user_l3 LIKE '%".trim($_POST["user_l3"])."%'";
	}
	if(!empty($_POST["user_sucht"])){
		$sql.=" && user_sucht = '".trim($_POST["user_sucht"])."'";
	}
	if(!empty($_POST["user_beziehung"])){
		$sql.=" && user_beziehung = '".trim($_POST["user_beziehung"])."'";
	}
	if(!empty($_POST["user_partnerfigur"]) && $_POST["user_partnerfigur"]!="egal"){
		$sql.=" && user_partnerfigur = '".trim($_POST["user_partnerfigur"])."'";
	}
if(empty($_POST["Anfangsposition"])) {
	$_POST["Anfangsposition"]=0;
}  
$result=mysql_query($sql);
$Anzahl=mysql_num_rows($result);
$sql=$sql." order by uname ASC limit ".$_POST["Anfangsposition"].",".$ZeilenProSeite;
$result=mysql_query($sql);

echo "<center><b>".$Anzahl."</b> Mitglieder gefunden - Ausgabe: <b>".$ausgabe."</b> pro Seite</b></center>";
echo "<br>"; 
echo "<table class=\"bordertop\" align=center width=\"95%\" cellspacing=\"0\" cellpadding=\"0\">";
echo "<tr>";
echo "<td class=\"borderzeile\" width=\"10%\" bgcolor=\"$bgcolor2\"><b>Foto</b></td>";
echo "<td class=\"borderzeile\" width=\"20%\" bgcolor=\"$bgcolor2\"><b>Username</b></td>";
echo "<td class=\"borderzeile\" width=\"15%\" bgcolor=\"$bgcolor2\"><b><center>Alter</center></td>";
echo "<td class=\"borderzeile\" width=\"15%\" bgcolor=\"$bgcolor2\"><b><center>m/w</center></td>";
echo "<td class=\"borderzeile\" width=\"20%\" bgcolor=\"$bgcolor2\"><b><center>Ort</b></center></td>";
echo "<td class=\"borderzeile\" width=\"20%\" bgcolor=\"$bgcolor2\"><b><center>Letzter Besuch</b></center></td>";
echo "</tr>\n";
if ($Anzahl == 0) {
	echo "<tr><td colspan=\"6\"><center><b>Keine Mitglieder gefunden!</b></center></td></tr>";
}else{
	$SucheCounter = 0;
	while(list($uid,$name,$uname,$user_from,$user_avatar,$user_sexus,$user_ingroup,$user_lastvisit,$user_regdate,$user_famstatus,$user_age)=mysql_fetch_row($result)) {
		if($_POST["nurBild"]=="on" && !SucheGetUserImage($uname)){
			continue;
		}
		$SucheCounter++;
		if($SucheCounter%2 == 0){
			$bgcol = $bgcolor1;
		}else{
			$bgcol = $bgcolor3;
		}
		$nick = $uname;
		$check = date('Y');
		$letzterbesuch = strftime("%d.%m.%Y", $user_lastvisit);
		echo "<tr>";
		echo "<td width=\"6%\" bgcolor=\"$bgcol\"><center>";
		echo SucheGetUserImage($uname);
		echo "</center></td>";
		echo "<td width=\"24%\" bgcolor=\"$bgcol\"><a href=modules.php?name=Userinfo&amp;uname=$uname><b>$uname</a></b></td>";
		if($user_age != $check && !empty($user_age)){
			echo"<td width=\"5%\" bgcolor=\"$bgcol\"><center>$user_age</center></td>";
		}else{
			echo"<td width=\"5%\" bgcolor=\"$bgcol\">&nbsp;</td>";
		}
		if ($user_sexus==1){
		echo "<td width=\"5%\" bgcolor=\"$bgcol\" align=\"center\"><img src=\"images/f.gif\" alt=\"$uname ist weiblich\"></td>";
		  }else if ($user_sexus==2){
		echo "<td width=\"5%\" bgcolor=\"$bgcol\" align=\"center\"><img src=\"images/m.gif\" alt=\"$uname ist m&auml;nnlich\"></td>";
		  }else {
		echo "<td width=\"5%\" bgcolor=\"$bgcol\">&nbsp;</td>";
		  } 
		if(!empty($user_from)){
			echo "<td width=\"25%\" bgcolor=\"$bgcol\"><center>$user_from</center></td>";
		}else{
			echo "<td width=\"25%\" bgcolor=\"$bgcol\"><center>&nbsp;</center></td>";
		}
		echo"<td width=\"20%\" bgcolor=\"$bgcol\"><center>$letzterbesuch</center></td>";
		echo "</tr>\n";
	}
}
echo "</table>";
echo "<hr size=\"1\" width=\"95%\" color=".$bgcolor2.">";
echo "<br>";
//  Bl&auml;ttern
echo "<center><a href='modules.php?name=Usersuche' ><b>Neue Suche</b></a></center>";
echo"<center><table align='center' border='0' bordercolor=".$bgcolor2." cellpadding='0' cellspacing='0' width='100%'><tr><td width='100' align='center'>";
if ($Anzahl > 0) {
    if($_POST["Anfangsposition"] > 0) {
	    echo "<a href=\"# \" onclick=\"loadPage(0); return false;\"><img src='modules/Usersuche/images/lf_button_erste.gif' border=0></a>&nbsp;";
	    $back=$_POST["Anfangsposition"]-$ZeilenProSeite;
        if($back < 0) {
	        $back=0;
        }
    	echo "<a href=\"# \" onclick=\"loadPage($back); return false;\"><img src='modules/Usersuche/images/lf_button_zurueck.gif' border=0></a>&nbsp;";
    }
echo"</td><td align='center'>";
		$Seiten=intval($Anzahl/$ZeilenProSeite);
        if($Anzahl%$ZeilenProSeite) {
        $Seiten++;
        }
        for($i=1;$i<=$Seiten;$i++) {
			$fwd=($i-1)*$ZeilenProSeite;
			if($_POST["Anfangsposition"]/$ZeilenProSeite+1==$i) {
				echo "[$i]&nbsp;";
			} else {
				echo "<a href=\"# \" onclick=\"loadPage($fwd); return false;\">[$i]</a>&nbsp;\n";
			}
			if($i%15==0) {
				echo "<br>\n";
			}
        }
    echo "</TD><td width='100' align='center'>";

    if($_POST["Anfangsposition"] < $Anzahl-$ZeilenProSeite) {
		$neueAnfangsposition=$_POST["Anfangsposition"]+$ZeilenProSeite;
		echo "<a href=\"# \" onclick=\"loadPage($neueAnfangsposition); return false;\"><img src='modules/Usersuche/images/lf_button_weiter.gif' border=0></a>&nbsp;";
		echo "<a href=\"# \" onclick=\"loadPage($fwd); return false;\"><img src='modules/Usersuche/images/lf_button_letzte.gif' border=0></a>";
    }
 }
echo "</TD></TR></TABLE></center>";
echo "</body>";
echo "</html>";
  CloseTable(); 
	}
function SucheGetDoubleNumber($num){
	if($num<10){
		return "0".$num;
	}else {
		return $num;
	}
}
function SucheGetUserImage($uname){
		//~ $fotodir = 'images/forum/member_avatar';
		//~ $fotos = opendir($fotodir);
		//~ while ($fotofile = readdir($fotos)){
			//~ if ((substr($fotofile, 0, strpos($fotofile, ".")) == $uname) && (substr($fotofile, (strlen($uname)+1), 4) == "foto")){
				//~ if (preg_match('#(.*)([0-9])(\.gif|\.jpe?g)$#i', $fotofile, $fotomatches)) {
					//~ $SucheFileName = $fotodir."/".$fotofile;
					//~ if(is_file($SucheFileName)){
						//~ $SucheFileDimensions = getimagesize($SucheFileName);
						//~ if($SucheFileDimensions[0]>$SucheFileDimensions[1]){
							//~ $aimwidth = 100;
							//~ $aimheight = 100/$SucheFileDimensions[0]*$SucheFileDimensions[1];
						//~ }else if($SucheFileDimensions[0]<$SucheFileDimensions[1]){
							//~ $aimwidth = 100/$SucheFileDimensions[1]*$SucheFileDimensions[0];
							//~ $aimheight = 100;
						//~ }else {
							//~ $aimwidth = 100;
							//~ $aimheight = 100;
						//~ }
						//~ closedir($fotos->handle);
						//~ return "<img src=\"".$SucheFileName."\" border=0 width=\"".round($aimwidth)."\" height=\"".round($aimheight)."\" vspace=\"5\" hspace=\"5\">\n";
					//~ }
				//~ }
			//~ }
		//~ }
		//~ closedir($fotos->handle);
     
##############Foto###############################################################
global $user_prefix;
$pic = mysql_fetch_array(sql_query("SELECT typ,werist FROM ${user_prefix}_avatar WHERE aid='$uname'"));

$picpath = MX_PATH_MEMBERAVATAR;

if(!empty($pic['werist'])){
   $avatar = $pic["werist"];
   return "<a href=modules.php?name=Userinfo&amp;uname=$uname><img src=\"".$picpath."/".$avatar."\" width=\"25px\" height=\"15px\"></a>";
   }
else{
   return false;
   }

	#################################################################################
}
?>