(round($pagesindexed/10,0,PHP_ROUND_HALF_DOWN)+1) or $pp<0){
echo "".$pp." ";
// $send="Line ".__LINE__." Possible DoS attack. ?pp=".$pp." from ".$_SERVER['HTTP_USER_AGENT'];
// send_group("TidyWeb","system@lobby.mpaq.org",$send,"mpaq.org");
header("Refresh:0; url=/bot_trap/?pp=".$pp);
exit;
}
}else{$pp=1;}
if (isset($_GET['qq'])){
$quary=$qq=trim($_GET['qq']);
$quary=trim(htmlentities($quary,ENT_QUOTES|ENT_HTML5,'UTF-8',true));
}
$pages=paging('/',$pp,$pagesindexed,$qq,$offset);
$sql="SELECT * FROM tidysearch.sites WHERE sites.hits>0;";
$ret=pg_query($con,$sql);
while($row=pg_fetch_array($ret)){
if (isset($row['hits'])){
$THits=$THits+$row['hits'];
}
}
$Websites=pg_num_rows(pg_query($con,$sql));
$SITE="TidySearch";
$keywords="Fediverse, Decentralized, Federated, Search, Engine, MPAQ, ".$SITE."";
$desc="Decentralized Search Engine by MPAQ like the Fediverse AKA ActivityPub AKA Mastodon and XMPP. ".$SITE." has indexed ".$Websites." websites.";
$site_addy="http://search.mpaq.org";
$title=$SITE." Indexed Websites: ".$Websites;
unset($sql,$res);
$found=0;
echo "
".$SITE."
";
?>
";
$found++;
}else{$data['share']=NULL;}
if ($_SERVER['SERVER_NAME']==="192.168.4.250" or $_SERVER['SERVER_NAME']==="localhost"){
if (!is_null($data['lan_code'])){
$Mcon=pg_connect("host=".$dbro['host']." dbname=movie_system user=".$dbro['user']." password=".$dbro['passw']);
$tmp=trim(str_ireplace('a/','',$data['lan_code']));
$aa="SELECT * FROM movie_system.active WHERE active.yts=".$tmp;
$ab=pg_fetch_array(pg_query($Mcon,$aa));
if (isset($ab['yts'])){
$data['Star']="
";
}else{
$data['Star']="
";
}
}
}
display($data);unset($tmp1,$tmp2,$data);
memory_get_usage();
}
}else{
$LINE=0;
if (isset($pp)){$offset=$pp*10;}else{$offset=0;}
$sql="select * from tidysearch.pages where kwords ilike '% ".$quary." %' ORDER BY pages.date DESC, pages.idex DESC LIMIT 10 OFFSET ".$offset.";";
$test=pg_fetch_array(pg_query($con,$sql));
if ($test==false){
$sql="select * from tidysearch.pages where kwords ilike '%".$quary." %' ORDER BY pages.date DESC, pages.idex DESC LIMIT 10 OFFSET ".$offset.";";
$test=pg_fetch_array(pg_query($con,$sql));
$LINE=__LINE__;
}
if ($test==false){
$sql="select * from tidysearch.pages where kwords ilike '% ".$quary."%' ORDER BY pages.date DESC, pages.idex DESC LIMIT 10 OFFSET ".$offset.";";
$test=pg_fetch_array(pg_query($con,$sql));
$LINE=__LINE__;
}
if ($test==false){
$sql="select * from tidysearch.pages where kwords ilike '%".$quary."%' ORDER BY pages.date DESC, pages.idex DESC LIMIT 10 OFFSET ".$offset.";";
$test=pg_fetch_array(pg_query($con,$sql));
$LINE=__LINE__;
}
if ($test==false){
$sql="select * from tidysearch.pages where title ilike '%".$quary."%' ORDER BY pages.date DESC, pages.idex DESC LIMIT 10 OFFSET ".$offset.";";
$test=pg_fetch_array(pg_query($con,$sql));
$LINE=__LINE__;
}
if ($test==false){
$sql="select * from tidysearch.pages where description ilike '%".$quary."%' ORDER BY pages.date DESC, pages.idex DESC LIMIT 10 OFFSET ".$offset.";";
$test=pg_query($con,$sql);
$test=pg_fetch_array(pg_query($con,$sql));
$LINE=__LINE__;
}
if ($test==true){
//echo "Line: ".$LINE." ".$sql."
";
$ret=pg_query($con,$sql);
}else{
echo "
Nothing found
";exit;
}
while($row=pg_fetch_array($ret)){
$data=(array) null;
$data['Star']=NULL;
$data['PageID']=$row['idex'];
$data['KWords']=$row['kwords'];
$data['SiteID']=$row['site_id'];
$data['date']=$row['date'];
$data['title']=$row['title'];
$data['description']=$row['description'];
$data['link']=$row['source_code'];
$data['BotID']=$row['botid'];
$data['lan_code']=$row['lan_code'];
$data['HostID']=$row['hostid'];
$aa="SELECT * FROM ".$dbro['database'].".sites WHERE sites.index=".$data['SiteID'].";";
$ab=pg_fetch_array(pg_query($con,$aa));
$data['SiteName']=$ab['name'];
$data['lang']=lang($ab['_lang']);
$tmp1=html_entity_decode($data['title'],ENT_QUOTES|ENT_HTML5,'UTF-8')."\n";
$tmp1=trim(str_ireplace(' ','%20',$tmp1));
$tmp1=str_ireplace('\'',''',$tmp1);
$tmp2=substr($data['description'],0,500)."...";
$tmp2=html_entity_decode($tmp2,ENT_QUOTES|ENT_HTML5,'UTF-8')."\n";
$tmp2=trim(str_ireplace(' ','%20',$tmp2));
$tmp2=str_ireplace('\'',''',$tmp2);
if (isset($tmp1) and isset($data['link'])){
$data['share']="
";
$found++;
}else{$data['share']=NULL;}
if ($_SERVER['SERVER_NAME']==="192.168.4.250" or $_SERVER['SERVER_NAME']==="localhost"){
if (!is_null($data['lan_code'])){
$Mcon=pg_connect("host=".$dbro['host']." dbname=movie_system user=".$dbro['user']." password=".$dbro['passw']);
$tmp=trim(str_ireplace('a/','',$data['lan_code']));
$aa="SELECT * FROM movie_system.active WHERE active.yts=".$tmp;
$ab=pg_fetch_array(pg_query($Mcon,$aa));
if (isset($ab['yts'])){
$data['Star']="
";
}else{
$data['Star']="
";
}
}
}
$data['title']=highlightStr($data['title'],$quary,"blue");
$data['description']=highlightStr($data['description'],$quary,"red");
display($data);unset($tmp1,$tmp2,$data);
memory_get_usage();
}
}
include('/media/10T/ADMIN/.TS_config_Web.php');
include('/media/10T/ADMIN/.tidysearch.php');
$botZero=" Help us #TakeTheInternetBack, join the TidySearch network. TidySearch has indexed ".number_format($Tpages)." pages on ".number_format($Websites)." sites.";
echo "