2026-04-29 15:05:51 -07:00
< ? PHP
2026-05-17 19:44:49 -07:00
//ini_set('display_errors', 1);ini_set('display_startup_errors', 1);error_reporting(E_ALL);
2026-04-29 15:05:51 -07:00
$StartTime = date ( 'H:i:s' );
$home_dir = __DIR__ ;
include_once ( 'TSfun.php' );
$UPD = date ( 'Y-m-d' ); $UPT = date ( 'H:i:s' );
$qq = $quary = NULL ; $THits = $offset = 0 ;
2026-05-17 19:44:49 -07:00
include ( '/media/10T/ADMIN/.tidysearch.php' );
2026-04-29 15:05:51 -07:00
$con = pg_connect ( " host= " . $dbro [ 'host' ] . " dbname=tidysearch user= " . $dbro [ 'user' ] . " password= " . $dbro [ 'passw' ]);
$sql = " SELECT idex FROM tidysearch.pages ORDER BY pages.idex DESC LIMIT 1; " ;
$row = pg_fetch_array ( pg_query ( $con , $sql ));
$pagesindexed = $row [ 'idex' ];
2026-05-17 19:44:49 -07:00
$Tpages = 0 ;
$aa = " SELECT idex FROM tidysearch.pages ORDER BY pages.idex; " ;
$Tpages = pg_num_rows ( pg_query ( $con , $aa ));
2026-04-29 15:05:51 -07:00
if ( isset ( $_GET [ 'pp' ])){
$pp = $_GET [ 'pp' ];
if ( ! ctype_digit ( $pp ) or $pp > ( round ( $pagesindexed / 10 , 0 , PHP_ROUND_HALF_DOWN ) + 1 ) or $pp < 0 ){
echo " <B> " . $pp . " </B><BR> " ;
2026-05-17 19:44:49 -07:00
// $send="Line ".__LINE__." Possible DoS attack. ?pp=".$pp." from ".$_SERVER['HTTP_USER_AGENT'];
// send_group("TidyWeb","system@lobby.mpaq.org",$send,"mpaq.org");
2026-04-29 15:05:51 -07:00
header ( " Refresh:0; url=/bot_trap/?pp= " . $pp );
exit ;
}
} else { $pp = 1 ;}
if ( isset ( $_GET [ 'qq' ])){
$quary = $qq = trim ( $_GET [ 'qq' ]);
2026-05-17 19:44:49 -07:00
$quary = trim ( htmlentities ( $quary , ENT_QUOTES | ENT_HTML5 , 'UTF-8' , true ));
2026-04-29 15:05:51 -07:00
}
$pages = paging ( '/' , $pp , $pagesindexed , $qq , $offset );
$sql = " SELECT * FROM tidysearch.sites WHERE sites.hits>0; " ;
$ret = pg_query ( $con , $sql );
2026-05-17 19:44:49 -07:00
while ( $row = pg_fetch_array ( $ret )){
if ( isset ( $row [ 'hits' ])){
$THits = $THits + $row [ 'hits' ];
}
}
2026-04-29 15:05:51 -07:00
$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 " <!DOCTYPE html>
<html lang='en-US'>
<HEAD>
<META charSet='utf-8'>
2026-05-17 19:44:49 -07:00
<!-- <META name='color-scheme' content='light dark'> -->
2026-04-29 15:05:51 -07:00
<META name='viewport' content='width=device-width, initial-scale=1, user-scalable=1 , viewport-fit=auto'>
<META http-equiv='content-language' CONTENT='en-us'>
<META http-equiv='Content-Type' CONTENT='text/html; charset=UTF-8'>
<META http-equiv='Default-Style' CONTENT='desktop'>
<META NAME='robots' content='index, nofollow, noarchive'>
<LINK rel='stylesheet' href='TS.css'>
<META property='og:type' CONTENT='website'>
<META name='keywords' content=' " . $keywords . " '>
<META name='description' content=' " . $desc . " '>
<META NAME='author' CONTENT=' " . $SITE . " All Copy Rights reserved by MPAQ © 2020- " . date ( 'Y' ) . " '>
<LINK rel='shortcut icon' href=' " . $site_addy . " /TSLogo.jpg' type='image/x-icon'>
<LINK rel='icon' href=' " . $site_addy . " /TSLogo.jpg' type='image/x-icon'>
<LINK rel='apple-touch-icon' sizes='120x120' href=' " . $site_addy . " /TSLogo.jpg' type='image/x-icon'>
<LINK rel='apple-touch-icon' sizes='152x152' href=' " . $site_addy . " /TSLogo.jpg' type='image/x-icon'>
<META NAME='fediverse:creator' content='@bob@beamship.mpaq.org'>
<META property='og:title' content=' " . $title . " '>
<META property='og:description' content=' " . $desc . " '>
<META property='og:updated_time' content=' " . $UPD . " T " . $UPT . " Z'>
<meta property='site_name' content=' " . $title . " '>
<META property='og:url' CONTENT=' " . $site_addy . " '>
<META property='og:image' content=' " . $site_addy . " /TSLogo.jpg'>
<META NAME='twitter:site' content=' " . $title . " '>
<META NAME='twitter:label1' content=' " . $title . " '>
<META NAME='twitter:data1' content=' " . $title . " '>
<META NAME=”twitter:title” content=' " . $title . " '>
<META NAME=”twitter:card” content='website'>
<META NAME='twitter:description' CONTENT=' " . $desc . " '>
<META NAME='twitter:url' CONTENT=' " . $site_addy . " '>
<META NAME='twitter:image' CONTENT=' " . $site_addy . " /TSLogo.jpg'>
<META itemprop='title' CONTENT=' " . $title . " '>
<META itemprop='name' CONTENT=' " . $SITE . " '>
<META itemprop='description' CONTENT=' " . $desc . " '>
<META itemprop='url' CONTENT=' " . $site_addy . " '>
<META itemprop='image' CONTENT=' " . $site_addy . " /TSLogo.jpg'>
<TITLE> " . $SITE . " </TITLE>
</HEAD>
<BODY>
<CENTER>
<TABLE BORDER='0' WIDTH='99%' VALIGN='middle'>
<TR>
<TD ALIGN='left' WIDTH='15%' VALIGN='vertical-align:top'>
<abbr title='Dig as much as you can, we do not have garbage here :-)'><A HREF='/'><IMG SRC='TSLogo.jpg' STYLE='max-width: 70px;max-height: 70px;border: 0px solid #000000;' ALT='Dig as much as you can, we do not have garbage here :-)' loading='eager'></A></abbr><BR> " ;
?>
</TD>
<TD ALIGN='center' WIDTH='*' VALIGN='vertical-align:middle'>
<form action='/' id='qq' name='qq' method='get'>
<input type='text' placeholder='What are you looking for?' name='qq' CLASS='search'>
<input id='search' name='' type='submit' value='Search'></form>
<button onclick="location='/'">Clear</button> <button onclick="location='/books'">Books</button> <button onclick="location='/feed'">RSS Feed</button>
<BR><?PHP echo $pages[0];?>
</TD>
</TR>
</TABLE>
</CENTER>
<?PHP
if (is_null($quary)){
if (isset($pp)){$offset=$pp*10;}
$sql="SELECT * FROM ".$dbro['database'].".pages WHERE date IS NOT NULL ORDER BY pages.date DESC, pages.idex DESC LIMIT 10 OFFSET ".$offset.";";
$ret=pg_query($con,$sql);
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']="
<abbr title='Share to the Fediverse'>
<A HREF='/share/select-instance.php?title=".$tmp1."&desc=".$tmp2."&url=".$data['link']."' TARGET='_blank'>
<IMG SRC='share/masto.gif' ALT='Share to the Fediverse'>
</A>
</abbr>
";
$found++;
}else{$data['share']=NULL;}
2026-05-17 19:44:49 -07:00
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']="
<abbr title='Go to the Media Center'>
<A HREF='https://192.168.6.250/".$data['lan_code']."' TARGET='_blank'>
<IMG SRC='/icons/red.jpg'>
</A>
</abbr>";
}else{
$data['Star']="
<abbr title='Go to the Media Center'>
<A HREF='https://192.168.6.250/".$data['lan_code']."' TARGET='_blank'>
<IMG SRC='/icons/black.jpg'>
</A>
</abbr>";
}
}
}
2026-04-29 15:05:51 -07:00
display($data);unset($tmp1,$tmp2,$data);
memory_get_usage();
}
}else{
$LINE=0;
if (isset($pp)){$offset=$pp*10;}else{$offset=0;}
2026-05-10 13:13:09 -07:00
$sql="select * from tidysearch.pages where kwords ilike '% ".$quary." %' ORDER BY pages.date DESC, pages.idex DESC LIMIT 10 OFFSET ".$offset.";";
2026-04-29 15:05:51 -07:00
$test=pg_fetch_array(pg_query($con,$sql));
if ($test==false){
2026-05-10 13:13:09 -07:00
$sql="select * from tidysearch.pages where kwords ilike '%".$quary." %' ORDER BY pages.date DESC, pages.idex DESC LIMIT 10 OFFSET ".$offset.";";
2026-04-29 15:05:51 -07:00
$test=pg_fetch_array(pg_query($con,$sql));
$LINE=__LINE__;
}
if ($test==false){
2026-05-10 13:13:09 -07:00
$sql="select * from tidysearch.pages where kwords ilike '% ".$quary."%' ORDER BY pages.date DESC, pages.idex DESC LIMIT 10 OFFSET ".$offset.";";
2026-04-29 15:05:51 -07:00
$test=pg_fetch_array(pg_query($con,$sql));
$LINE=__LINE__;
}
if ($test==false){
2026-05-10 13:13:09 -07:00
$sql="select * from tidysearch.pages where kwords ilike '%".$quary."%' ORDER BY pages.date DESC, pages.idex DESC LIMIT 10 OFFSET ".$offset.";";
2026-04-29 15:05:51 -07:00
$test=pg_fetch_array(pg_query($con,$sql));
$LINE=__LINE__;
}
if ($test==false){
2026-05-10 13:13:09 -07:00
$sql="select * from tidysearch.pages where title ilike '%".$quary."%' ORDER BY pages.date DESC, pages.idex DESC LIMIT 10 OFFSET ".$offset.";";
2026-04-29 15:05:51 -07:00
$test=pg_fetch_array(pg_query($con,$sql));
$LINE=__LINE__;
}
if ($test==false){
2026-05-10 13:13:09 -07:00
$sql="select * from tidysearch.pages where description ilike '%".$quary."%' ORDER BY pages.date DESC, pages.idex DESC LIMIT 10 OFFSET ".$offset.";";
2026-04-29 15:05:51 -07:00
$test=pg_query($con,$sql);
$test=pg_fetch_array(pg_query($con,$sql));
$LINE=__LINE__;
}
if ($test==true){
2026-05-17 19:44:49 -07:00
//echo "Line: ".$LINE." <B>".$sql."</B><BR><BR>";
2026-04-29 15:05:51 -07:00
$ret=pg_query($con,$sql);
}else{
echo "<CENTER><H1>Nothing found</H1></CENTER>";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'];
2026-05-17 19:44:49 -07:00
$aa="SELECT * FROM ".$dbro['database'].".sites WHERE sites.index=".$data['SiteID'].";";
2026-04-29 15:05:51 -07:00
$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']="
<abbr title='Share to the Fediverse'>
<A HREF='/share/select-instance.php?title=".$tmp1."&desc=".$tmp2."&url=".$data['link']."' TARGET='_blank'>
<IMG SRC='share/masto.gif' ALT='Share to the Fediverse'>
</A>
</abbr>
";
$found++;
}else{$data['share']=NULL;}
2026-05-17 19:44:49 -07:00
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']="
<abbr title='Go to the Media Center'>
<A HREF='https://192.168.6.250/".$data['lan_code']."' TARGET='_blank'>
<IMG SRC='/icons/red.jpg'>
</A>
</abbr>";
}else{
$data['Star']="
<abbr title='Go to the Media Center'>
<A HREF='https://192.168.6.250/".$data['lan_code']."' TARGET='_blank'>
<IMG SRC='/icons/black.jpg'>
</A>
</abbr>";
}
}
}
2026-04-29 15:05:51 -07:00
$data['title']=highlightStr($data['title'],$quary,"blue");
$data['description']=highlightStr($data['description'],$quary,"red");
display($data);unset($tmp1,$tmp2,$data);
memory_get_usage();
}
}
2026-05-17 19:44:49 -07:00
include('/media/10T/ADMIN/.TS_config_Web.php');
include('/media/10T/ADMIN/.tidysearch.php');
$botZero="<BR>Help us <B><A HREF='https://212.102.59.80:250/keys.php' rel='noindex, nofollow' STYLE='color:blue;'>#TakeTheInternetBack</A></B>,<BR>join the TidySearch network.<BR>TidySearch has indexed <B>".number_format($Tpages)."</B> pages on <B>".number_format($Websites)."</B> sites.";
2026-04-29 15:05:51 -07:00
echo " <CENTER>".$pages[0]."
<BR>
<BR>
<FONT SIZE='-2'>
<B>TidySearch ".$version."</B><BR>
All Copy Rights reserved by MPAQ © 2020-".date('Y')."<BR>
</FONT>
<FONT SIZE='-1'>
".$botZero."<BR><BR>
<A HREF='/tos.html' TARGET='_blank' STYLE='color: red;'>ToS</A> :
<A HREF='/about.php' TARGET='_blank' STYLE='color: blue;'>About ".$SITE."</A><BR>
<A HREF='/mpaq.html' TARGET='_blank' STYLE='color: red;'>About MPAQ</A> :
<A HREF='/team/9' TARGET='_blank' STYLE='color: blue;'>About the Author</A> :
<A HREF='/staff.php' TARGET='_blank' STYLE='color: red;'>MPAQ Team</A><BR>
</FONT>
2026-05-17 19:44:49 -07:00
<BR>
<TABLE BORDER='1' WIDTH='50%' VALIGN='middle'><TR><TD ALIGN='center' VALIGN='vertical-align:middle'>
Make a recommendation to our list.<BR>The more you can tell us,<BR>the easier it will be to include:
<FORM action='recommend.php' method='post' name='recommend' id='recommend' CLASS='fix'>
<input type='text' name='SiteName' id='SiteName' placeholder='Site Name, Required' size='25' required><BR>
<input type='text' placeholder='Site Address, Required' name='url' size='25' required><BR>
<input type='text' placeholder='RSS Feed, Optional' name='rss' size='25'><BR>
<input type='text' placeholder='Publised Language, Optional' name='lang' size='25'><BR>
<input type='text' placeholder='Your email, Optional' name='email' size='25'><BR>
<input type='submit' value='Recommend a site'>
</FORM>
</TD></TR></TABLE>
<BR>
2026-04-29 15:05:51 -07:00
</CENTER>
";
2026-05-17 19:44:49 -07:00
memory_get_usage();
if ($_SERVER['SERVER_NAME']==="192.168.4.250" or $_SERVER['SERVER_NAME']==="localhost"){
echo "<CENTER> Hits: ".$THits."<BR>".$sql."<BR>Mem: ".memory_get_usage()."<BR>Proc: ".time_check($StartTime)."</CENTER>";
}
// CREATE UNIQUE INDEX dex ON tidysearch.sites (index);
2026-04-29 15:05:51 -07:00
?>
</BODY>
</HTML>
2026-05-17 19:44:49 -07:00