Просмотр файла nkat/search.php

Размер файла: 8.66Kb
<?php
$version=$HTTP_GET_VARS['version'];
include "xconf.php";
header("Cache-Control: no-cache");
///////////////////////
include "fo.php";
$version=trim($version);

if ($version=="xhtml"){

$version=xhtml;
include "xhtml_head.php";

$div_s="<div class=\"a\">";
$div_ss="<div class=\"b\">";
$div_e="</div>";

if(!isset($s)){
print "$div_ss
<p align=\"left\">&#x041F;o&#x0438;c&#x043A; &#x041F;o Ka&#x0442;a&#x043B;o&#x0433;y";
print" 
$div_e $div_s
<form action=\"search.php?version=xhtml\" method=\"post\">
&#x0413;&#x0434;e &#x0438;c&#x043A;a&#x0442;&#x044C;:<select name=\"s\">
<option value=\"1\">B &#x043D;a&#x0437;&#x0432;a&#x043D;&#x0438;&#x0438;</option>
<option value=\"2\">B o&#x043F;&#x0438;ca&#x043D;&#x0438;&#x0438;</option>
<option value=\"3\">B url</option>
</select><br/>
 Te&#x043A;c&#x0442;: <input type=\"text\" name=\"text\" maxlength=\"1000\"/>
<postfield name=\"s\" value=\"$(s)\"/>
<postfield name=\"text\" value=\"$(text)\"/>
<input type=\"hidden\" name=\"seenform\" value=\"add\"> <br/><br/>
<input type=\"submit\" value=\"&#x0418;c&#x043A;a&#x0442;&#x044C;\">
</form>
$div_e
";

}

elseif(empty($s)||empty($text)){print"$div_s<small>He &#x0432;&#x0432;e&#x0434;e&#x043D; &#x0442;e&#x043A;c&#x0442; &#x043F;o&#x0438;c&#x043A;a! <a href=\"search.php?version=$version\">B&#x0432;ec&#x0442;&#x0438;!</a></small><br/>$div_e";}
else{
$s=intval($s);
$text=coding_cool(substr(trim($text), 0, 1000));
if(empty($page)){$page=0;}
if($s==1){
if($active_site==1){
$q=mysql_query("select id from `cool_site` where (locate(lower('$text'),lower(title))>0  and activ='1' and counter>'0');");}else{
$q=mysql_query("select id from `cool_site` where (locate(lower('$text'),lower(title))>0  and activ='1');");}}
elseif($s==2){
if($active_site==1){
$q=mysql_query("select id from `cool_site` where (locate(lower('$text'),lower(about))>0  and activ='1' and counter>'0');");}else{
$q=mysql_query("select id from `cool_site` where (locate(lower('$text'),lower(about))>0  and activ='1');");}}
else{
if($active_site==1){
$q=mysql_query("select id from `cool_site` where (locate(lower('$text'),lower(link))>0  and activ='1' and counter>'0');");}else{
$q=mysql_query("select id from `cool_site` where (locate(lower('$text'),lower(link))>0  and activ='1');");}}
$num_of_rows=mysql_num_rows($q);
$total_mat_number=$num_of_rows;
$total_pages=ceil($total_mat_number/$mat_per_page);
if($s==1){
if($active_site==1){
$prints = mysql_query("select * from `cool_site` where (locate(lower('$text'),lower(title))>0  and activ='1' and counter>'0') order by counter desc limit ".$page.",".($page+$mat_per_page).";");}else{
$prints = mysql_query("select * from `cool_site` where (locate(lower('$text'),lower(title))>0  and activ='1') order by counter desc limit ".$page.",".($page+$mat_per_page).";");}}
elseif($s==2){
if($active_site==1){
$prints = mysql_query("select * from `cool_site` where (locate(lower('$text'),lower(about))>0  and activ='1' and counter>'0') order by counter desc limit ".$page.",".($page+$mat_per_page).";");}else{
$prints = mysql_query("select * from `cool_site` where (locate(lower('$text'),lower(about))>0  and activ='1') order by counter desc limit ".$page.",".($page+$mat_per_page).";");}}
else{
if($active_site==1){
$prints = mysql_query("select * from `cool_site` where (locate(lower('$text'),lower(link))>0  and activ='1' and counter>'0') order by counter desc limit ".$page.",".($page+$mat_per_page).";");}else{
$prints = mysql_query("select * from `cool_site` where (locate(lower('$text'),lower(link))>0  and activ='1') order by counter desc limit ".$page.",".($page+$mat_per_page).";");}}
while($data=mysql_fetch_array($prints)){
print "$div_s<small><b>".$data['title']."</b><br/>";
print $data['about']."<br/>";
print "<small><u>&#x0418;&#x0437; &#x043A;a&#x0442;a&#x043B;o&#x0433;a:</u> ".$data['outcounter']."<br/>";
print "<u>B &#x043A;a&#x0442;a&#x043B;o&#x0433;:</u> ".$data['counter']."</small><br/>";
print "<a href=\"out.php?go=".$data['link']."\">".$data['link']."</a></small><br/><br/>$div_e";}
print "<small>";
for ($i=0; $i<$total_pages; $i++){
$page_number=$i*$mat_per_page;
if($page_number!=$page){print "<a href=\"search.php?s=$s&amp;text=$text&apm;version=$version\">[".($i+1)."]</a>";}else{
print "[".($i+1)."]";}}
print "</small>";
if($total_mat_number==0){print "$div_s<small>&#x041F;o &#x0432;a&#x0448;e&#x043C;y &#x0437;a&#x043F;pocy &#x043D;&#x0438;&#x0447;e&#x0433;o &#x043D;e &#x043D;a&#x0439;&#x0434;e&#x043D;o!</small><br/>$div_e";}}

print"$div_ss<br/>*****<br/><a href=\"./?version=$version\">B Ka&#x0442;a&#x043B;o&#x0433;</a><br/>*****<br/>


</p>
$div_e";
}
else {
$version=wml;
include "wml_head.php";
print "<p align=\"left\">";

if(!isset($s)){
print"<small>Где искать:</small> <select name=\"s\">
<option value=\"1\">В названии</option>
<option value=\"2\">В описании</option>
<option value=\"3\">В url</option>
</select><br/>
<small>Текст:</small> <input type=\"text\" name=\"text\" maxlength=\"1000\"/><br/>
<small><anchor>&#x0418;c&#x043A;a&#x0442;&#x044C; &#187;
<go href=\"search.php?version=$version\" method=\"post\">
<postfield name=\"s\" value=\"$(s)\"/>
<postfield name=\"text\" value=\"$(text)\"/>
</go></anchor></small><br/>";}

elseif(empty($s)||empty($text)){print"<small>Не введен текст поиска! <a href=\"search.php?version=$version\">Ввести!</a></small><br/>";}
else{
$s=intval($s);
$text=coding_cool(substr(trim($text), 0, 1000));
if(empty($page)){$page=0;}
if($s==1){
if($active_site==1){
$q=mysql_query("select id from `cool_site` where (locate(lower('$text'),lower(title))>0  and activ='1' and counter>'0');");}else{
$q=mysql_query("select id from `cool_site` where (locate(lower('$text'),lower(title))>0  and activ='1');");}}
elseif($s==2){
if($active_site==1){
$q=mysql_query("select id from `cool_site` where (locate(lower('$text'),lower(about))>0  and activ='1' and counter>'0');");}else{
$q=mysql_query("select id from `cool_site` where (locate(lower('$text'),lower(about))>0  and activ='1');");}}
else{
if($active_site==1){
$q=mysql_query("select id from `cool_site` where (locate(lower('$text'),lower(link))>0  and activ='1' and counter>'0');");}else{
$q=mysql_query("select id from `cool_site` where (locate(lower('$text'),lower(link))>0  and activ='1');");}}
$num_of_rows=mysql_num_rows($q);
$total_mat_number=$num_of_rows;
$total_pages=ceil($total_mat_number/$mat_per_page);
if($s==1){
if($active_site==1){
$prints = mysql_query("select * from `cool_site` where (locate(lower('$text'),lower(title))>0  and activ='1' and counter>'0') order by counter desc limit ".$page.",".($page+$mat_per_page).";");}else{
$prints = mysql_query("select * from `cool_site` where (locate(lower('$text'),lower(title))>0  and activ='1') order by counter desc limit ".$page.",".($page+$mat_per_page).";");}}
elseif($s==2){
if($active_site==1){
$prints = mysql_query("select * from `cool_site` where (locate(lower('$text'),lower(about))>0  and activ='1' and counter>'0') order by counter desc limit ".$page.",".($page+$mat_per_page).";");}else{
$prints = mysql_query("select * from `cool_site` where (locate(lower('$text'),lower(about))>0  and activ='1') order by counter desc limit ".$page.",".($page+$mat_per_page).";");}}
else{
if($active_site==1){
$prints = mysql_query("select * from `cool_site` where (locate(lower('$text'),lower(link))>0  and activ='1' and counter>'0') order by counter desc limit ".$page.",".($page+$mat_per_page).";");}else{
$prints = mysql_query("select * from `cool_site` where (locate(lower('$text'),lower(link))>0  and activ='1') order by counter desc limit ".$page.",".($page+$mat_per_page).";");}}
while($data=mysql_fetch_array($prints)){
print "<small><b>".$data['title']."</b><br/>";
print $data['about']."<br/>";
print "<small><u>Из каталога:</u> ".$data['outcounter']."<br/>";
print "<u>В каталог:</u> ".$data['counter']."</small><br/>";
print "<a href=\"out.php?go=".$data['link']."\">".$data['link']."</a></small><br/><br/>";}
print "<small>";
for ($i=0; $i<$total_pages; $i++){
$page_number=$i*$mat_per_page;
if($page_number!=$page){print "<a href=\"search.php?s=$s&amp;text=$text&amp;version=$version\">[".($i+1)."]</a>";}else{
print "[".($i+1)."]";}}
print "</small>";
if($total_mat_number==0){print "<small>&#x041F;o &#x0432;a&#x0448;e&#x043C;y &#x0437;a&#x043F;pocy &#x043D;&#x0438;&#x0447;e&#x0433;o &#x043D;e &#x043D;a&#x0439;&#x0434;e&#x043D;o!</small><br/>";}}

print"<br/><small>*****<br/><a href=\"./?version=$version\">B Ka&#x0442;a&#x043B;o&#x0433;</a><br/>*****<br/>

</small>
</p>
";}





if ($version=="xhtml"){
include "xhtml3_down.php";
$version=xhtml;

}
else {
include "wml3_down.php";
}
?>