<?php
include('db.inc.php');
include('header.inc.php');
include_once('pl_sort.inc.php');
define('NEXTVAL', '10');	// hany darab legyen egy oldalon
?>
<table border="0" cellpadding="10" cellspacing="10" width="100%">
                            <tr>
                                <td width="100%">
                                <p class="vezercikkcim">Kulcsszavas keresés a szaknévsorban</p>
<?php
if(isset($round)){

	if ($_POST["other"]) $other=addslashes($_POST["other"]);
	if ($_GET["other"]) $other=addslashes($_GET["other"]);

	$mydb = new db();

	$stmt="SELECT * FROM kk_tag WHERE jovahagyva='1' AND (nev LIKE '%$other%' OR referenciak LIKE '%$other%' OR szolgaltatas LIKE '%$other%' OR specialitas LIKE '%$other%' OR irsz LIKE '%$other%' OR telepules LIKE '%$other%' OR utca LIKE '%$other%' OR telefon LIKE '%$other%' OR fax LIKE '%$other%' OR web LIKE '%$other%' OR email LIKE '%$other%') ORDER BY nev ASC";

	$result=$mydb->query($stmt);
	$rows=pl_sort($result);
	$new_rows=$rows;
        // oldalakra tores
        $chunk_rows = array_chunk($new_rows, NEXTVAL);

        if (!isset($page)) {
             $page = 0;
            }
        $rows = $chunk_rows[$page];


	$feltetel="";

	if($other==""){
		$feltetel.="Kulcsszó: bármi";
	}else{
		$feltetel.="Kulcsszó: " . $other;
	}

	printf("<H5>%s</H5>%s<BR>", "A KERESÉS EREDMÉNYE", $feltetel);

	$darab=mysql_num_rows($result);

	if($darab==0){
		printf("A keresés nem hozott eredményt.");
	} else {
		printf("Találatok száma: %s", $darab);
		printf("
		<TABLE CELLSPACING='10'>
		<TR>");
		printf("<td><B>Cégnév</B></td>\n");
		printf("<td><B>Adatlap megtekintése</B></td></TR>\n");

/*		while($row = mysql_fetch_object($result)){

			printf("<TR><TD valign='top'>%s</TD><TD valign='top' align='center'><A HREF=\"/szaknevsor/%s\">Részletek &raquo;</a></TD></TR>", $row->nev, $row->url);
		}
		*/
		
		foreach ($rows as $key => $value){
            if ($value[3] == 1) {
    			printf("<TR><TD valign='top'>%s</TD><TD valign='top' align='center'><a href=/szaknevsor/%s><strong>Részletek &raquo;</strong></a></TD></TR>", $value[0], $value[4]);
            } else {
    			printf("<TR><TD valign='top'>%s</TD><TD valign='top' align='center'><a href=/szaknevsor/%s><strong>Részletek &raquo;</strong></a>", $value[0], $value[4]);
                }
    		}
		
		printf("</TABLE><BR>");
        $jni = "Oldalak:<BR/>";
        if ($page>0) {
            $jni .= sprintf("<A HREF=\"%s?c=%s&filter=%s&other=%s&round=1&abc=%s&page=%s\">&laquo;</A> | ", $PHP_SELF, $c, $filter, $other, $abc, $page-1);
            }

        for ($j=0;$j<sizeof($chunk_rows);$j++){
            if ($page == $j) {
                $jni .= sprintf("%s | ", $j+1);
            } else {
                $jni .= sprintf("<A HREF=\"%s?c=%s&filter=%s&other=%s&round=1&abc=%s&page=%s\">%s</A> | ", $PHP_SELF, $c, $filter, $other, $abc, $j, $j+1);
                }
            }

        if ($page<sizeof($chunk_rows)-1) {
            $jni .= sprintf("<A HREF=\"%s?c=%s&filter=%s&other=%s&round=1&abc=%s&page=%s\">&raquo;</A> | ", $PHP_SELF, $c, $filter, $other, $abc, $page+1);
            }
     
    	printf(substr($jni, 0, strlen($jni)-2));
	}

} else {
/*
	printf("
	<H5>%s</H5>
	<TABLE style='font-size: 11px; font-family: Tahoma' STYLE='background: #FFFFFF;'>", "KERESÉS");

	printf("
	<FORM ACTION=\"$PHP_SELF\" METHOD=\"POST\">
	<TR><TH style='font-size: 11px; font-family: Tahoma' align=\"left\"><B>Kulcsszavak</B></TH><TD><INPUT TYPE=\"text\" NAME=\"other\" SIZE=\"40\"></TD></TR>
	<TR><TH align=\"left\">&nbsp;</TH><TD><INPUT TYPE=\"hidden\" NAME=\"round\" VALUE=\"1\">
	<INPUT TYPE=\"submit\" VALUE=\"Mehet\"></TD></TR>
	</FORM>
	</TABLE>
	");
*/

}

//include('lezar.inc.php');
//include('edenkert.inc.php');?>
 </td>
              </tr>
			  <tr><td align="center">
			 <!--/* OpenX Javascript Tag v2.6.2 */-->

<script type='text/javascript'><!--//<![CDATA[
   var m3_u = (location.protocol=='https:'?'https://ads.easy-media.hu/delivery/ajs.php':'http://ads.easy-media.hu/delivery/ajs.php');
   var m3_r = Math.floor(Math.random()*99999999999);
   if (!document.MAX_used) document.MAX_used = ',';
   document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u);
   document.write ("?zoneid=11");
   document.write ('&amp;cb=' + m3_r);
   if (document.MAX_used != ',') document.write ("&amp;exclude=" + document.MAX_used);
   document.write (document.charset ? '&amp;charset='+document.charset : (document.characterSet ? '&amp;charset='+document.characterSet : ''));
   document.write ("&amp;loc=" + escape(window.location));
   if (document.referrer) document.write ("&amp;referer=" + escape(document.referrer));
   if (document.context) document.write ("&context=" + escape(document.context));
   if (document.mmm_fo) document.write ("&amp;mmm_fo=1");
   document.write ("'><\/scr"+"ipt>");
//]]>--></script><noscript><a href='http://ads.easy-media.hu/delivery/ck.php?n=a6aed90c&amp;cb=INSERT_RANDOM_NUMBER_HERE' target='_blank'><img src='http://ads.easy-media.hu/delivery/avw.php?zoneid=11&amp;n=a6aed90c' border='0' alt='' /></a></noscript>

			  </td></tr>
            </table>

<?php
include('footer.inc.php');
?>
