diff --git a/index.php b/index.php new file mode 100644 index 0000000..62af7d5 --- /dev/null +++ b/index.php @@ -0,0 +1,251 @@ +(round($pagesindexed/10,0,PHP_ROUND_HALF_DOWN)+1) or $pp<0){ + echo "".$pp."
"; + header("Refresh:0; url=/bot_trap/?pp=".$pp); + exit; + } +}else{$pp=1;} +if (isset($_GET['qq'])){ + $quary=$qq=trim($_GET['qq']); +// $quary=strtolower($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." + + +
+ + + + + +
+ Dig as much as you can, we do not have garbage here :-)
"; +?> +
+
+ +
+ +
+
+
+ + + Share to the Fediverse + + + "; + $found++; + }else{$data['share']=NULL;} + display($data);unset($tmp1,$tmp2,$data); + memory_get_usage(); + } +}else{ +/* Database searching takes place here but still needs work */ + $LINE=0; + if (isset($pp)){$offset=$pp*10;}else{$offset=0;} + $sql="select * from tidysearch.pages where kwords like '% ".$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 like '%".$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 like '% ".$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 like '%".$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 like '%".$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 like '%".$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){ + $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 ".$db['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'])){ +/* +This is a share button for the Fediverse and can be found at: +https://github.com/ArmandPhilippot/mastodon-sharing-button but seems to not be active +If needed, disable/comment out this secton +*/ + $data['share']=" + + + Share to the Fediverse + + + "; + $found++; + }else{$data['share']=NULL;} + $data['title']=highlightStr($data['title'],$quary,"blue"); + $data['description']=highlightStr($data['description'],$quary,"red"); + display($data);unset($tmp1,$tmp2,$data); + memory_get_usage(); + } +} +$botZero="
Help us #TakeTheInternetBack,
join the TidySearch network.
TidySearch has indexed ".number_format($pagesindexed)." pages."; +echo "
".$pages[0]." +
+
+ + TidySearch ".$version."
+ All Copy Rights reserved by MPAQ © 2020-".date('Y')."
+
+ + ".$botZero."

+ ToS : + About ".$SITE."
+ About MPAQ : + About the Author : + MPAQ Team
+
+
+"; +memory_get_usage(); /* Fource PHP cache cleanup */ +?> + +