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

Размер файла: 4.17Kb
<?php
include "config.php";
header ("Content-type:text/vnd.wap.wml; charset=utf-8");

print"<?xml version=\"1.0\" encoding=\"utf-8\"?>
<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\" \"http://www.wapforum.org/DTD/wml_1.1.xml\">
<wml><head><meta http-equiv=\"Cache-Control\" content=\"no-cache\" forua=\"true\"/></head>
<card id=\"сatalog\" title=\"Поиск в каталоге\">
<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>[Искать]
<go href=\"search.php\" 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\">Ввести!</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=\"from.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\">[".($i+1)."]</a>";}else{
print "[".($i+1)."]";}}
print "</small>";
if($total_mat_number==0){print "<small>Ничего не найдено!</small><br/>";}}

print"<br/><small><a href=\"./\">Каталог</a><br/>-----<br/>
<a href=\"http://www.erokat.net/in/?id=15\"><img src=\"http://banners.su/banner.php?id=16029\" alt=\"banners\"/></a>
</small>
</p></card></wml>";
?>