<?php
//v1.0.4 www.bcoos.net 2006/10 GPL
// www.bcoos.net 2006-09 1.0.2 GPL
//v3.1 www.exoops.info 2006/03
##################################################################################
# Friend Finder for e-xoops  Version 3.02 beta                                 #
#                                                                                #
# Script design  : PhpMeet  :   Copyright 2002 Jeremy Ross-webmaster@phprank.com #
# Created 15/01/02              Last Modified 15/01/02                           #
# Scripts Home              :   http://www.jrscripts.com                         #
#                                                                                #
# Xoops-RC2 French Version  :   jokerman@free.fr                                 #
# Web Home                     :   http://www.webetfric.com                      #
#                                                                                #
# Xoops-RC2 English Version :          Neon@neon.qldgamers.com                   #
# Web Home                  :   http://neon.qldgamers.com                        #
#                                                                                #
#                 Redesigned and new improvemends by                             #
#        eagle81 Manuel Caballero       Manuel@dancepartner.net                  #
#                    http://www.dancepartner.net                                 #
#                             2002-09-12                                         #
##################################################################################
// ORIGINAL FILE INFO

 global $db, $xoopsTheme, $bcoosConfig, $xoopsModule, $myts,$_GET,$_POST;
include_once("../../mainfile.php");
include_once(XOOPS_ROOT_PATH."/header.php");
include_once(XOOPS_ROOT_PATH."/modules/friendfinder/header.php");
include_once(XOOPS_ROOT_PATH."/modules/friendfinder/age.php");
 //=& MyTextSanitizer::getInstance();
$xoopsOption['show_rblock'] =1;


        OpenTable();
//************************************************************

$page = $_GET['page'];
$search = $_POST['search'];

if ($page == search) {

if ($search == search) {

/************************/
$g="SUBSTRING(birth,7)";
$m="SUBSTRING(birth,4,2)";
$d="LEFT(birth,2)";
$dat="CONCAT($g,'.',$m,'.',$d)";
/************************/




$sql = "SELECT id,user, city, state, birth, title FROM ".$db->prefix("friendfinder")."
 inner join ".$db->prefix("friendfinder_state")."
 on state = cid
 WHERE (DATE_FORMAT(FROM_DAYS(TO_DAYS(NOW())-TO_DAYS($dat)), '%Y')+0) BETWEEN $agefrom AND $agetill AND partner='$sex' AND sex='$partner' AND state='$state' AND active='1' AND category='$category' ORDER BY '$sort'";

} else {
echo ""._TEXTSEARCHUNSUCCESSFUL."";
}

echo "<table border=0 cellpadding=5 cellspacing=0 align=center width=550><tr><td><font face=arial size=2>"._UNAME."</td><br><td><font face=arial size=2>"._TEXTREGION."</td><td><font face=arial size=2>"._CITY."</td><td><font face=arial size=2>"._TEXTAGE."</td></tr>";
$result = $db->query($sql);
        while (list($id,$user,$city,$state,$birth,$title ) = $db->fetchRow($result))
{
 echo "<tr><td><font face=arial size=2><a href=view.php?id=".$myts->makeTboxData4Show($id).">".$myts->makeTboxData4Show($user)."</a></td><br><td><font face=arial size=2>".$myts->makeTboxData4Show($title)."</td><td><font face=arial size=2>".$myts->makeTboxData4Show($city)."</td><td><font face=arial size=2>".getage($birth)."</td></tr>";
}


echo "</table>";

//echo "No Results found";

} else {

echo"
<form action=search.php?page=search method=post>
 <table border=0 cellpadding=5 cellspacing=0 align=center width=550>
    <tr>
    <TD WIDTH=150>"._TEXTSEX."</td>
    <TD WIDTH=450>";

             list($numrows) = $db->fetchRow($db->query("select sid, sextitle from ".$db->prefix("friendfinder_sex").""));

             if ($numrows>0) {
	         $result = $db->query("select sid, sextitle from ".$db->prefix("friendfinder_sex")." order by sextitle");
	         echo "<select class=\"select\" name=\"sex\"><option value=\"0\">"._CLA_SELECTCAT."</option>";
	         while(list($sid, $sextitle) = $db->fetchRow($result)) {
	         echo "<option value=".$sid.">$sextitle</option>";
             }
             }

             echo"</td>
    </tr>
    <tr>
    <TD WIDTH=150>"._TEXTPSEX."</td>
    <TD WIDTH=450>";

             list($numrows) = $db->fetchRow($db->query("select sid, sextitle from ".$db->prefix("friendfinder_sex").""));

             if ($numrows>0) {
	         $result = $db->query("select sid, sextitle from ".$db->prefix("friendfinder_sex")." order by sextitle");
	         echo "<select class=\"select\" name=\"partner\"><option value=\"0\">"._CLA_SELECTCAT."</option>";
	         while(list($sid, $sextitle) = $db->fetchRow($result)) {
	         echo "<option value=".$sid.">$sextitle</option>";
             }
             }

             echo"</td>
    </tr>
     <tr>
    <TD WIDTH=150>"._TEXTAGE."</td>
    <TD WIDTH=450>"._AGEFROM."<input type=text class='text' name=agefrom size=4 value=>
    "._AGETILL."<input type=text class='text' name=agetill size=4 value=></td>
    </tr>
    <tr>
    <TD WIDTH=150>"._CATEGORY.':'."</td>
    <TD WIDTH=450>";

             list($numrows) = $db->fetchRow($db->query("select catid, cattitle from ".$db->prefix("friendfinder_category").""));

             if ($numrows>0) {
	         $result = $db->query("select catid, cattitle from ".$db->prefix("friendfinder_category")." order by cattitle");
	         echo "<select class=\"select\" name=\"category\"><option value=\"0\">"._CLA_SELECTCAT."</option>";
	         while(list($catid, $cattitle) = $db->fetchRow($result)) {
	         echo "<option value=".$catid.">$cattitle</option>";
             }
             }

             echo"</td>
    </tr>
    <tr>
    <TD WIDTH=150>"._TEXTREGION."</td>
    <TD WIDTH=450>  ";

     list($numrows) = $db->fetchRow($db->query("select cid, title from ".$db->prefix("friendfinder_state").""));
     if ($numrows>0) {
     $result = $db->query("select cid, title from ".$db->prefix("friendfinder_state")." order by title");
	 echo"<select class=\"select\" name=\"state\"><option value=\"0\">"._CLA_SELECTCAT."</option>";
	 while(list($cid, $title) = $db->fetchRow($result)) {
	 echo "<option value=".$cid.">$title</option>";
        }
    }
	
    echo"</td>
    </tr>
    <tr>
    <TD WIDTH=150>"._TEXTSEARCHSORT."</td>
    <input name=search type=hidden value=search>
    <TD WIDTH=450>"._SELECTSORT."</td>
    </tr>
    <tr>
    <td><br><input type=\"submit\" class=\"button\"  value=\""._TEXTSEARCHBUTTON."\">
   </tr>
  </table>
</form>";
}
//include "admin/foot.php";

//************************************************************
        CloseTable();
include_once("../../footer.php");
?>
