View file search.php

File size: 3.79Kb
<?php
 

Error_Reporting(E_ALL & ~E_NOTICE);

Error_Reporting (ERROR | WARNING);

extract($HTTP_GET_VARS);

extract($HTTP_POST_VARS);

extract($HTTP_COOKIE_VARS);

extract($HTTP_SERVER_VARS);

extract($HTTP_SESSION_VARS);

session_name("SESID"); 

session_start();

include "start.php";

include "cfg.php"; 

header("Content-type:text/html;charset=utf-8"); include "head.php"; 

if($act==""){echo"<div class=\"b\">"; 

?>

<form name="form" action="search.php?act=search" method="post">Что ищем?<br/><input name="text" type="text" maxlength="50"/><br/><input type="checkbox" name="tr_text" value="1">Транслит<br/><input type="submit" value=" Найти "></form></div>

<?

echo"<div class=\"b\">$srd<br/>$ss<a href=\"search.php?act=trans\">Таблица транслита</a><br/>$srd<br/>$ss<a href=\"index.php\">В рейтинг</a></div>";}





if($act=="search"){mysql_connect ($DB_HOST, $DB_USER, $DB_PASS);mysql_select_db($DB_NAME);

$text=strtolower($text);if($tr_text==1){include_once "trans.php"; $text=eng_to_rus($text);}$text=substr(trim($text), 0, 50);

$arr=mysql_query("select * from `users` where (locate(lower('$text'),lower(about))>0  and counthost>'0') order by counthost desc;");

$i=mysql_num_rows($arr);



if($i>0)

 {

echo"Совпадений: $i<br/>$srd<br/>";

while ($data=@mysql_fetch_array($arr))

{

if($cid==$data['id']) $start=count($ids);

$titles[] = $data['title'];

$ids[] = $data['id'];

$abouts[] = $data['about'];

$arrr=mysql_query("select id from users where 1;");

$ir=mysql_num_rows($arrr);

$asr=mysql_query("select id from users where counthost>=1;"); 

$asir=mysql_num_rows($asr);}

echo"<div class=\"b\">"; 

$count=$i;

$count1=$count;

if(empty($start)) 

$start=0;

$start=intval($start);

if($start<0)

$start=0;


if($count>$start+$url_page) $count=$start+$url_page;

for($i=$start;$i<$count;$i++){

$n=$i+1;

if($url_page%$i!=0||$i==1) $br="<br/>";


$text2=str_replace(" ","|",$text); 

$abouts[$i]=strtolower($abouts[$i]);

$abouts[$i] = ereg_replace($text2,"<font color=#A50000><b>\\0</b></font>",$abouts[$i]);



echo"<b>$n</b> <a href=\"out.php?id=$ids[$i]\">$titles[$i]</a><br/>";

echo"$abouts[$i]<br/><br/>";

   }
 
 
if($start!=0){echo"<a href=\"search.php?act=search&text=$text&start=".($start-$url_page)."\">Пред.</a>";}


if($start!=0 && $count1>$start+$url_page) {echo" | ";}

if($count1>$start+$url_page){echo"<a href=\"search.php?act=search&text=$text&start=".($start+$url_page)."\">След.</a>";}

?>

<hr/><form name="form" action="search.php?act=search" method="post"><input name="text" type="text" maxlength="50" value=""/><br/><input type="checkbox" name="tr_text" value="1">Транслит<br/><input type="submit" value="Поиск"></form></div>

<?

echo"<div class=\"b\">$srd<br/>$ss<a href=\"index.php\">В рейтинг</a></div>";}

if($i==0){echo"<div class=\"b\">По вашему запросу <b>$text</b>, ничего не найдено!<br/>$ss<a href=\"search.php\">Вернуться</a></div>";}

mysql_close(); 

 }


if($act=="trans"){echo"<div class=\"b\">Таблица транслита<br/>$srd<br/><b>Буквы:</b><br/>A(a) = A(а)<br/>B(b) = Б(б)<br/>V(v) = В(в)<br/>G(g) = Г(г)<br/>D(d) = Д(д)<br/>E(e) = Е(е)<br/>Yo,YO(yo) = Ё(ё)<br/>Zh,ZH(zh) = Ж(ж)<br/>Z(z) = З(з)<br/>I(i) = И(и)<br/>J(j) = Й(й)<br/>K(k) = К(к)<br/>L(l) = Л(л)<br/>M(m) = М(м)<br/>N(n) = Н(н)<br/>O(o) = О(о)<br/>P(p) = П(п)<br/>R(r) = Р(р)<br/>S(s) = С(с)<br/>T(t) = Т(т)<br/>U(u) = У(у)<br/>F(f) = Ф(ф)<br/>H(h) = Х(х)<br/>C(c) = Ц(ц)<br/>Ch,CH(ch) = Ч(ч)<br/>Sh,SH(sh) = Ш(ш)<br/>W(w) = Щ(щ)<br/>Q(q) = Ь(ь)<br/>Y(y) = Ы(ы)<br/>Yu,YU(yu) = Ю(ю)<br/>Ya,YA(ya) = Я(я)<br/><b>Символы:</b><br/>\"_\" = \" \" (пробел)<br/>$srd<br/><a href=\"search.php\">Назад</a><br/></div>";}

include "foot.php";

?>